public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PATCH] Driver Core patches for 2.6.15
@ 2006-01-05  0:48 Greg KH
  2006-01-05  0:49 ` [PATCH] remove CONFIG_KOBJECT_UEVENT option Greg KH
  2006-01-05  1:38 ` [GIT PATCH] Driver Core patches for 2.6.15 Linus Torvalds
  0 siblings, 2 replies; 34+ messages in thread
From: Greg KH @ 2006-01-05  0:48 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Here are a lot of driver core patches for 2.6.15.  They have all been in
the past few -mm releases with no problems.  They contain the following
things:
	- sysfs fixes.
	- klist fixes.
	- input build fixes.
	- platform driver interface additions
	- uevent and hotplug merge together
	- block device symlink fixes
	- lots of other good stuff, see the changelog below.

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/powerpc/eeh-pci-error-recovery.txt |   31 -
 MAINTAINERS                                      |    6 
 arch/arm/common/amba.c                           |    6 
 arch/ia64/sn/kernel/tiocx.c                      |    4 
 arch/powerpc/kernel/vio.c                        |    2 
 block/genhd.c                                    |   48 +-
 drivers/acpi/container.c                         |    8 
 drivers/acpi/processor_core.c                    |    8 
 drivers/acpi/scan.c                              |   14 
 drivers/base/Kconfig                             |    4 
 drivers/base/bus.c                               |   41 ++
 drivers/base/class.c                             |   68 ++--
 drivers/base/core.c                              |   42 +-
 drivers/base/cpu.c                               |    4 
 drivers/base/dd.c                                |   15 
 drivers/base/firmware_class.c                    |   45 +-
 drivers/base/memory.c                            |   12 
 drivers/base/platform.c                          |   68 ++--
 drivers/base/power/runtime.c                     |    2 
 drivers/ide/ide-cd.c                             |    1 
 drivers/ide/ide-disk.c                           |    1 
 drivers/ide/ide-floppy.c                         |    1 
 drivers/ide/ide-tape.c                           |    1 
 drivers/ide/ide.c                                |   60 +++
 drivers/ieee1394/nodemgr.c                       |   20 -
 drivers/infiniband/core/sysfs.c                  |   16 
 drivers/input/input.c                            |   54 ++-
 drivers/input/serio/serio.c                      |   22 -
 drivers/macintosh/macio_asic.c                   |    4 
 drivers/mmc/mmc_sysfs.c                          |    4 
 drivers/pci/hotplug.c                            |   44 +-
 drivers/pci/pci-driver.c                         |    6 
 drivers/pci/pci.h                                |    4 
 drivers/pcmcia/cs.c                              |   10 
 drivers/pcmcia/ds.c                              |   50 +--
 drivers/pnp/pnpbios/core.c                       |    8 
 drivers/s390/cio/ccwgroup.c                      |    4 
 drivers/s390/cio/device.c                        |    4 
 drivers/s390/crypto/z90main.c                    |    1 
 drivers/scsi/ipr.c                               |    4 
 drivers/usb/core/usb.c                           |   86 ++---
 drivers/usb/host/hc_crisv10.c                    |    2 
 drivers/w1/w1.c                                  |   14 
 fs/partitions/check.c                            |   33 +-
 fs/super.c                                       |   15 
 fs/sysfs/dir.c                                   |    6 
 include/linux/device.h                           |   14 
 include/linux/firmware.h                         |    2 
 include/linux/input.h                            |   81 ++--
 include/linux/kobject.h                          |  110 +++---
 include/linux/kobject_uevent.h                   |   57 ---
 include/linux/platform_device.h                  |    1 
 include/linux/sysctl.h                           |    2 
 include/linux/usb.h                              |    2 
 init/Kconfig                                     |   36 --
 kernel/ksysfs.c                                  |   42 +-
 kernel/sysctl.c                                  |    8 
 lib/klist.c                                      |    2 
 lib/kobject.c                                    |    4 
 lib/kobject_uevent.c                             |  379 ++++++++---------------
 net/bluetooth/hci_sysfs.c                        |    4 
 net/bridge/br_sysfs_if.c                         |    4 
 net/core/net-sysfs.c                             |   76 +---
 scripts/mod/file2alias.c                         |   62 +++
 64 files changed, 921 insertions(+), 868 deletions(-)


Adrian Bunk:
      drivers/base/power/runtime.c: #if 0 dpm_set_power_state()

Alan Stern:
      Hold the device's parent's lock during probe and remove

Andrew Morton:
      kobject_uevent CONFIG_NET=n fix

Dmitry Torokhov:
      Driver Core: Add platform_device_del()
      Driver Core: Rearrange exports in platform.c

Frank Pavlic:
      klist: Fix broken kref counting in find functions

Greg Kroah-Hartman:
      HOTPLUG: always enable the .config option, unless EMBEDDED
      Driver core: Make block devices create the proper symlink name
      Driver core: only all userspace bind/unbind if CONFIG_HOTPLUG is enabled

