linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PATCH] Driver Core fixes for 2.6.16-rc2
@ 2006-02-06 20:28 Greg KH
  2006-02-06 20:29 ` [PATCH] Fix Userspace interface breakage in power/state Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:28 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Here are some driver core fixes for 2.6.16-rc2.  They have all been in
the last -mm with no problems.  They contain the following things:
	- buffer overflow from input MODALIAS expansion
	- spi Kconfig fixes
	- fix IB and DRM's usage of sysfs dev files (both acked by the
	  various subsystem maintainers).
	- oops fix in driver core with power files
	- build warning fixes
	- make it harder to use kobjects incorrectly (fixes an oops).

Please pull from:
	rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/
or if master.kernel.org hasn't synced up yet:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/

The full patch set will be sent to the linux-kernel mailing list, if
anyone wants to see them.

thanks,

greg k-h

 Documentation/spi/butterfly   |   23 +++++--
 drivers/base/base.h           |    4 +
 drivers/base/bus.c            |    3 
 drivers/base/power/resume.c   |    3 
 drivers/base/power/shutdown.c |    2 
 drivers/base/power/suspend.c  |    3 
 drivers/base/power/sysfs.c    |   24 +++++--
 drivers/base/sys.c            |    3 
 drivers/char/drm/drmP.h       |   10 +--
 drivers/char/drm/drm_stub.c   |    2 
 drivers/char/drm/drm_sysfs.c  |  129 +++++++++---------------------------------
 drivers/infiniband/core/ucm.c |   13 ----
 drivers/spi/Kconfig           |   10 ---
 drivers/spi/spi_butterfly.c   |   36 +++++------
 fs/debugfs/file.c             |    6 -
 lib/kobject.c                 |    9 ++
 lib/kobject_uevent.c          |    2 
 17 files changed, 111 insertions(+), 171 deletions(-)
Adrian Bunk:
      drivers/base/: proper prototypes

Benjamin Herrenschmidt:
      Fix uevent buffer overflow in input layer

Chuck Ebbert:
      kobject: don't oops on null kobject.name

David Brownell:
      SPI: spi_butterfly, restore lost deltas

Greg Kroah-Hartman:
      DRM: fix up classdev interface for drm core
      IB: fix up major/minor sysfs interface for IB core
      kobject_add() must have a valid name in order to succeed.

Pavel Machek:
      Fix Userspace interface breakage in power/state

Russell King:
      Fix compiler warning in driver core for CONFIG_HOTPLUG=N

Vincent Hanquez:
      debugfs: trivial comment fix


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] kobject_add() must have a valid name in order to succeed.
  2006-02-06 20:29         ` [PATCH] kobject: don't oops on null kobject.name Greg KH
@ 2006-02-06 20:29           ` Greg KH
  2006-02-06 20:29             ` [PATCH] Fix compiler warning in driver core for CONFIG_HOTPLUG=N Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh

[PATCH] kobject_add() must have a valid name in order to succeed.

So we might as well check to verify this, and let the user know that
something is wrong if they didn't do it correctly, instead of oopsing
later on in kobject_get_name() or somewhere else.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit c171fef5c8566cf5f57877e7832fa696ecdf5228
tree c599efed9172ce2f31835d4df01936063fad3a77
parent e3f749c4af69c4344d89f11e2293e3790eb4eaca
author Greg Kroah-Hartman <gregkh@suse.de> Fri, 20 Jan 2006 14:08:59 -0800
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800

 lib/kobject.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index 7a0e680..fe4ae36 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -162,6 +162,11 @@ int kobject_add(struct kobject * kobj)
 		return -ENOENT;
 	if (!kobj->k_name)
 		kobj->k_name = kobj->name;
+	if (!kobj->k_name) {
+		pr_debug("kobject attempted to be registered with no name!\n");
+		WARN_ON(1);
+		return -EINVAL;
+	}
 	parent = kobject_get(kobj->parent);
 
 	pr_debug("kobject %s: registering. parent: %s, set: %s\n",


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] Fix Userspace interface breakage in power/state
  2006-02-06 20:28 [GIT PATCH] Driver Core fixes for 2.6.16-rc2 Greg KH
@ 2006-02-06 20:29 ` Greg KH
  2006-02-06 20:29   ` [PATCH] DRM: fix up classdev interface for drm core Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: pavel

[PATCH] Fix Userspace interface breakage in power/state

