summaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
Commit message (Collapse)AuthorAgeFilesLines
* drivers/base: Platform notify needs to occur before drivers attach to the deviceBrian Walsh2006-09-251-4/+4
| | | | | | | | | | The platform_notify call for Arm and PPC architectures needs to be called before the driver attaches to the device. The problem only presents itself when hotplugging certain devices while the driver is already loaded. Signed-off-by: Brian Walsh <brian@walsh.ws> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: add ability for devices to create and remove bin filesGreg Kroah-Hartman2006-09-251-0/+26
| | | | | | | | | Makes it easier for devices to create and remove binary attribute files so they don't have to call directly into sysfs. This is needed to help with the conversion from struct class_device to struct device. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Class: add support for class interfaces for devicesGreg Kroah-Hartman2006-09-251-1/+13
| | | | | | | | | When moving class_device usage over to device, we need to handle class_interfaces properly with devices. This patch adds that support. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: create devices/virtual/ treeGreg Kroah-Hartman2006-09-251-0/+7
| | | | | | | | | | | This change creates a devices/virtual/CLASS_NAME tree for struct devices that belong to a class, yet do not have a "real" struct device for a parent. It automatically creates the directories on the fly as needed. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: add device_rename functionGreg Kroah-Hartman2006-09-251-0/+55
| | | | | | | | The network layer needs this to convert to using struct device instead of a struct class_device. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: add ability for classes to handle devices properlyGreg Kroah-Hartman2006-09-251-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | This adds two new callbacks to the class structure: int (*dev_uevent)(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size); void (*dev_release)(struct device *dev); And one pointer: struct device_attribute * dev_attrs; which all corrispond with the same thing as the "normal" class devices do, yet this is for when a struct device is bound to a class. Someday soon, struct class_device will go away, and then the other fields in this structure can be removed too. But this is necessary in order to get the transition to work properly. Tested out on a network core patch that converted it to use struct device instead of struct class_device. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: allow devices in classes to have no parentGreg Kroah-Hartman2006-09-251-10/+11
| | | | | | | | | | | | | | | This fixes an oops when a device is attached to a class, yet has no "parent" device. An example of this would be the "lo" device in the network core. We should create a "virtual" subdirectory under /sys/devices/ for these, but no one seems to agree on a proper name for it yet... Oh, and update my copyright on the driver core. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: add groups support to struct deviceGreg Kroah-Hartman2006-09-251-0/+34
| | | | | | | | This is needed for the network class devices in order to be able to convert over to use struct device. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* device_create(): make fmt argument 'const char *'Greg Kroah-Hartman2006-09-251-1/+1
| | | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* deprecate PHYSDEV* keysKay Sievers2006-09-251-3/+7
| | | | | | | | | | | | | | deprecate PHYSDEV* values in the uevent environment These values are no longer needed and inconsistent with the stacking of class devices. The event environment should not carry properties of a parent device. The key PHYSDEVDRIVER is available as DRIVER, PHYDEVBUS is indentical SUBSYSTEM. Class devices should not carry any of these values. Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: kernel-doc in drivers/base/core.c correctionsHenrik Kretzschmar2006-07-121-15/+15
| | | | | | | | Corrects the kerneldocs for device_create() and device_destroy() with an eye on coding style, grammar and readability. Signed-off-by: Henrik Kretzschmar <henne@nachtwindheim.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: fix driver-core kernel-docRandy Dunlap2006-07-121-3/+3
| | | | | | | | | Warning(/var/linsrc/linux-2617-g4//drivers/base/core.c:574): No description found for parameter 'class' Warning(/var/linsrc/linux-2617-g4//drivers/base/core.c:574): No description found for parameter 'devt' Warning(/var/linsrc/linux-2617-g4//drivers/base/core.c:626): No description found for parameter 'devt' Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Remove obsolete #include <linux/config.h>Jörn Engel2006-06-301-1/+0
| | | | | Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
* [PATCH] Driver core: fix locking issues with the devices that are attached ↵Greg Kroah-Hartman2006-06-221-8/+11
| | | | | | | | to classes Doh, that was foolish... Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver Core: Make dev_info and friends print the bus name if there ↵Alan Stern2006-06-211-0/+16
| | | | | | | | | | | | | | is no driver This patch (as721) makes dev_info and related macros print the device's bus name if the device doesn't have a driver, instead of printing just a blank. If the device isn't on a bus either... well, then it does leave a blank space. But it will be easier for someone else to change if they want. Cc: Matthew Wilcox <matthew@wil.cx> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: add proper symlinks for devicesGreg Kroah-Hartman2006-06-211-0/+11
| | | | | | | | | | | We need to create the "compatible" symlinks that class_devices used to create when they were in the class directories so that userspace does not know anything changed at all. Yeah, we have a lot of symlinks now, but we should be able to get rid of them in a year or two... (wishful thinking...) Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: add generic "subsystem" link to all devicesKay Sievers2006-06-211-2/+7
| | | | | | | | | | | 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: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: allow struct device to have a dev_tGreg Kroah-Hartman2006-06-211-1/+161
| | | | | | | | | | This is the first step in moving class_device to being replaced by struct device. It allows struct device to export a dev_t and makes it easy to dynamically create and destroy struct device as long as they are associated with a specific class. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: bus device event delayKay Sievers2006-06-211-1/+2
| | | | | | | split bus_add_device() and send device uevents after sysfs population Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] DocBook: fix kernel-doc commentsMartin Waitz2006-01-101-2/+2
| | | | | | | | Fix typos in comments to remove kernel-doc warnings. Signed-off-by: Martin Waitz <tali@admingilde.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] driver core: replace "hotplug" by "uevent"Kay Sievers2006-01-041-21/+21
| | | | | | | | | Leave the overloaded "hotplug" word to susbsystems which are handling real devices. The driver core does not "plug" anything, it just exports the state to userspace and generates events. Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] kernel-doc: drivers/base fixesRandy Dunlap2005-10-281-2/+2
| | | | | | | driver/base: add missing function parameters; eliminate all warnings. Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] add sysfs attr to re-emit device hotplug eventKay Sievers2005-10-281-0/+16
| | | | | | | | | | A "coldplug + udevstart" can be simple like this: for i in /sys/block/*/*/uevent; do echo 1 > $i; done for i in /sys/class/*/*/uevent; do echo 1 > $i; done for i in /sys/bus/*/devices/*/uevent; do echo 1 > $i; done Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] driver model wakeup flagsDavid Brownell2005-10-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | This is a refresh of an earlier patch to add "wakeup" support to the PM core model. This provides per-device bus-neutral control of the use of wakeup events. * "struct device_pm_info" has two bits that are initialized as part of setting up the enclosing struct device: - "can_wakeup", reflecting hardware capabilities - "may_wakeup", the policy setting (when CONFIG_PM) * There's a writeable sysfs "wakeup" file, with one of two values: - "enabled", when the policy is to allow wakeup - "disabled", when the policy is not to allow it - "" if the device can't currently issue wakeups By default, wakeup is enabled on all devices that support it. If its driver doesn't support it ... treat it as a bug. :) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] fix klist semantics for lists which have elements removed on traversalJames Bottomley2005-09-071-1/+16
| | | | | | | | | | | | | | | | | | | | | 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: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] klist: fix klist to have the same klist_add semantics as list_headJames Bottomley2005-09-051-1/+1
| | | | | | | | | | | | | | | | | | 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: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: Use klist_del() instead of klist_remove().Patrick Mochel2005-06-291-1/+1
| | | | | | | | | Use klist_del() instead of klist_remove() when unregistering devices. This will prevent a deadlock when executing a recursive unregister using device_for_each_child(). Signed-off-by Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: change device_attribute callbacksYani Ioannou2005-06-201-2/+2
| | | | | | | | | This patch adds the device_attribute paramerter to the device_attribute store and show sysfs callback functions, and passes a reference to the attribute when the callbacks are called. Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Use a klist for device child lists.mochel@digitalimplant.org2005-06-201-15/+15
| | | | | | | | | | - 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] Remove struct device::driver_list.mochel@digitalimplant.org2005-06-201-1/+0
| | | | | 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-201-1/+0
| | | | | 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-201-19/+0
| | | | | 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-201-1/+1
| | | | | | | | | | | | | - 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 semaphore to struct device to synchronize calls to its driver.mochel@digitalimplant.org2005-06-201-0/+1
| | | | | | | | | | | | 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] sysfs: (driver/base) if show/store is missing return -EIODmitry Torokhov2005-06-201-2/+2
| | | | | | | | | 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: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] kset_hotplug_ops->name shoudl return const char *Dmitry Torokhov2005-06-201-1/+1
| | | | | | | | kobject: change name() method in kset_hotplug_ops return const char * since users shoudl not try to modify returned data. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] driver core: restore event order for device_add()Kay Sievers2005-05-231-2/+2
| | | | | | | | | | | As a result of the split of the kobject-registration and the corresponding hotplug event, the order of events for device_add() has changed. This restores the old order, cause it confused some userspace applications. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Driver Core: remove driver model detach_stateDavid Brownell2005-05-171-3/+0
| | | | | | | | | | | | | | | | 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: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Hotplug: Make dev->bus checking consistentAlexander Nyberg2005-05-041-1/+1
| | | | | | | | | | | Earlier in the same function dev->bus is checked before dereferenced, make consistent although I honestly don't know if dev->bus could ever be NULL Found by the Coverity tool Signed-off-by: Alexander Nyberg <alexn@dsv.su.se> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] kobject/hotplug split - devices corekay.sievers@vrfy.org2005-04-181-0/+3
| | | | | | | | | | kobject_add() and kobject_del() don't emit hotplug events anymore. Do it ourselves if we are finished populating the device directory. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Linux-2.6.12-rc2v2.6.12-rc2Linus Torvalds2005-04-161-0/+439
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!
OpenPOWER on IntegriCloud