public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PATCH] driver core patches for 2.6.30-rc7
@ 2009-05-28 23:41 Greg KH
  2009-05-28 23:49 ` [PATCH 1/2] sysfs: file.c: use create_singlethread_workqueue() Greg Kroah-Hartman
  2009-05-28 23:49 ` [PATCH 2/2] Driver Core: do not oops when driver_unregister() is called for unregistered drivers Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Greg KH @ 2009-05-28 23:41 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Here are two driver-core patches for your 2.6.30-rc7 tree.


Please pull from:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git/

All of these patches have been in the linux-next and mm trees for a
while.

The patches will be sent as a follow-on to this message to lkml for people
to see.

thanks,

greg k-h

------------


 drivers/base/bus.c    |    4 +++-
 drivers/base/core.c   |    5 ++++-
 drivers/base/driver.c |    4 ++++
 fs/sysfs/file.c       |    2 +-
 4 files changed, 12 insertions(+), 3 deletions(-)

---------------

Andrew Morton (1):
      sysfs: file.c: use create_singlethread_workqueue()

Kay Sievers (1):
      Driver Core: do not oops when driver_unregister() is called for unregistered drivers


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

* [PATCH 1/2] sysfs: file.c: use create_singlethread_workqueue()
  2009-05-28 23:41 [GIT PATCH] driver core patches for 2.6.30-rc7 Greg KH
@ 2009-05-28 23:49 ` Greg Kroah-Hartman
  2009-05-28 23:49 ` [PATCH 2/2] Driver Core: do not oops when driver_unregister() is called for unregistered drivers Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2009-05-28 23:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Lai Jiangshan, Peter Zijlstra, Greg Kroah-Hartman

From: Andrew Morton <akpm@linux-foundation.org>

We don't need a kernel thread per CPU for this application.

Acked-by: Alex Chiang <achiang@hp.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 fs/sysfs/file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index b1606e0..561a9c0 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -723,7 +723,7 @@ int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
 	mutex_unlock(&sysfs_workq_mutex);
 
 	if (sysfs_workqueue == NULL) {
-		sysfs_workqueue = create_workqueue("sysfsd");
+		sysfs_workqueue = create_singlethread_workqueue("sysfsd");
 		if (sysfs_workqueue == NULL) {
 			module_put(owner);
 			return -ENOMEM;
-- 
1.6.3


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

* [PATCH 2/2] Driver Core: do not oops when driver_unregister() is called for unregistered drivers
  2009-05-28 23:41 [GIT PATCH] driver core patches for 2.6.30-rc7 Greg KH
  2009-05-28 23:49 ` [PATCH 1/2] sysfs: file.c: use create_singlethread_workqueue() Greg Kroah-Hartman
@ 2009-05-28 23:49 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2009-05-28 23:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kay Sievers, Linus Torvalds, Ingo Molnar, Greg Kroah-Hartman

From: Kay Sievers <kay.sievers@vrfy.org>

We also fix a problem with cleaning up properly when initializing
drivers and devices, so checks like this will work successfully.

Portions of the patch by Linus and Greg and Ingo.

Reported-by: Ozan Çağlayan <ozan@pardus.org.tr>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/base/bus.c    |    4 +++-
 drivers/base/core.c   |    5 ++++-
 drivers/base/driver.c |    4 ++++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index dc030f1..c659961 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -700,8 +700,10 @@ int bus_add_driver(struct device_driver *drv)
 	}
 
 	kobject_uevent(&priv->kobj, KOBJ_ADD);
-	return error;
+	return 0;
 out_unregister:
+	kfree(drv->p);
+	drv->p = NULL;
 	kobject_put(&priv->kobj);
 out_put_bus:
 	bus_put(bus);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4aa527b..1977d4b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -879,7 +879,7 @@ int device_add(struct device *dev)
 	}
 
 	if (!dev_name(dev))
-		goto done;
+		goto name_error;
 
 	pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
 
@@ -978,6 +978,9 @@ done:
 	cleanup_device_parent(dev);
 	if (parent)
 		put_device(parent);
+name_error:
+	kfree(dev->p);
+	dev->p = NULL;
 	goto done;
 }
 
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index c51f11b..8ae0f63 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -257,6 +257,10 @@ EXPORT_SYMBOL_GPL(driver_register);
  */
 void driver_unregister(struct device_driver *drv)
 {
+	if (!drv || !drv->p) {
+		WARN(1, "Unexpected driver unregister!\n");
+		return;
+	}
 	driver_remove_groups(drv, drv->groups);
 	bus_remove_driver(drv);
 }
-- 
1.6.3


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

end of thread, other threads:[~2009-05-28 23:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 23:41 [GIT PATCH] driver core patches for 2.6.30-rc7 Greg KH
2009-05-28 23:49 ` [PATCH 1/2] sysfs: file.c: use create_singlethread_workqueue() Greg Kroah-Hartman
2009-05-28 23:49 ` [PATCH 2/2] Driver Core: do not oops when driver_unregister() is called for unregistered drivers Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox