kernel-ark/drivers
Alan Stern bf74ad5bc4 [PATCH] Hold the device's parent's lock during probe and remove
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.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 16:18:08 -08:00
..
acorn
acpi [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
atm [PATCH] drivers/atm/adummy.c NULL noise removal 2005-12-15 10:04:31 -08:00
base [PATCH] Hold the device's parent's lock during probe and remove 2006-01-04 16:18:08 -08:00
block [PATCH] cciss: fix for deregister_disk 2005-12-12 22:31:16 -08:00
bluetooth
cdrom
char Revert radeon AGP aperture offset changes 2005-12-29 13:01:54 -08:00
connector [PATCH] Add timestamp field to process events 2005-12-12 08:57:42 -08:00
cpufreq
crypto
dio
eisa
fc4 [SPARC]: introduce a SPARC Kconfig symbol 2005-12-22 23:09:54 -08:00
firmware [PATCH] dell_rbu: NULL noise removal 2005-12-15 10:04:30 -08:00
hwmon [PATCH] hwmon: w83792d fix unused fan pins 2005-11-29 21:39:22 -08:00
i2c [PATCH] i2c: Fix i2c-mv64xxx compilation error 2005-12-16 11:25:25 -08:00
ide [PATCH] ide-cd: remove write-only cmd field from struct cdrom_info 2005-12-15 02:20:49 +01:00
ieee1394 [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
infiniband [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
input [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
isdn
macintosh [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
mca
md [PATCH] md: Change case of raid level reported in sys/mdX/md/level 2005-12-19 16:47:50 -08:00
media [PATCH] Simplify the VIDEO_SAA7134_OSS Kconfig dependency line 2005-12-29 13:21:16 -08:00
message [PATCH] i2o: Do not disable pci device when it's in use 2005-12-18 11:19:43 -08:00
mfd [PATCH] input: fix ucb1x00-ts breakage after conversion to dynamic input_dev allocation 2005-12-12 08:57:45 -08:00
misc
mmc [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
mtd [SPARC]: introduce a SPARC Kconfig symbol 2005-12-22 23:09:54 -08:00
net [TG3]: Update driver version and reldate. 2005-12-28 13:05:41 -08:00
nubus
oprofile
parisc
parport
pci [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
pcmcia [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
pnp [PATCH] keep pnpbios usermod_helper away from hotplug_path[] 2006-01-04 16:18:07 -08:00
rapidio
s390 [PATCH] driver kill hotplug word from sn and others fix 2006-01-04 16:18:08 -08:00
sbus [PATCH] sbus/char/uctrl: missing prototypes and NULL noise removal 2005-12-15 10:01:28 -08:00
scsi [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
serial [ARM] 3216/1: indent and typo in drivers/serial/pxa.c 2005-12-30 15:57:35 +00:00
sh
sn
tc
telephony
usb [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
video [VIDEO] sbuslib: Disallow private mmaps. 2005-12-24 12:06:10 -08:00
w1 [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
zorro
Kconfig
Makefile Link USB drivers later in the kernel 2005-12-03 20:50:51 -08:00