Prevent passing invalid values down to the drivers.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 022f7b07bf2b384ece7fbd7edb90e54cd78db252
tree 7eae52ca103253babb194b8bae92c15340d82c0b
parent 68f5f996347dc2724a0dd511683643a2b6912380
author Pavel Machek <pavel@suse.cz> Sun, 22 Jan 2006 22:38:52 +0100
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800

 drivers/base/power/sysfs.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index f3a0c56..40d7242 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -27,22 +27,30 @@
 
 static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf)
 {
-	return sprintf(buf, "%u\n", dev->power.power_state.event);
+	if (dev->power.power_state.event)
+		return sprintf(buf, "2\n");
+	else
+		return sprintf(buf, "0\n");
 }
 
 static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n)
 {
 	pm_message_t state;
-	char * rest;
-	int error = 0;
+	int error = -EINVAL;
 
-	state.event = simple_strtoul(buf, &rest, 10);
-	if (*rest)
-		return -EINVAL;
-	if (state.event)
+	state.event = PM_EVENT_SUSPEND;
+	/* Older apps expected to write "3" here - confused with PCI D3 */
+	if ((n == 1) && !strcmp(buf, "3"))
 		error = dpm_runtime_suspend(dev, state);
-	else
+
+	if ((n == 1) && !strcmp(buf, "2"))
+		error = dpm_runtime_suspend(dev, state);
+
+	if ((n == 1) && !strcmp(buf, "0")) {
 		dpm_runtime_resume(dev);
+		error = 0;
+	}
+
 	return error ? error : n;
 }
 


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] kobject: don't oops on null kobject.name
  2006-02-06 20:29       ` [PATCH] SPI: spi_butterfly, restore lost deltas Greg KH
@ 2006-02-06 20:29         ` Greg KH
  2006-02-06 20:29           ` [PATCH] kobject_add() must have a valid name in order to succeed Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: 76306.1226

[PATCH] kobject: don't oops on null kobject.name

kobject_get_path() will oops if one of the component names is
NULL.  Fix that by returning NULL instead of oopsing.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit b365b3daf2a9e2a8b002ea9fef877af1c71513fd
tree dcd673d830b61ee37ab433af60c0f81ffaa86779
parent c171fef5c8566cf5f57877e7832fa696ecdf5228
author Chuck Ebbert <76306.1226@compuserve.com> Thu, 12 Jan 2006 20:02:00 -0500
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800

 lib/kobject.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index fe4ae36..efe67fa 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -72,6 +72,8 @@ static int get_kobj_path_length(struct k
 	 * Add 1 to strlen for leading '/' of each level.
 	 */
 	do {
+		if (kobject_name(parent) == NULL)
+			return 0;
 		length += strlen(kobject_name(parent)) + 1;
 		parent = parent->parent;
 	} while (parent);
@@ -107,6 +109,8 @@ char *kobject_get_path(struct kobject *k
 	int len;
 
 	len = get_kobj_path_length(kobj);
+	if (len == 0)
+		return NULL;
 	path = kmalloc(len, gfp_mask);
 	if (!path)
 		return NULL;


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] DRM: fix up classdev interface for drm core
  2006-02-06 20:29 ` [PATCH] Fix Userspace interface breakage in power/state Greg KH
@ 2006-02-06 20:29   ` Greg KH
  2006-02-06 20:29     ` [PATCH] IB: fix up major/minor sysfs interface for IB core Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh

[PATCH] DRM: fix up classdev interface for drm core

Current drm code doesn't work with userspace programs that listen only
to the kernel event netlink socket as it is trying to create its own dev
interface.  Turns out lots of code can just be deleted as the driver
core can do all of this work automatically for you.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 0650fd5824e07570f0c43980b81bb23ae917f1d7
tree 97f586939d119045900e84808e5d1b1d2342c08c
parent f67d115fe48f494d4b7f4f2024217fe52578915f
author Greg Kroah-Hartman <gregkh@suse.de> Fri, 20 Jan 2006 14:08:59 -0800
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800

 drivers/char/drm/drmP.h      |   10 +--
 drivers/char/drm/drm_stub.c  |    2 -
 drivers/char/drm/drm_sysfs.c |  129 +++++++++---------------------------------
 3 files changed, 34 insertions(+), 107 deletions(-)

diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 71b8b32..107df9f 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -980,7 +980,7 @@ extern int drm_put_head(drm_head_t * hea
 extern unsigned int drm_debug;
 extern unsigned int drm_cards_limit;
 extern drm_head_t **drm_heads;
-extern struct drm_sysfs_class *drm_class;
+extern struct class *drm_class;
 extern struct proc_dir_entry *drm_proc_root;
 
 				/* Proc support (drm_proc.h) */
@@ -1011,11 +1011,9 @@ extern void __drm_pci_free(drm_device_t 
 extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);
 
 			       /* sysfs support (drm_sysfs.c) */
-struct drm_sysfs_class;
-extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner,
-						char *name);
-extern void drm_sysfs_destroy(struct drm_sysfs_class *cs);
-extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,
+extern struct class *drm_sysfs_create(struct module *owner, char *name);
+extern void drm_sysfs_destroy(struct class *cs);
+extern struct class_device *drm_sysfs_device_add(struct class *cs,
 						 drm_head_t *head);
 extern void drm_sysfs_device_remove(struct class_device *class_dev);
 
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
index 7a9263f..68073e1 100644
--- a/drivers/char/drm/drm_stub.c
+++ b/drivers/char/drm/drm_stub.c
@@ -50,7 +50,7 @@ module_param_named(cards_limit, drm_card
 module_param_named(debug, drm_debug, int, 0600);
 
 drm_head_t **drm_heads;
-struct drm_sysfs_class *drm_class;
+struct class *drm_class;
 struct proc_dir_entry *drm_proc_root;
 
 static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index 68e43dd..0b9f98a 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -1,3 +1,4 @@
+
 /*
  * drm_sysfs.c - Modifications to drm_sysfs_class.c to support
  *               extra sysfs attribute from DRM. Normal drm_sysfs_class
@@ -19,36 +20,6 @@
 #include "drm_core.h"
 #include "drmP.h"
 
-struct drm_sysfs_class {
-	struct class_device_attribute attr;
-	struct class class;
-};
-#define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class)
-
-struct simple_dev {
-	dev_t dev;
-	struct class_device class_dev;
-};
-#define to_simple_dev(d) container_of(d, struct simple_dev, class_dev)
-
-static void release_simple_dev(struct class_device *class_dev)
-{
-	struct simple_dev *s_dev = to_simple_dev(class_dev);
-	kfree(s_dev);
-}
-
-static ssize_t show_dev(struct class_device *class_dev, char *buf)
-{
-	struct simple_dev *s_dev = to_simple_dev(class_dev);
-	return print_dev_t(buf, s_dev->dev);
-}
-
-static void drm_sysfs_class_release(struct class *class)
-{
-	struct drm_sysfs_class *cs = to_drm_sysfs_class(class);
-	kfree(cs);
-}
-
 /* Display the version of drm_core. This doesn't work right in current design */
 static ssize_t version_show(struct class *dev, char *buf)
 {
@@ -69,38 +40,16 @@ static CLASS_ATTR(version, S_IRUGO, vers
  * Note, the pointer created here is to be destroyed when finished by making a
  * call to drm_sysfs_destroy().
  */
-struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name)
+struct class *drm_sysfs_create(struct module *owner, char *name)
 {
-	struct drm_sysfs_class *cs;
-	int retval;
+	struct class *class;
+
+	class = class_create(owner, name);
+	if (!class)
+		return class;
 
-	cs = kmalloc(sizeof(*cs), GFP_KERNEL);
-	if (!cs) {
-		retval = -ENOMEM;
-		goto error;
-	}
-	memset(cs, 0x00, sizeof(*cs));
-
-	cs->class.name = name;
-	cs->class.class_release = drm_sysfs_class_release;
-	cs->class.release = release_simple_dev;
-
-	cs->attr.attr.name = "dev";
-	cs->attr.attr.mode = S_IRUGO;
-	cs->attr.attr.owner = owner;
-	cs->attr.show = show_dev;
-	cs->attr.store = NULL;
-
-	retval = class_register(&cs->class);
-	if (retval)
-		goto error;
-	class_create_file(&cs->class, &class_attr_version);
-
-	return cs;
-
-      error:
-	kfree(cs);
-	return ERR_PTR(retval);
+	class_create_file(class, &class_attr_version);
+	return class;
 }
 
 /**
@@ -110,12 +59,13 @@ struct drm_sysfs_class *drm_sysfs_create
  * Note, the pointer to be destroyed must have been created with a call to
  * drm_sysfs_create().
  */
-void drm_sysfs_destroy(struct drm_sysfs_class *cs)
+void drm_sysfs_destroy(struct class *class)
 {
-	if ((cs == NULL) || (IS_ERR(cs)))
+	if ((class == NULL) || (IS_ERR(class)))
 		return;
 
-	class_unregister(&cs->class);
+	class_remove_file(class, &class_attr_version);
+	class_destroy(class);
 }
 
 static ssize_t show_dri(struct class_device *class_device, char *buf)
@@ -132,7 +82,7 @@ static struct class_device_attribute cla
 
 /**
  * drm_sysfs_device_add - adds a class device to sysfs for a character driver
- * @cs: pointer to the struct drm_sysfs_class that this device should be registered to.
+ * @cs: pointer to the struct class that this device should be registered to.
  * @dev: the dev_t for the device to be added.
  * @device: a pointer to a struct device that is assiociated with this class device.
  * @fmt: string for the class device's name
@@ -141,46 +91,26 @@ static struct class_device_attribute cla
  * class.  A "dev" file will be created, showing the dev_t for the device.  The
  * pointer to the struct class_device will be returned from the call.  Any further
  * sysfs files that might be required can be created using this pointer.
- * Note: the struct drm_sysfs_class passed to this function must have previously been
+ * Note: the struct class passed to this function must have previously been
  * created with a call to drm_sysfs_create().
  */
-struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,
-					  drm_head_t *head)
+struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head)
 {
-	struct simple_dev *s_dev = NULL;
-	int i, retval;
+	struct class_device *class_dev;
+	int i;
 
-	if ((cs == NULL) || (IS_ERR(cs))) {
-		retval = -ENODEV;
-		goto error;
-	}
-
-	s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL);
-	if (!s_dev) {
-		retval = -ENOMEM;
-		goto error;
-	}
-	memset(s_dev, 0x00, sizeof(*s_dev));
-
-	s_dev->dev = MKDEV(DRM_MAJOR, head->minor);
-	s_dev->class_dev.dev = &(head->dev->pdev)->dev;
-	s_dev->class_dev.class = &cs->class;
-
-	snprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, "card%d", head->minor);
-	retval = class_device_register(&s_dev->class_dev);
-	if (retval)
-		goto error;
+	class_dev = class_device_create(cs, NULL,
+					MKDEV(DRM_MAJOR, head->minor),
+					&(head->dev->pdev)->dev,
+					"card%d", head->minor);
+	if (!class_dev)
+		return NULL;
 
-	class_device_create_file(&s_dev->class_dev, &cs->attr);
-	class_set_devdata(&s_dev->class_dev, head);
+	class_set_devdata(class_dev, head);
 
 	for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
-		class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]);
-	return &s_dev->class_dev;
-
-error:
-	kfree(s_dev);
-	return ERR_PTR(retval);
+		class_device_create_file(class_dev, &class_device_attrs[i]);
+	return class_dev;
 }
 
 /**
@@ -192,10 +122,9 @@ error:
  */
 void drm_sysfs_device_remove(struct class_device *class_dev)
 {
-	struct simple_dev *s_dev = to_simple_dev(class_dev);
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
-		class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]);
-	class_device_unregister(&s_dev->class_dev);
+		class_device_remove_file(class_dev, &class_device_attrs[i]);
+	class_device_unregister(class_dev);
 }


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] IB: fix up major/minor sysfs interface for IB core
  2006-02-06 20:29   ` [PATCH] DRM: fix up classdev interface for drm core Greg KH
@ 2006-02-06 20:29     ` Greg KH
  2006-02-06 20:29       ` [PATCH] SPI: spi_butterfly, restore lost deltas Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh

[PATCH] IB: fix up major/minor sysfs interface for IB core

Current IB code doesn't work with userspace programs that listen only to
the kernel event netlink socket as it is trying to create its own dev
interface.  This small patch fixes this problem, and removes some
unneeded code as the driver core handles this logic for you
automatically.

Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 68f5f996347dc2724a0dd511683643a2b6912380
tree 1a1131ef78c81129791c2c3b3cf365c7e35283aa
parent 0650fd5824e07570f0c43980b81bb23ae917f1d7
author Greg Kroah-Hartman <gregkh@suse.de> Fri, 20 Jan 2006 14:08:59 -0800
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800

 drivers/infiniband/core/ucm.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index e95c429..f6a0596 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1319,15 +1319,6 @@ static struct class ucm_class = {
 	.release = ib_ucm_release_class_dev
 };
 
-static ssize_t show_dev(struct class_device *class_dev, char *buf)
-{
-	struct ib_ucm_device *dev;
-	
-	dev = container_of(class_dev, struct ib_ucm_device, class_dev);
-	return print_dev_t(buf, dev->dev.dev);
-}
-static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
-
 static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
 {
 	struct ib_ucm_device *dev;
@@ -1364,15 +1355,13 @@ static void ib_ucm_add_one(struct ib_dev
 
 	ucm_dev->class_dev.class = &ucm_class;
 	ucm_dev->class_dev.dev = device->dma_device;
+	ucm_dev->class_dev.devt = ucm_dev->dev.dev;
 	snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d",
 		 ucm_dev->devnum);
 	if (class_device_register(&ucm_dev->class_dev))
 		goto err_cdev;
 
 	if (class_device_create_file(&ucm_dev->class_dev,
-				     &class_device_attr_dev))
-		goto err_class;
-	if (class_device_create_file(&ucm_dev->class_dev,
 				     &class_device_attr_ibdev))
 		goto err_class;
 


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] SPI: spi_butterfly, restore lost deltas
  2006-02-06 20:29     ` [PATCH] IB: fix up major/minor sysfs interface for IB core Greg KH
@ 2006-02-06 20:29       ` Greg KH
  2006-02-06 20:29         ` [PATCH] kobject: don't oops on null kobject.name Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: david-b

[PATCH] SPI: spi_butterfly, restore lost deltas

This resolves some minor version skew glitches that accumulated for the AVR
Butterfly adapter driver, which caused among other things the existence of
a duplicate Kconfig entry.  Most of it boils down to comment updates, but in
one case it removes some now-superfluous code that would be better if not
copied into other controller-level drivers.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>

---
commit 9c1da3cb46316e40bac766ce45556dc4fd8df3ca
tree d2ab578f2601383f39d316dfca0f00d12da21dba
parent 022f7b07bf2b384ece7fbd7edb90e54cd78db252
author David Brownell <david-b@pacbell.net> Sat, 21 Jan 2006 13:21:43 -0800
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800

 Documentation/spi/butterfly |   23 +++++++++++++++++------
 drivers/spi/Kconfig         |   10 ----------
 drivers/spi/spi_butterfly.c |   36 +++++++++++++++++-------------------
 3 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/Documentation/spi/butterfly b/Documentation/spi/butterfly
index a2e8c8d..9927af7 100644
--- a/Documentation/spi/butterfly
+++ b/Documentation/spi/butterfly
@@ -12,13 +12,20 @@ You can make this adapter from an old pr
 directly to the Butterfly.  Or (if you have the parts and skills) you
 can come up with something fancier, providing ciruit protection to the
 Butterfly and the printer port, or with a better power supply than two
-signal pins from the printer port.
+signal pins from the printer port.  Or for that matter, you can use
+similar cables to talk to many AVR boards, even a breadboard.
+
+This is more powerful than "ISP programming" cables since it lets kernel
+SPI protocol drivers interact with the AVR, and could even let the AVR
+issue interrupts to them.  Later, your protocol driver should work
+easily with a "real SPI controller", instead of this bitbanger.
 
 
 The first cable connections will hook Linux up to one SPI bus, with the
 AVR and a DataFlash chip; and to the AVR reset line.  This is all you
 need to reflash the firmware, and the pins are the standard Atmel "ISP"
-connector pins (used also on non-Butterfly AVR boards).
+connector pins (used also on non-Butterfly AVR boards).  On the parport
+side this is like "sp12" programming cables.
 
 	Signal	  Butterfly	  Parport (DB-25)
 	------	  ---------	  ---------------
@@ -40,10 +47,14 @@ by clearing PORTB.[0-3]); (b) configure 
 	SELECT	= J400.PB0/nSS	= pin 17/C3,nSELECT
 	GND	= J400.GND	= pin 24/GND
 
-The "USI" controller, using J405, can be used for a second SPI bus.  That
-would let you talk to the AVR over SPI, running firmware that makes it act
-as an SPI slave, while letting either Linux or the AVR use the DataFlash.
-There are plenty of spare parport pins to wire this one up, such as:
+Or you could flash firmware making the AVR into an SPI slave (keeping the
+DataFlash in reset) and tweak the spi_butterfly driver to make it bind to
+the driver for your custom SPI-based protocol.
+
+The "USI" controller, using J405, can also be used for a second SPI bus.
+That would let you talk to the AVR using custom SPI-with-USI firmware,
+while letting either Linux or the AVR use the DataFlash.  There are plenty
+of spare parport pins to wire this one up, such as:
 
 	Signal	  Butterfly	  Parport (DB-25)
 	------	  ---------	  ---------------
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index b77dbd6..7a75fae 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -75,16 +75,6 @@ config SPI_BUTTERFLY
 	  inexpensive battery powered microcontroller evaluation board.
 	  This same cable can be used to flash new firmware.
 
