diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2005-11-18 13:58:30 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-11-18 13:58:30 -0800 |
commit | fcb016f65da6420a267d3a2af38158c656867b0d (patch) | |
tree | 56ec77c5f2b3b23358af3ae5f507815dc661449e /driver | |
parent | af5bb8b5734b69fd3b7763ac3c9d84d1373b0e1e (diff) | |
download | patches-fcb016f65da6420a267d3a2af38158c656867b0d.tar.gz |
new driver patches
Diffstat (limited to 'driver')
-rw-r--r-- | driver/add-scm-info-to-maintainers.patch | 12 | ||||
-rw-r--r-- | driver/hold-the-device-s-parent-s-lock-during-probe-and-remove.patch | 166 | ||||
-rw-r--r-- | driver/remove-KOBJECT_UEVENT.patch | 2 |
3 files changed, 173 insertions, 7 deletions
diff --git a/driver/add-scm-info-to-maintainers.patch b/driver/add-scm-info-to-maintainers.patch index 571aea662f27f..59b24c714de98 100644 --- a/driver/add-scm-info-to-maintainers.patch +++ b/driver/add-scm-info-to-maintainers.patch @@ -98,7 +98,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> S: Maintained KERNEL JANITORS -@@ -1776,6 +1786,7 @@ M: akpm@osdl.org +@@ -1782,6 +1792,7 @@ M: akpm@osdl.org P: Jeff Garzik M: jgarzik@pobox.com L: netdev@vger.kernel.org @@ -106,7 +106,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> S: Maintained NETWORKING [GENERAL] -@@ -1953,6 +1964,7 @@ P: Greg Kroah-Hartman +@@ -1959,6 +1970,7 @@ P: Greg Kroah-Hartman M: gregkh@suse.de L: linux-kernel@vger.kernel.org L: linux-pci@atrey.karlin.mff.cuni.cz @@ -114,7 +114,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> S: Supported PCI HOTPLUG CORE -@@ -1974,6 +1986,7 @@ S: Maintained +@@ -1980,6 +1992,7 @@ S: Maintained PCMCIA SUBSYSTEM P: Linux PCMCIA Team L: http://lists.infradead.org/mailman/listinfo/linux-pcmcia @@ -122,7 +122,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> S: Maintained PCNET32 NETWORK DRIVER -@@ -2183,6 +2196,7 @@ SCSI SUBSYSTEM +@@ -2189,6 +2202,7 @@ SCSI SUBSYSTEM P: James E.J. Bottomley M: James.Bottomley@SteelEye.com L: linux-scsi@vger.kernel.org @@ -130,7 +130,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> S: Maintained SCSI TAPE DRIVER -@@ -2222,6 +2236,7 @@ SERIAL ATA (SATA) SUBSYSTEM: +@@ -2228,6 +2242,7 @@ SERIAL ATA (SATA) SUBSYSTEM: P: Jeff Garzik M: jgarzik@pobox.com L: linux-ide@vger.kernel.org @@ -138,7 +138,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> S: Supported SGI SN-IA64 (Altix) SERIAL CONSOLE DRIVER -@@ -2756,6 +2771,7 @@ M: gregkh@suse.de +@@ -2749,6 +2764,7 @@ M: gregkh@suse.de L: linux-usb-users@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net W: http://www.linux-usb.org diff --git a/driver/hold-the-device-s-parent-s-lock-during-probe-and-remove.patch b/driver/hold-the-device-s-parent-s-lock-during-probe-and-remove.patch new file mode 100644 index 0000000000000..ea08e16f53e13 --- /dev/null +++ b/driver/hold-the-device-s-parent-s-lock-during-probe-and-remove.patch @@ -0,0 +1,166 @@ +From stern@rowland.harvard.edu Thu Nov 17 13:44:14 2005 +Date: Thu, 17 Nov 2005 16:54:12 -0500 (EST) +From: Alan Stern <stern@rowland.harvard.edu> +To: Greg KH <greg@kroah.com> +cc: Patrick Mochel <mochel@digitalimplant.org> +Subject: Hold the device's parent's lock during probe and remove +Message-ID: <Pine.LNX.4.44L0.0511171633150.4465-100000@iolanthe.rowland.org> + +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> + +--- + drivers/base/bus.c | 15 ++++++++++++++- + drivers/base/dd.c | 15 ++++++++++++++- + 2 files changed, 28 insertions(+), 2 deletions(-) + +--- gregkh-2.6.orig/drivers/base/dd.c ++++ gregkh-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); + } + } +--- gregkh-2.6.orig/drivers/base/bus.c ++++ gregkh-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; + } + diff --git a/driver/remove-KOBJECT_UEVENT.patch b/driver/remove-KOBJECT_UEVENT.patch index 0c05e81086c32..131b57a125d74 100644 --- a/driver/remove-KOBJECT_UEVENT.patch +++ b/driver/remove-KOBJECT_UEVENT.patch @@ -24,7 +24,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- gregkh-2.6.orig/MAINTAINERS +++ gregkh-2.6/MAINTAINERS -@@ -1454,12 +1454,6 @@ W: http://nfs.sourceforge.net/ +@@ -1464,12 +1464,6 @@ W: http://nfs.sourceforge.net/ W: http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/ S: Maintained |