Kay Sievers:
      remove CONFIG_KOBJECT_UEVENT option
      remove mount/umount uevents from superblock handling
      keep pnpbios usermod_helper away from hotplug_path[]
      add uevent_helper control in /sys/kernel/
      merge kobject_uevent and kobject_hotplug
      driver core: replace "hotplug" by "uevent"
      ide: MODALIAS support for autoloading of ide-cd, ide-disk, ...
      net: swich device attribute creation to default attrs

Kumar Gala:
      Allow overlapping resources for platform devices

Paul Jackson:
      driver kill hotplug word from sn and others fix

Rusty Russell:
      Input: add modalias support
      Input: fix add modalias support build error

Steven Rostedt:
      sysfs: handle failures in sysfs_make_dirent


^ permalink raw reply	[flat|nested] 34+ messages in thread
* [PATCH] Hold the device's parent's lock during probe and remove
@ 2005-11-17 21:54 Alan Stern
  0 siblings, 0 replies; 34+ messages in thread
From: Alan Stern @ 2005-11-17 21:54 UTC (permalink / raw)
  To: Greg KH; +Cc: Patrick Mochel, USB development list, Kernel development list

Greg:

This patch (as604) makes the driver core hold a device's parent's lock as 
well as the device's lock during calls to the probe and remove methods in 
a driver.  This facility is needed by USB device drivers, owing to the 
peculiar way USB devices work:

	A device provides multiple interfaces, and drivers are bound
	to interfaces rather than to devices;

	Nevertheless a reset, reset-configuration, suspend, or resume
	affects the entire device and requires the caller to hold the
	lock for the device, not just a lock for one of the interfaces.

Since a USB driver's probe method is always called with the interface lock
held, the locking order rules (always lock parent before child) prevent
these methods from acquiring the device lock.  The solution provided here
is to call all probe and remove methods, for all devices (not just USB),
with the parent lock already acquired.

Although currently only the USB subsystem requires these changes, people 
have mentioned in prior discussion that the overhead of acquiring an extra 
semaphore in all the prove/remove sequences is not overly large.

Up to now, the USB core has been using its own set of private semaphores.  
A followup patch will remove them, relying entirely on the device
semaphores provided by the driver core.

The code paths affected by this patch are:

	device_add and device_del: The USB core already holds the parent
	lock, so no actual change is needed.

	driver_register and driver_unregister: The driver core will now
	lock both the parent and the device before probing or removing.

	driver_bind and driver_unbind (in sysfs): These routines will
	now lock both the parent and the device before binding or
	unbinding.

	bus_rescan_devices: The helper routine will lock the parent
	before probing a device.

I have not tested this patch for conflicts with other subsystems.  As far 
as I can see, the only possibility of conflict would lie in the 
bus_rescan_devices pathway, and it seems pretty remote.  Nevertheless, it 
would be good for this to get a lot of testing in -mm.

Alan Stern



Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---