-config SPI_BUTTERFLY
-	tristate "Parallel port adapter for AVR Butterfly (DEVELOPMENT)"
-	depends on SPI_MASTER && PARPORT && EXPERIMENTAL
-	select SPI_BITBANG
-	help
-	  This uses a custom parallel port cable to connect to an AVR
-	  Butterfly <http://www.atmel.com/products/avr/butterfly>, an
-	  inexpensive battery powered microcontroller evaluation board.
-	  This same cable can be used to flash new firmware.
-
 #
 # Add new SPI master controllers in alphabetical order above this line
 #
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 79a3c59..ff9e5fa 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -163,21 +163,20 @@ static void butterfly_chipselect(struct 
 	struct butterfly	*pp = spidev_to_pp(spi);
 
 	/* set default clock polarity */
-	if (value)
+	if (value != BITBANG_CS_INACTIVE)
 		setsck(spi, spi->mode & SPI_CPOL);
 
 	/* no chipselect on this USI link config */
 	if (is_usidev(spi))
 		return;
 
-	/* here, value == "activate or not" */
-
-	/* most PARPORT_CONTROL_* bits are negated */
+	/* here, value == "activate or not";
+	 * most PARPORT_CONTROL_* bits are negated, so we must
+	 * morph it to value == "bit value to write in control register"
+	 */
 	if (spi_cs_bit == PARPORT_CONTROL_INIT)
 		value = !value;
 
-	/* here, value == "bit value to write in control register"  */
-
 	parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0);
 }
 
