summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [PATCH] libfs: add simple attribute filesArnd Bergmann2005-06-213-38/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on the discussion about spufs attributes, this is my suggestion for a more generic attribute file support that can be used by both debugfs and spufs. Simple attribute files behave similarly to sequential files from a kernel programmers perspective in that a standard set of file operations is provided and only an open operation needs to be written that registers file specific get() and set() functions. These operations are defined as void foo_set(void *data, u64 val); and u64 foo_get(void *data); where data is the inode->u.generic_ip pointer of the file and the operations just need to make send of that pointer. The infrastructure makes sure this works correctly with concurrent access and partial read calls. A macro named DEFINE_SIMPLE_ATTRIBUTE is provided to further simplify using the attributes. This patch already contains the changes for debugfs to use attributes for its internal file operations. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver Core: driver model doc updateDavid Brownell2005-06-212-26/+33
| | | | | | | | | | | | | | This updates some driver data documentation: - removes references to some fields that haven't been there for a long time now, e.g. pre-kobject or even older; - giving more information about the probe() method; - adding an example of how platform_data is used Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: unregister_node() for hotplug useKeiichiro Tokunaga2005-06-212-2/+19
| | | | | | | | | | | | This adds a generic function 'unregister_node()'. It is used to remove objects of a node going away for hotplug. All the devices on the node must be unregistered before calling this function. Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich@jp.fujitsu.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -puN drivers/base/node.c~numa_hp_base drivers/base/node.c
* [PATCH] usbcore: Don't call device_release_driver recursivelyAlan Stern2005-06-211-2/+8
| | | | | | | | | | This patch fixes usb_driver_release_interface() to make it avoid calling device_release_driver() recursively, i.e., when invoked from within the disconnect routine for the same device. The patch applies to your "driver" tree. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] driver core: Fix races in driver_detach()Alan Stern2005-06-211-13/+38
| | | | | | | | | | | | | | | | | | This patch is intended for your "driver" tree. It fixes several subtle races in driver_detach() and device_release_driver() in the driver-model core. The major change is to use klist_remove() rather than klist_del() when taking a device off its driver's list. There's no other way to guarantee that the list pointers will be updated before some other driver binds to the device. For this to work driver_detach() can't use a klist iterator, so the loop over the devices must be written out in full. In addition the patch protects against the possibility that, when a driver and a device are unregistered at the same time, one may be unloaded from memory before the other is finished using it. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] sn: fixes due to driver core changesPatrick Mochel2005-06-211-12/+9Star
| | | | | Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] usb: klist_node_attached() fixPatrick Mochel2005-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The original code looks like this: /* if interface was already added, bind now; else let * the future device_add() bind it, bypassing probe() */ if (!list_empty (&dev->bus_list)) device_bind_driver(dev); IOW, it's checking to see if the device is attached to the bus or not and binding the driver if it is. It's checking the device's bus list, which will only appear empty when the device has been initialized, but not added. It depends way too much on the driver model internals, but it seems to be the only way to do the weird crap they want to do with interfaces. When I converted it to use klists, I accidentally inverted the logic, which led to bad things happening. This patch returns the check to its orginal value. From: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: gregkh-2.6/drivers/usb/core/usb.c ===================================================================
* [PATCH] Fix typo in scdrv_init()Jason Uhlenkott2005-06-211-1/+1
| | | | | | | | Fix a typo in scdrv_init() which was breaking the build for SGI sn2. Signed-off-by: Jason Uhlenkott <jasonuhl@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver Core: fix bk-driver-core kills ppc64Patrick Mochel2005-06-212-69/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no check to see if the device is already bound to a driver, which could do bad things. The first thing to go wrong is that it will try to match a driver with a device already bound to one. In some cases (it appears with USB with drivers/usb/core/usb.c::usb_match_id()), some drivers will match a device based on the class type, so it would be common (especially for HID devices) to match a device that is already bound. The fun comes when ->probe() is called, it fails, then driver_probe_device() does this: dev->driver = NULL; Later on, that pointer could be be dereferenced without checking and cause hell to break loose. This problem could be nasty. It's very hardware dependent, since some devices could have a different set of matching qualifiers than others. Now, I don't quite see exactly where/how you were getting that crash. You're dereferencing bad memory, but I'm not sure which pointer was bad and where it came from, but it could have come from a couple of different places. The patch below will hopefully fix it all up for you. It's against 2.6.12-rc2-mm1, and does the following: - Move logic to driver_probe_device() and comments uncommon returns: 1 - If device is bound 0 - If device not bound, and no error error - If there was an error. - Move locking to caller of that function, since we want to lock a device for the entire time we're trying to bind it to a driver (to prevent against a driver being loaded at the same time). - Update __device_attach() and __driver_attach() to do that locking. - Check if device is already bound in __driver_attach() - Update the converse device_release_driver() so it locks the device around all of the operations. - Mark driver_probe_device() as static and remove export. It's an internal function, it should stay that way, and there are no other callers. If there is ever a need to export it, we can audit it as necessary. Signed-off-by: Andrew Morton <akpm@osdl.org>
* [PATCH] Driver core: Fix up the driver and device iterators to be quietergregkh@suse.de2005-06-211-13/+19
| | | | | | Also stops looping over the lists when a match is found. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de
* [PATCH] use device_for_each_child() to properly access child devices.long2005-06-211-74/+65Star
| | | | | | | | | | | | | | On Friday, March 25, 2005 8:47 PM Greg KH wrote: >Here's a fix for pci express. For some reason I don't think they are >using the driver model properly here, but I could be wrong... Thanks for making the changes. However, changes in functions: void pcie_port_device_remove(struct pci_dev *dev) and static int remove_iter(struct device *dev, void *data) are not correct. Please use the patch, which is based on kernel 2.6.12-rc1, below for a fix for these. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Use device_for_each_child() to unregister devices in ↵gregkh@suse.de2005-06-211-5/+6
| | | | | | | | nodemgr_remove_host_dev() Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -Nru a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
* [PATCH] USB: fix build warning in usb core as pointed out by Andrew.gregkh@suse.de2005-06-211-1/+1
| | | | | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: gregkh-2.6/drivers/usb/core/usb.c ===================================================================
* [PATCH] driver core: change export symbol for driver_for_each_device()gregkh@suse.de2005-06-211-1/+1
| | | | | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: linux-2.6.12-rc2/drivers/base/driver.c ===================================================================
* [PATCH] Fix up bogus comment.mochel@digitalimplant.org2005-06-211-2/+1Star
| | | | | | | Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -Nru a/drivers/base/driver.c b/drivers/base/driver.c
* [PATCH] Use a klist for device child lists.mochel@digitalimplant.org2005-06-212-23/+17Star
| | | | | | | | | | - Use klist iterator in device_for_each_child(), making it safe to use for removing devices. - Remove unused list_to_dev() function. - Kills all usage of devices_subsys.rwsem. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] use device_for_each_child() to properly access child devices.gregkh@suse.de2005-06-211-6/+10
| | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Use device_for_each_child() to unregister devices in ↵mochel@digitalimplant.org2005-06-211-5/+9
| | | | | | | | | | scsi_remove_target(). Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: gregkh-2.6/drivers/scsi/scsi_sysfs.c ===================================================================
* [PATCH] Don't reference NULL klist pointer in klist_remove().mochel@digitalimplant.org2005-06-211-2/+3
| | | | | | | Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -Nru a/lib/klist.c b/lib/klist.c
* [PATCH] Call klist_del() instead of klist_remove().mochel@digitalimplant.org2005-06-211-1/+1
| | | | | | | | - Can't wait on removing the current item in the list (the positive refcount *because* we are using it causes it to deadlock). Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Remove struct device::driver_list.mochel@digitalimplant.org2005-06-212-2/+0Star
| | | | | Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Remove struct device::bus_list.mochel@digitalimplant.org2005-06-212-2/+0Star
| | | | | Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Fix up bus code and remove use of rwsem.mochel@digitalimplant.org2005-06-211-12/+0Star
| | | | | | | | | - 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: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Fix up USB to use klist_node_attached() instead of list_empty() on ↵mochel@digitalimplant.org2005-06-211-2/+2
| | | | | | | | | | lists that will go away. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: gregkh-2.6/drivers/usb/core/usb.c ===================================================================
* [PATCH] add klist_node_attached() to determine if a node is on a list or not.mochel@digitalimplant.org2005-06-212-0/+18
| | | | | | | Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -Nru a/include/linux/klist.h b/include/linux/klist.h
* [PATCH] Use bus_for_each_{dev,drv} for driver binding.mochel@digitalimplant.org2005-06-211-33/+39
| | | | | | | | - Now possible, since the lists are locked using the klist lock and not the global rwsem. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Remove the unused device_find().mochel@digitalimplant.org2005-06-212-20/+0Star
| | | | | Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Add a klist to struct device_driver for the devices bound to it.mochel@digitalimplant.org2005-06-214-29/+37
| | | | | | | | | | | | | - Use it in driver_for_each_device() instead of the regular list_head and stop using the bus's rwsem for protection. - Use driver_for_each_device() in driver_detach() so we don't deadlock on the bus's rwsem. - Remove ->devices. - Move klist access and sysfs link access out from under device's semaphore, since they're synchronized through other means. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Add a klist to struct bus_type for its drivers.mochel@digitalimplant.org2005-06-212-29/+25Star
| | | | | | | | - Use it in bus_for_each_drv(). - Use the klist spinlock instead of the bus rwsem. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Add a klist to struct bus_type for its devices.mochel@digitalimplant.org2005-06-212-30/+27Star
| | | | | | | | - Use it for bus_for_each_dev(). - Use the klist spinlock instead of the bus rwsem. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Add initial implementation of klist helpers.mochel@digitalimplant.org2005-06-213-3/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This klist interface provides a couple of structures that wrap around struct list_head to provide explicit list "head" (struct klist) and list "node" (struct klist_node) objects. For struct klist, a spinlock is included that protects access to the actual list itself. struct klist_node provides a pointer to the klist that owns it and a kref reference count that indicates the number of current users of that node in the list. The entire point is to provide an interface for iterating over a list that is safe and allows for modification of the list during the iteration (e.g. insertion and removal), including modification of the current node on the list. It works using a 3rd object type - struct klist_iter - that is declared and initialized before an iteration. klist_next() is used to acquire the next element in the list. It returns NULL if there are no more items. This klist interface provides a couple of structures that wrap around struct list_head to provide explicit list "head" (struct klist) and list "node" (struct klist_node) objects. For struct klist, a spinlock is included that protects access to the actual list itself. struct klist_node provides a pointer to the klist that owns it and a kref reference count that indicates the number of current users of that node in the list. The entire point is to provide an interface for iterating over a list that is safe and allows for modification of the list during the iteration (e.g. insertion and removal), including modification of the current node on the list. It works using a 3rd object type - struct klist_iter - that is declared and initialized before an iteration. klist_next() is used to acquire the next element in the list. It returns NULL if there are no more items. Internally, that routine takes the klist's lock, decrements the reference count of the previous klist_node and increments the count of the next klist_node. It then drops the lock and returns. There are primitives for adding and removing nodes to/from a klist. When deleting, klist_del() will simply decrement the reference count. Only when the count goes to 0 is the node removed from the list. klist_remove() will try to delete the node from the list and block until it is actually removed. This is useful for objects (like devices) that have been removed from the system and must be freed (but must wait until all accessors have finished). Internally, that routine takes the klist's lock, decrements the reference count of the previous klist_node and increments the count of the next klist_node. It then drops the lock and returns. There are primitives for adding and removing nodes to/from a klist. When deleting, klist_del() will simply decrement the reference count. Only when the count goes to 0 is the node removed from the list. klist_remove() will try to delete the node from the list and block until it is actually removed. This is useful for objects (like devices) that have been removed from the system and must be freed (but must wait until all accessors have finished). Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -Nru a/include/linux/klist.h b/include/linux/klist.h
* [PATCH] Use driver_for_each_device() instead of manually walking list.mochel@digitalimplant.org2005-06-211-18/+23
| | | | | | | | Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: gregkh-2.6/drivers/usb/core/usb.c ===================================================================
* [PATCH] Use driver_for_each_device() in drivers/pnp/driver.c instead of ↵mochel@digitalimplant.org2005-06-211-4/+8
| | | | | | | | | manually walking list. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -Nru a/drivers/pnp/driver.c b/drivers/pnp/driver.c
* [PATCH] Add driver_for_each_device().mochel@digitalimplant.org2005-06-212-0/+38
| | | | | | | | | | Now there's an iterator for accessing each device bound to a driver. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: linux-2.6.12-rc2/drivers/base/driver.c ===================================================================
* [PATCH] Move device/driver code to drivers/base/dd.cmochel@digitalimplant.org2005-06-214-183/+203
| | | | | | | | | | 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: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Add a semaphore to struct device to synchronize calls to its driver.mochel@digitalimplant.org2005-06-215-6/+24
| | | | | | | | | | | | 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: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] fix up ipmi code after class_simple.c removalAndrew Morton2005-06-211-7/+7
| | | | | | Cc: Corey Minyard <minyard@acm.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] fix "make mandocs" after class_simple.c removalAdrian Bunk2005-06-211-1/+0Star
| | | | | | | | | | Due to the removal of class_simple.c, "make mandocs" no longer works. This patch fixes this issue. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: remove class_simple code, as no one in the tree is using it ↵gregkh@suse.de2005-06-213-210/+1Star
| | | | | | anymore. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: add kerneldoc for the new class functions.gregkh@suse.de2005-06-211-0/+43
| | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: convert the remaining class_simple users in the kernel to ↵gregkh@suse.de2005-06-211-9/+9
| | | | | | usee the new class api Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: trivial error path fixMark M. Hoffman2005-06-211-0/+1
| | | | | | | Trivial fix to USB class-creation error path; please apply. Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: convert drivers/* to use the new class api instead of ↵gregkh@suse.de2005-06-219-53/+51Star
| | | | | | class_simple Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: convert arch/* to use the new class api instead of class_simplegregkh@suse.de2005-06-212-22/+22
| | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: convert drivers/scsi/* to use the new class api instead of ↵gregkh@suse.de2005-06-213-25/+27
| | | | | | class_simple Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: convert drivers/ieee1394/* to use the new class api instead ↵gregkh@suse.de2005-06-215-15/+16
| | | | | | of class_simple Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: convert drivers/char/* to use the new class api instead of ↵gregkh@suse.de2005-06-2114-103/+103
| | | | | | class_simple Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: convert drivers/block/* to use the new class api instead of ↵gregkh@suse.de2005-06-213-22/+22
| | | | | | class_simple Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] class: convert sound/* to use the new class api instead of class_simplegregkh@suse.de2005-06-213-18/+17Star
| | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: move the usb hcd code to use the new class code.gregkh@suse.de2005-06-214-47/+39Star
| | | | | | | This moves a kref into the main hcd structure, which detaches it from the class device structure. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>