Index: usb-2.6/drivers/base/dd.c
===================================================================
--- usb-2.6.orig/drivers/base/dd.c
+++ usb-2.6/drivers/base/dd.c
@@ -65,7 +65,8 @@ void device_bind_driver(struct device * 
  *	This function returns 1 if a match is found, an error if one
  *	occurs (that is not -ENODEV or -ENXIO), and 0 otherwise.
  *
- *	This function must be called with @dev->sem held.
+ *	This function must be called with @dev->sem held.  When called
+ *	for a USB interface, @dev->parent->sem must be held as well.
  */
 int driver_probe_device(struct device_driver * drv, struct device * dev)
 {
@@ -123,6 +124,8 @@ static int __device_attach(struct device
  *
  *	Returns 1 if the device was bound to a driver;
  *	0 if no matching device was found; error code otherwise.
+ *
+ *	When called for a USB interface, @dev->parent->sem must be held.
  */
 int device_attach(struct device * dev)
 {
@@ -152,10 +155,14 @@ static int __driver_attach(struct device
 	 * is an error.
 	 */
 
+	if (dev->parent)	/* Needed for USB */
+		down(&dev->parent->sem);
 	down(&dev->sem);
 	if (!dev->driver)
 		driver_probe_device(drv, dev);
 	up(&dev->sem);
+	if (dev->parent)
+		up(&dev->parent->sem);
 
 	return 0;
 }
@@ -181,6 +188,8 @@ void driver_attach(struct device_driver 
  *	Manually detach device from driver.
  *
  *	__device_release_driver() must be called with @dev->sem held.
+ *	When called for a USB interface, @dev->parent->sem must be held
+ *	as well.
  */
 
 static void __device_release_driver(struct device * dev)
@@ -233,10 +242,14 @@ void driver_detach(struct device_driver 
 		get_device(dev);
 		spin_unlock(&drv->klist_devices.k_lock);
 
+		if (dev->parent)	/* Needed for USB */
+			down(&dev->parent->sem);
 		down(&dev->sem);
 		if (dev->driver == drv)
 			__device_release_driver(dev);
 		up(&dev->sem);
+		if (dev->parent)
+			up(&dev->parent->sem);
 		put_device(dev);
 	}
 }
Index: usb-2.6/drivers/base/bus.c
===================================================================
--- usb-2.6.orig/drivers/base/bus.c
+++ usb-2.6/drivers/base/bus.c
@@ -152,7 +152,11 @@ static ssize_t driver_unbind(struct devi
 
 	dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
 	if (dev && dev->driver == drv) {
+		if (dev->parent)	/* Needed for USB */
+			down(&dev->parent->sem);
 		device_release_driver(dev);
+		if (dev->parent)
+			up(&dev->parent->sem);
 		err = count;
 	}
 	put_device(dev);
@@ -175,9 +179,13 @@ static ssize_t driver_bind(struct device
 
 	dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
 	if (dev && dev->driver == NULL) {
+		if (dev->parent)	/* Needed for USB */
+			down(&dev->parent->sem);
 		down(&dev->sem);
 		err = driver_probe_device(drv, dev);
 		up(&dev->sem);
+		if (dev->parent)
+			up(&dev->parent->sem);
 	}
 	put_device(dev);
 	put_bus(bus);
@@ -484,8 +492,13 @@ void bus_remove_driver(struct device_dri
 /* Helper for bus_rescan_devices's iter */
 static int bus_rescan_devices_helper(struct device *dev, void *data)
 {
-	if (!dev->driver)
+	if (!dev->driver) {
+		if (dev->parent)	/* Needed for USB */
+			down(&dev->parent->sem);
 		device_attach(dev);
+		if (dev->parent)
+			up(&dev->parent->sem);
+	}
 	return 0;
 }
 


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

end of thread, other threads:[~2006-01-05 14:04 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-05  0:48 [GIT PATCH] Driver Core patches for 2.6.15 Greg KH
2006-01-05  0:49 ` [PATCH] remove CONFIG_KOBJECT_UEVENT option Greg KH
2006-01-05  0:49   ` [PATCH] remove mount/umount uevents from superblock handling Greg KH
2006-01-05  0:49     ` [PATCH] keep pnpbios usermod_helper away from hotplug_path[] Greg KH
2006-01-05  0:49       ` [PATCH] add uevent_helper control in /sys/kernel/ Greg KH
2006-01-05  0:49         ` [PATCH] merge kobject_uevent and kobject_hotplug Greg KH
2006-01-05  0:49           ` [PATCH] driver core: replace "hotplug" by "uevent" Greg KH
2006-01-05  0:49             ` [PATCH] driver kill hotplug word from sn and others fix Greg KH
2006-01-05  0:49               ` [PATCH] HOTPLUG: always enable the .config option, unless EMBEDDED Greg KH
2006-01-05  0:49                 ` [PATCH] Hold the device's parent's lock during probe and remove Greg KH
2006-01-05  0:49                   ` [PATCH] Allow overlapping resources for platform devices Greg KH
2006-01-05  0:49                     ` [PATCH] klist: Fix broken kref counting in find functions Greg KH
2006-01-05  0:49                       ` [PATCH] kobject_uevent CONFIG_NET=n fix Greg KH
2006-01-05  0:49                         ` [PATCH] Input: add modalias support Greg KH
2006-01-05  0:49                           ` [PATCH] ide: MODALIAS support for autoloading of ide-cd, ide-disk, Greg KH
2006-01-05  0:49                             ` [PATCH] Driver core: Make block devices create the proper symlink name Greg KH
2006-01-05  0:49                               ` [PATCH] Driver core: only all userspace bind/unbind if CONFIG_HOTPLUG is enabled Greg KH
2006-01-05  0:49                                 ` [PATCH] Driver Core: Add platform_device_del() Greg KH
2006-01-05  0:49                                   ` [PATCH] Driver Core: Rearrange exports in platform.c Greg KH
2006-01-05  0:49                                     ` [PATCH] Input: fix add modalias support build error Greg KH
2006-01-05  0:49                                       ` [PATCH] sysfs: handle failures in sysfs_make_dirent Greg KH
2006-01-05  0:49                                         ` [PATCH] drivers/base/power/runtime.c: #if 0 dpm_set_power_state() Greg KH
2006-01-05  0:49                                           ` [PATCH] net: swich device attribute creation to default attrs Greg KH
2006-01-05  1:38 ` [GIT PATCH] Driver Core patches for 2.6.15 Linus Torvalds
2006-01-05  2:07   ` Greg KH
2006-01-05  2:40     ` Linus Torvalds
2006-01-05  3:31       ` Greg KH
2006-01-05  3:36         ` Linus Torvalds
2006-01-05  3:44           ` devfs going away, last chance to complain (was Re: [GIT PATCH] Driver Core patches for 2.6.15) Greg KH
2006-01-05  7:44             ` Steven Noonan
2006-01-05  9:17               ` Andrew Walrond
2006-01-05  9:18               ` Kyle Moffett
2006-01-05 14:04           ` [GIT PATCH] Driver Core patches for 2.6.15 John Stoffel
  -- strict thread matches above, loose matches on Subject: below --
2005-11-17 21:54 [PATCH] Hold the device's parent's lock during probe and remove Alan Stern

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