- 26 9月, 2006 3 次提交
-
-
由 Alan Stern 提交于
There is a potential deadlock in the driver core. It boils down to the fact that bus_remove_device() calls klist_remove() instead of klist_del(), thereby waiting until the reference count of the klist_node in the bus's klist of devices drops to 0. The refcount can't reach 0 so long as a modprobe process is trying to bind a new driver to the device being removed, by calling __driver_attach(). The problem is that __driver_attach() tries to acquire the device's parent's semaphore, but the caller of bus_remove_device() is quite likely to own that semaphore already. It isn't sufficient just to replace klist_remove() with klist_del(). Doing so runs the risk that the device would remain on the bus's klist of devices for some time, and so could be bound to another driver even after it was unregistered. What's needed is a new way to distinguish whether or not a device is registered, based on a criterion other than whether its klist_node is linked into the bus's klist of devices. That way driver binding can fail when the device is unregistered, even if it is still linked into the klist. This patch (as782) implements the solution, by adding a new bitflag to indiate when a struct device is registered, by testing the flag before allowing a driver to bind a device, and by changing the definition of the device_is_registered() inline. Signed-off-by: NAlan Stern <stern@rowland.harvard.edu> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Andrew Morton 提交于
Add lots of return-value checking. <pcornelia.huck@de.ibm.com>: fix bus_rescan_devices()] Cc: "Randy.Dunlap" <rdunlap@xenotime.net> Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: NAndrew Morton <akpm@osdl.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Yoichi Yuasa 提交于
When CONFIG_HOTPLUG is n, add_bind_files() definition is wrong. This patch has fixed it. Signed-off-by: NYoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 13 7月, 2006 1 次提交
-
-
由 Adrian Bunk 提交于
This patch contains the following cleanups: - make the needlessly global bus_subsys static - #if 0 the unused find_bus() Signed-off-by: NAdrian Bunk <bunk@stusta.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 01 7月, 2006 1 次提交
-
-
由 Jörn Engel 提交于
Signed-off-by: NJörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: NAdrian Bunk <bunk@stusta.de>
-
- 22 6月, 2006 3 次提交
-
-
由 Kay Sievers 提交于
Like the SUBSYTEM= key we find in the environment of the uevent, this creates a generic "subsystem" link in sysfs for every device. Userspace usually doesn't care at all if its a "class" or a "bus" device. This provides an unified way to determine the subsytem of a device, regardless of the way the driver core has created it. Signed-off-by: NKay Sievers <kay.sievers@suse.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Greg Kroah-Hartman 提交于
Cc: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Kay Sievers 提交于
split bus_add_device() and send device uevents after sysfs population Signed-off-by: NKay Sievers <kay.sievers@suse.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 15 4月, 2006 1 次提交
-
-
由 Ryan Wilson 提交于
The manual driver <-> device binding attribute in sysfs doesn't return the correct value on failure or success of driver_probe_device. driver_probe_device returns 1 on success (the driver accepted the device) or 0 on probe failure (when the driver didn't accept the device but no real error occured). However, the attribute can't just return 0 or 1, it must return the number of bytes consumed from buf or an error value. Returning 0 indicates to userspace that nothing was written (even though the kernel has tried to do the bind/probe and failed). Returning 1 indicates that only one character was accepted in which case userspace will re-try the write with a partial string. A more correct version of driver_bind would return count (to indicate the entire string was consumed) when driver_probe_device returns 1 and -ENODEV when driver_probe_device returns 0. This patch makes that change. Signed-off-by: NRyan Wilson <hap9@epoch.ncsc.mil> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 15 3月, 2006 1 次提交
-
-
由 Moore, Eric 提交于
Adding support for exposing hidden raid components for sg interface. The sdev->no_uld_attach flag will set set accordingly. The sas module supports adding/removing raid volumes using online storage management application interface. This patch was provided to me by Christoph Hellwig. Signed-off-by: NEric Moore <Eric.Moore@lsil.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de> Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
-
- 08 2月, 2006 1 次提交
-
-
由 Russell King 提交于
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: NRussell King <rmk+kernel@arm.linux.org.uk> Cc: Greg KH <greg@kroah.com> Signed-off-by: NAndrew Morton <akpm@osdl.org> Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
-
- 07 2月, 2006 1 次提交
-
-
由 Russell King 提交于
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: NRussell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 05 1月, 2006 2 次提交
-
-
由 Greg Kroah-Hartman 提交于
Thanks to drivers making their id tables __devinit, we can't allow userspace to bind or unbind drivers from devices manually through sysfs. So we only allow this if CONFIG_HOTPLUG is enabled. Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Alan Stern 提交于
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: NAlan Stern <stern@rowland.harvard.edu> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 24 11月, 2005 1 次提交
-
-
由 Alan Stern 提交于
This patch (as603) makes a few small fixes to the driver core: Change spin_lock_irq for a klist lock to spin_lock; Fix reference count leaks; Minor spelling and formatting changes. Signed-off-by: NAlan Stern <stern@rowland.harvard.edu> Acked-by Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de> Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
-
- 08 9月, 2005 1 次提交
-
-
由 James Bottomley 提交于
The problem is that klists claim to provide semantics for safe traversal of lists which are being modified. The failure case is when traversal of a list causes element removal (a fairly common case). The issue is that although the list node is refcounted, if it is embedded in an object (which is universally the case), then the object will be freed regardless of the klist refcount leading to slab corruption because the klist iterator refers to the prior element to get the next. The solution is to make the klist take and release references to the embedding object meaning that the embedding object won't be released until the list relinquishes the reference to it. (akpm: fast-track this because it's needed for the 2.6.13 scsi merge) Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de> Signed-off-by: NAndrew Morton <akpm@osdl.org> Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
-
- 06 9月, 2005 2 次提交
-
-
由 James Bottomley 提交于
at the moment, the list_head semantics are list_add(node, head) whereas current klist semantics are klist_add(head, node) This is bound to cause confusion, and since klist is the newcomer, it should follow the list_head semantics. I also added missing include guards to klist.h Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Greg Kroah-Hartman 提交于
Fix for manual binding of drivers to devices. Problem is if you pass in a valid device id, but the driver refuses to bind. Infinite loop as write() tries to resubmit the data it just sent. Thanks to Michal Ostrowski <mostrows@watson.ibm.com> for pointing the problem out. Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 18 8月, 2005 1 次提交
-
-
由 Greg KH 提交于
Fix for manual binding of drivers to devices. Problem is if you pass in a valid device id, but the driver refuses to bind. Infinite loop as write() tries to resubmit the data it just sent. Thanks to Michal Ostrowski <mostrows@watson.ibm.com> for pointing the problem out. Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de> Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
-
- 30 6月, 2005 4 次提交
-
-
由 Greg Kroah-Hartman 提交于
No one was looking at the return value of bus_rescan_devices, and it really wasn't anything that anyone in the kernel would ever care about. So change it which enabled some counting code to be removed also. Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Greg Kroah-Hartman 提交于
This adds a single file, "bind", to the sysfs directory of every driver registered with the driver core. To bind a device to a driver, write the bus id of the device you wish to bind to that specific driver to the "bind" file (remember to not add a trailing \n). If that bus id matches a device on that bus, and it does not currently have a driver bound to it, the probe sequence will be initiated with that driver and device. Note, this requires that the driver itself be willing and able to accept that device (usually through a device id type table). This patch does not make it possible to override the driver's id table. Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Greg Kroah-Hartman 提交于
This adds a single file, "unbind", to the sysfs directory of every device that is currently bound to a driver. To unbind the driver from the device, write anything to this file and they will be disconnected from each other. Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Cornelia Huck 提交于
Add bus_find_device() and driver_find_device() which allow searching for a device in the bus's resp. the driver's klist and obtain a reference on it. Signed-off-by: NCornelia Huck <cohuck@de.ibm.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 23 6月, 2005 1 次提交
-
-
由 Greg Kroah-Hartman 提交于
Don't error out if something "bad" happens when trying to bind a driver to a device. We want the sysfs attributes to be present for later when we try to tear down the device. Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 21 6月, 2005 7 次提交
-
-
由 Hannes Reinecke 提交于
The error handling in bus_add_device() and device_attach() is simply non-existing. This patch propagates any error from device_attach to the upper layers to allow for a proper recovery. From: Hannes Reinecke <hare@suse.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- Don't add devices to bus's embedded kset, since it's not used by anyone anymore. - Don't need to take the bus rwsem when calling {device,driver}_attach(), since those functions use the klists and the klists' spinlocks. Signed-off-by: NPatrick Mochel <mochel@digitalimplant.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- Use it in bus_for_each_drv(). - Use the klist spinlock instead of the bus rwsem. Signed-off-by: NPatrick Mochel <mochel@digitalimplant.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- Use it for bus_for_each_dev(). - Use the klist spinlock instead of the bus rwsem. Signed-off-by: NPatrick Mochel <mochel@digitalimplant.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
This relocates the driver binding/unbinding code to drivers/base/dd.c. This is done for two reasons: One, it's not code related to the bus_type itself; it uses some from that, some from devices, and some from drivers. And Two, it will make it easier to do some of the upcoming lock removal on that code.. Signed-off-by: NPatrick Mochel <mochel@digitalimplant.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
This adds a per-device semaphore that is taken before every call from the core to a driver method. This prevents e.g. simultaneous calls to the ->suspend() or ->resume() and ->probe() or ->release(), potentially saving a whole lot of headaches. It also moves us a step closer to removing the bus rwsem, since it protects the fields in struct device that are modified by the core. Signed-off-by: NPatrick Mochel <mochel@digitalimplant.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Dmitry Torokhov 提交于
sysfs: fix drivers/base so if an attribute doesn't implement show or store method read/write will return -EIO instead of 0. Signed-off-by: NDmitry Torokhov <dtor@mail.ru> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 18 5月, 2005 1 次提交
-
-
由 David Brownell 提交于
The driver model has a "detach_state" mechanism that: - Has never been used by any in-kernel drive; - Is superfluous, since driver remove() methods can do the same thing; - Became buggy when the suspend() parameter changed semantics and type; - Could self-deadlock when called from certain suspend contexts; - Is effectively wasted documentation, object code, and headspace. This removes that "detach_state" mechanism; net code shrink, as well as a per-device saving in the driver model and sysfs. Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 05 5月, 2005 1 次提交
-
-
由 Roman Kagan 提交于
With 2.6.11 and 2.6.12-rc2 (and perhaps a few versions before) usb drivers for multi-interface devices, which do usb_driver_release_interface() in their disconnect(), make rmmod hang. It turns out to be due to a bug in drivers/base/bus.c:driver_detach(), that iterates over the list of attached devices with list_for_each_safe() under an assumption that device_release_driver() only releases the current device, while it may also call device_release_driver() for other devices on the same list. The following patch fixes it. Please consider applying. Signed-off-by: NRoman Kagan <rkagan@mail.ru> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 17 4月, 2005 1 次提交
-
-
由 Linus Torvalds 提交于
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
-