@@ -202,7 +201,9 @@ butterfly_txrx_word_mode0(struct spi_dev
 
 /* override default partitioning with cmdlinepart */
 static struct mtd_partition partitions[] = { {
-	/* JFFS2 wants partitions of 4*N blocks for this device ... */
+	/* JFFS2 wants partitions of 4*N blocks for this device,
+	 * so sectors 0 and 1 can't be partitions by themselves.
+	 */
 
 	/* sector 0 = 8 pages * 264 bytes/page (1 block)
 	 * sector 1 = 248 pages * 264 bytes/page
@@ -316,8 +317,9 @@ static void butterfly_attach(struct parp
 	if (status < 0)
 		goto clean2;
 
-	/* Bus 1 lets us talk to at45db041b (firmware disables AVR)
-	 * or AVR (firmware resets at45, acts as spi slave)
+	/* Bus 1 lets us talk to at45db041b (firmware disables AVR SPI), AVR
+	 * (firmware resets at45, acts as spi slave) or neither (we ignore
+	 * both, AVR uses AT45).  Here we expect firmware for the first option.
 	 */
 	pp->info[0].max_speed_hz = 15 * 1000 * 1000;
 	strcpy(pp->info[0].modalias, "mtd_dataflash");
@@ -330,7 +332,9 @@ static void butterfly_attach(struct parp
 				pp->dataflash->dev.bus_id);
 
 #ifdef	HAVE_USI
-	/* even more custom AVR firmware */
+	/* Bus 2 is only for talking to the AVR, and it can work no
+	 * matter who masters bus 1; needs appropriate AVR firmware.
+	 */
 	pp->info[1].max_speed_hz = 10 /* ?? */ * 1000 * 1000;
 	strcpy(pp->info[1].modalias, "butterfly");
 	// pp->info[1].platform_data = ... TBD ... ;
@@ -378,13 +382,8 @@ static void butterfly_detach(struct parp
 	pp = butterfly;
 	butterfly = NULL;
 
-#ifdef	HAVE_USI
-	spi_unregister_device(pp->butterfly);
-	pp->butterfly = NULL;
-#endif
-	spi_unregister_device(pp->dataflash);
-	pp->dataflash = NULL;
-
+	/* stop() unregisters child devices too */
+	pdev = to_platform_device(pp->bitbang.master->cdev.dev);
 	status = spi_bitbang_stop(&pp->bitbang);
 
 	/* turn off VCC */
@@ -394,8 +393,6 @@ static void butterfly_detach(struct parp
 	parport_release(pp->pd);
 	parport_unregister_device(pp->pd);
 
-	pdev = to_platform_device(pp->bitbang.master->cdev.dev);
-
 	(void) spi_master_put(pp->bitbang.master);
 
 	platform_device_unregister(pdev);
@@ -420,4 +417,5 @@ static void __exit butterfly_exit(void)
 }
 module_exit(butterfly_exit);
 
+MODULE_DESCRIPTION("Parport Adapter driver for AVR Butterfly");
 MODULE_LICENSE("GPL");


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] Fix compiler warning in driver core for CONFIG_HOTPLUG=N
  2006-02-06 20:29           ` [PATCH] kobject_add() must have a valid name in order to succeed Greg KH
@ 2006-02-06 20:29             ` Greg KH
  2006-02-06 20:29               ` [PATCH] drivers/base/: proper prototypes Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: rmk

[PATCH] Fix compiler warning in driver core for CONFIG_HOTPLUG=N

FYI, while running a build test, I found:

drivers/base/bus.c:166: warning: `driver_attr_unbind' defined but not used
drivers/base/bus.c:194: warning: `driver_attr_bind' defined but not used

Looks like these two attributes and supporting functions want to be
#ifdef HOTPLUG'd

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit e485981e52b476c1b6a00873c2f8b75b3168718f
tree 37c0f979c90bbee395ff26d65a6ce3651cdcf423
parent b365b3daf2a9e2a8b002ea9fef877af1c71513fd
author Russell King <rmk@arm.linux.org.uk> Sat, 14 Jan 2006 20:01:02 +0000
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800

 drivers/base/bus.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 29f6af5..c314156 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -133,6 +133,8 @@ static struct kobj_type ktype_bus = {
 decl_subsys(bus, &ktype_bus, NULL);
 
 
+#ifdef CONFIG_HOTPLUG
+
 /* Manually detach a device from its associated driver. */
 static int driver_helper(struct device *dev, void *data)
 {
@@ -193,6 +195,7 @@ static ssize_t driver_bind(struct device
 }
 static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
 
+#endif
 
 static struct device * next_device(struct klist_iter * i)
 {


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] debugfs: trivial comment fix
  2006-02-06 20:29               ` [PATCH] drivers/base/: proper prototypes Greg KH
@ 2006-02-06 20:29                 ` Greg KH
  2006-02-06 20:29                   ` [PATCH] Fix uevent buffer overflow in input layer Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: vincent

[PATCH] debugfs: trivial comment fix

Fix trivial type mixup in the debugfs function comments.

Signed-off-by: Vincent Hanquez <vincent@snarc.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 276e0c75f1e9a8b34b7b19e8fe188be958d420dd
tree f44e4dbc0da80ab6d732a8715f0be3ffbcdff79b
parent d87499ed1a3ba0f6dbcff8d91c96ef132c115d08
author Vincent Hanquez <vincent@snarc.org> Wed, 25 Jan 2006 14:49:13 +0100
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:18 -0800

 fs/debugfs/file.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index efc97d9..d575452 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -56,7 +56,7 @@ static u64 debugfs_u8_get(void *data)
 DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n");
 
 /**
- * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value.
+ * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write an unsigned 8 bit value.
  *
  * @name: a pointer to a string containing the name of the file to create.
  * @mode: the permission that the file should have
@@ -98,7 +98,7 @@ static u64 debugfs_u16_get(void *data)
 DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n");
 
 /**
- * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value.
+ * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write an unsigned 16 bit value.
  *
  * @name: a pointer to a string containing the name of the file to create.
  * @mode: the permission that the file should have
@@ -140,7 +140,7 @@ static u64 debugfs_u32_get(void *data)
 DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n");
 
 /**
- * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value.
+ * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write an unsigned 32 bit value.
  *
  * @name: a pointer to a string containing the name of the file to create.
  * @mode: the permission that the file should have


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] drivers/base/: proper prototypes
  2006-02-06 20:29             ` [PATCH] Fix compiler warning in driver core for CONFIG_HOTPLUG=N Greg KH
@ 2006-02-06 20:29               ` Greg KH
  2006-02-06 20:29                 ` [PATCH] debugfs: trivial comment fix Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: bunk

[PATCH] drivers/base/: proper prototypes

This patch contains the following changes:
- move prototypes to base.h
- sys.c should #include "base.h" for getting the prototype of it's
  global function system_bus_init()

Note that hidden in this patch there's a bugfix:

Caller and callee disagreed regarding the return type of
sysdev_shutdown().

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit f67d115fe48f494d4b7f4f2024217fe52578915f
tree 80c9ef160714e121b582a901d00bf792373780d3
parent e485981e52b476c1b6a00873c2f8b75b3168718f
author Adrian Bunk <bunk@stusta.de> Thu, 19 Jan 2006 17:30:17 +0100
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800

 drivers/base/base.h           |    4 ++++
 drivers/base/power/resume.c   |    3 +--
 drivers/base/power/shutdown.c |    2 +-
 drivers/base/power/suspend.c  |    3 +--
 drivers/base/sys.c            |    3 +++
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/base/base.h b/drivers/base/base.h
index e3b548d..5735b38 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -19,6 +19,10 @@ extern void bus_remove_driver(struct dev
 extern void driver_detach(struct device_driver * drv);
 extern int driver_probe_device(struct device_driver *, struct device *);
 
+extern void sysdev_shutdown(void);
+extern int sysdev_suspend(pm_message_t state);
+extern int sysdev_resume(void);
+
 static inline struct class_device *to_class_dev(struct kobject *obj)
 {
 	return container_of(obj, struct class_device, kobj);
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c
index 0a7aa07..317edbf 100644
--- a/drivers/base/power/resume.c
+++ b/drivers/base/power/resume.c
@@ -9,10 +9,9 @@
  */
 
 #include <linux/device.h>
+#include "../base.h"
 #include "power.h"
 
-extern int sysdev_resume(void);
-
 
 /**
  *	resume_device - Restore state for one device.
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index c2475f3..8826a5b 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -12,6 +12,7 @@
 #include <linux/device.h>
 #include <asm/semaphore.h>
 
+#include "../base.h"
 #include "power.h"
 
 #define to_dev(node) container_of(node, struct device, kobj.entry)
@@ -28,7 +29,6 @@ extern struct subsystem devices_subsys;
  * they only get one called once when interrupts are disabled.
  */
 
-extern int sysdev_shutdown(void);
 
 /**
  * device_shutdown - call ->shutdown() on each device to shutdown.
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
index 5050176..8660779 100644
--- a/drivers/base/power/suspend.c
+++ b/drivers/base/power/suspend.c
@@ -9,10 +9,9 @@
  */
 
 #include <linux/device.h>
+#include "../base.h"
 #include "power.h"
 
-extern int sysdev_suspend(pm_message_t state);
-
 /*
  * The entries in the dpm_active list are in a depth first order, simply
  * because children are guaranteed to be discovered after parents, and
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 66ed8f2..6fc23ab 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -21,8 +21,11 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/pm.h>
+#include <linux/device.h>
 #include <asm/semaphore.h>
 
+#include "base.h"
+
 extern struct subsystem devices_subsys;
 
 #define to_sysdev(k) container_of(k, struct sys_device, kobj)


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] Fix uevent buffer overflow in input layer
  2006-02-06 20:29                 ` [PATCH] debugfs: trivial comment fix Greg KH
@ 2006-02-06 20:29                   ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2006-02-06 20:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: benh

[PATCH] Fix uevent buffer overflow in input layer

The buffer used for kobject uevent is too small for some of the events generated
by the input layer. Bump it to 2k.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit d87499ed1a3ba0f6dbcff8d91c96ef132c115d08
tree 5baebb0e2b8b821940acc943227b18782c342bac
parent 9c1da3cb46316e40bac766ce45556dc4fd8df3ca
author Benjamin Herrenschmidt <benh@kernel.crashing.org> Wed, 25 Jan 2006 10:21:32 +1100
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:18 -0800

 lib/kobject_uevent.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index f56e27a..1b1985c 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -22,7 +22,7 @@
 #include <linux/kobject.h>
 #include <net/sock.h>
 
-#define BUFFER_SIZE	1024	/* buffer for the variables */
+#define BUFFER_SIZE	2048	/* buffer for the variables */
 #define NUM_ENVP	32	/* number of env pointers */
 
 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-02-06 20:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-06 20:28 [GIT PATCH] Driver Core fixes for 2.6.16-rc2 Greg KH
2006-02-06 20:29 ` [PATCH] Fix Userspace interface breakage in power/state Greg KH
2006-02-06 20:29   ` [PATCH] DRM: fix up classdev interface for drm core Greg KH
2006-02-06 20:29     ` [PATCH] IB: fix up major/minor sysfs interface for IB core Greg KH
2006-02-06 20:29       ` [PATCH] SPI: spi_butterfly, restore lost deltas Greg KH
2006-02-06 20:29         ` [PATCH] kobject: don't oops on null kobject.name Greg KH
2006-02-06 20:29           ` [PATCH] kobject_add() must have a valid name in order to succeed Greg KH
2006-02-06 20:29             ` [PATCH] Fix compiler warning in driver core for CONFIG_HOTPLUG=N Greg KH
2006-02-06 20:29               ` [PATCH] drivers/base/: proper prototypes Greg KH
2006-02-06 20:29                 ` [PATCH] debugfs: trivial comment fix Greg KH
2006-02-06 20:29                   ` [PATCH] Fix uevent buffer overflow in input layer Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).