summaryrefslogtreecommitdiffstats
path: root/drivers/base/class.c
Commit message (Collapse)AuthorAgeFilesLines
* Driver core: rename ktype_classGreg Kroah-Hartman2007-10-121-5/+5
| | | | | | | | | | | This makes it a bit more sane when trying to figure out how to clean up the ktype mess. Based on a larger patch from Kay Sievers Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: remove subsystem_init()Greg Kroah-Hartman2007-10-121-1/+1
| | | | | | | There is only one user of it, and it is only a wrapper for kset_init(). Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: remove subsys_get()Greg Kroah-Hartman2007-10-121-1/+1
| | | | | | | | There are no more subsystems, it's a kset now so remove the function and the only two users, which are in the driver core. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: remove subsys_put()Greg Kroah-Hartman2007-10-121-1/+1
| | | | | | | | There are no more subsystems, it's a kset now so remove the function and the only two users, which are in the driver core. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: remove subsys_set_ksetGreg Kroah-Hartman2007-10-121-1/+1
| | | | | | | | | This macro is only used by the driver core and is held over from when we had subsystems. It is not needed anymore. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: change add_uevent_var to use a structKay Sievers2007-10-121-32/+10
| | | | | | | | | | | | | | | | | | This changes the uevent buffer functions to use a struct instead of a long list of parameters. It does no longer require the caller to do the proper buffer termination and size accounting, which is currently wrong in some places. It fixes a known bug where parts of the uevent environment are overwritten because of wrong index calculations. Many thanks to Mathieu Desnoyers for finding bugs and improving the error handling. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver-core: make devt_attr and uevent_attr staticTejun Heo2007-07-111-28/+16
| | | | | | | | | | | | | devt_attr and uevent_attr are either allocated dynamically with or embedded in device and class_device as they needed their owner field set to the module implementing the driver. Now that sysfs implements immediate disconnect and owner field removed from struct attribute, there is no reason to do this. Remove these attributes from [class_]device and use static attribute structures instead. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* sysfs: kill unnecessary attribute->ownerTejun Heo2007-07-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | sysfs is now completely out of driver/module lifetime game. After deletion, a sysfs node doesn't access anything outside sysfs proper, so there's no reason to hold onto the attribute owners. Note that often the wrong modules were accounted for as owners leading to accessing removed modules. This patch kills now unnecessary attribute->owner. Note that with this change, userland holding a sysfs node does not prevent the backing module from being unloaded. For more info regarding lifetime rule cleanup, please read the following message. http://article.gmane.org/gmane.linux.kernel/510293 (tweaked by Greg to not delete the field just yet, to make it easier to merge things properly.) Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: keep PHYSDEV for old struct class_deviceKay Sievers2007-06-081-38/+21
| | | | | | | | | | Class-devices created by "struct class_device" are going to be replaced by "struct device". Keep the deprecated PHYSDEV* variables for the already "deprecated" struct class_device" devices. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* remove "struct subsystem" as it is no longer neededGreg Kroah-Hartman2007-05-021-10/+8
| | | | | | | | | | | We need to work on cleaning up the relationship between kobjects, ksets and ktypes. The removal of 'struct subsystem' is the first step of this, especially as it is not really needed at all. Thanks to Kay for fixing the bugs in this patch. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: fix namespace issue with devices assigned to classesKay Sievers2007-04-271-1/+1
| | | | | | | | | | | | | | | - uses a kset in "struct class" to keep track of all directories belonging to this class - merges with the /sys/devices/virtual logic. - removes the namespace-dir if the last member of that class leaves the directory. There may be locking or refcounting fixes left, I stopped when it seemed to work with network and sound modules. :) From: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: remove class_device_renameGreg Kroah-Hartman2007-02-231-42/+0
| | | | | | | | | No one uses it, and it wasn't exported to modules, so remove it. The only other user of it was the network code, which is now converted to use struct device instead. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver: remove redundant kobject_unregister checksMariusz Kozlowski2007-02-161-2/+1
| | | | | | | | Here is a patch that removes all redundant kobject_unregister argument checks. Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core fixes: make_class_name() retval checksCornelia Huck2007-02-071-7/+14
| | | | | | | | | Make make_class_name() return NULL on error and fixup callers in the driver core. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: delete virtual directory on class_unregister()Akinobu Mita2006-12-131-0/+2
| | | | | | | | | Class virtual directory is created as the need arises. But it is not deleted when the class is unregistered. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* CONFIG_SYSFS_DEPRECATED - class symlinksKay Sievers2006-12-011-51/+98
| | | | | | | | Turn off class symlinks CONFIG_SYSFS_DEPRECATED is enabled. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver Core: Move virtual_device_parent() to core.cGreg Kroah-Hartman2006-12-011-17/+0
| | | | | | | | | It doesn't need to be global or in device.h Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core fixes: sysfs_create_link() retval check in class.cCornelia Huck2006-10-181-1/+4
| | | | | | | | Check for return value of sysfs_create_link() in class_device_add(). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Fix parameter names in drivers/base/class.cRolf Eike Beer2006-09-291-4/+4
| | | | | | | | | | Change parameter names to match arguments of functions. Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Cc: Martin Waitz <tali@admingilde.org> Cc: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Class: add support for class interfaces for devicesGreg Kroah-Hartman2006-09-251-0/+10
| | | | | | | | | 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/+17
| | | | | | | | | | | 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 const to class_createMiguel Ojeda Sandonis2006-09-251-1/+1
| | | | | | | | | | | | | | Adds const to class_create second parameter, because: struct class { const char * name; /*...*/ } Signed-off-by: Miguel Ojeda Sandonis <maxextreme@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* class_device_create(): make fmt argument 'const char *'Dmitry Torokhov2006-09-251-1/+2
| | | | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* deprecate PHYSDEV* keysKay Sievers2006-09-251-1/+1
| | | | | | | | | | | | | | 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>
* 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: add generic "subsystem" link to all devicesKay Sievers2006-06-211-0/+2
| | | | | | | | | | | 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-0/+1
| | | | | | | | | | 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: change make_class_name() to take kobjectsGreg Kroah-Hartman2006-06-211-14/+17
| | | | | | | This is needed for a future patch for the device code to create the proper symlinks for devices that are "class devices". Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver Core: remove unused exportsGreg Kroah-Hartman2006-06-211-4/+2
| | | | | Cc: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: class_device_add needs error checksStephen Hemminger2006-06-211-18/+54
| | | | | | | | | class_device_add needs to check the return value of all the setup it does. It doesn't handle out of memory well. This is not complete, probably more needs to be done. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [CLASS DEVICE]: add attribute_group creationStephen Hemminger2006-05-061-0/+32
| | | | | | | | | | | | | | | | Extend the support of attribute groups in class_device's to allow groups to be created as part of the registration process. This allows network device's to avoid race between registration and creating groups. Note that unlike attributes that are a property of the class object, the groups are a property of the class_device object. This is done because there are different types of network devices (wireless for example). Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: David S. Miller <davem@davemloft.net>
* [PATCH] driver core: fix unnecessary NULL check in drivers/base/class.cJayachandran C2006-04-141-7/+6
| | | | | | | | | | | | This patch tries to fix an issue in drivers/base/class.c, please review and apply if correct. Patch Description: "parent_class" is checked for NULL already, so removed the unnecessary check. Signed-off-by: Jayachandran C. <c.jayachandran@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] driver core: replace "hotplug" by "uevent"Kay Sievers2006-01-041-33/+33
| | | | | | | | | 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] fix missing includesTim Schmielau2005-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | | I recently picked up my older work to remove unnecessary #includes of sched.h, starting from a patch by Dave Jones to not include sched.h from module.h. This reduces the number of indirect includes of sched.h by ~300. Another ~400 pointless direct includes can be removed after this disentangling (patch to follow later). However, quite a few indirect includes need to be fixed up for this. In order to feed the patches through -mm with as little disturbance as possible, I've split out the fixes I accumulated up to now (complete for i386 and x86_64, more archs to follow later) and post them before the real patch. This way this large part of the patch is kept simple with only adding #includes, and all hunks are independent of each other. So if any hunk rejects or gets in the way of other patches, just drop it. My scripts will pick it up again in the next round. Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Driver Core: add the ability for class_device structures to be nestedGreg Kroah-Hartman2005-10-281-44/+81
| | | | | | | | | | | | | | | | | | This patch allows struct class_device to be nested, so that another struct class_device can be the parent of a new one, instead of only having the struct class be the parent. This will allow us to (hopefully) fix up the input and video class subsystem mess. But please people, don't go crazy and start making huge trees of class devices, you should only need 2 levels deep to get everything to work (remember to use a class_interface to get notification of a new class device being added to the system.) Oh, this also allows us to have the possibility of potentially, someday, moving /sys/block into /sys/class. The main hindrance is that pesky /dev numberspace issue... Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] add sysfs attr to re-emit device hotplug eventKay Sievers2005-10-281-2/+14
| | | | | | | | | | 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 core: pass interface to class interface methodsDmitry Torokhov2005-10-281-4/+4
| | | | | | | | | | | Driver core: pass interface to class intreface methods Pass interface as argument to add() and remove() class interface methods. This way a subsystem can implement generic add/remove handlers and then call interface-specific ones. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: send hotplug event before adding class interfacesDmitry Torokhov2005-10-281-1/+2
| | | | | | | | | Move call to kobject_hotplug() above code that adds interfaces to a class device, otherwise children's hotplug events may reach userspace first. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] fix class symlinks in sysfsBill Nottingham2005-09-221-0/+13
| | | | | | | | | | | | | | | | The class symlinks in sysfs don't properly handle changing device names. To demonstrate, rename your network device from eth0 to eth1. Your pci (or usb, or whatever) device will still have a 'net:eth0' link, except now it points to /sys/class/net/eth1. The attached patch makes sure the class symlink name changes when the class device name changes. It isn't 100% correct, it should be using sysfs_rename_link. Unfortunately, sysfs_rename_link doesn't exist. Signed-off-by: Bill Nottingham <notting@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] drivers/base/*: use kzalloc instead of kmalloc+memsetJiri Slaby2005-09-131-6/+4
| | | | | | | | | | Fixes a bunch of memset bugs too. Signed-off-by: Lion Vollnhals <webmaster@schiggl.de> Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Driver core: small cleanup; remove check for NULL before kfree() in ↵Jesper Juhl2005-09-051-4/+2
| | | | | | | | | | driver core Remove needless checking of variable for NULL before calling kfree() on it. Applies to 2.6.13-rc6-git9 Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: link device and all class devices derived from it.Dmitry Torokhov2005-09-051-2/+31
| | | | | | | | | | | | | | | Driver core: link device and all class devices derived from it. To ease the task of locating class devices derived from a certain device create symlinks from parent device to its class devices. Change USB host class device name from usbX to usb_hostX to avoid conflict when creating aforementioned links. Tweaked by Greg to have the symlink be "class_name:class_device_name" in order to prevent duplicate links. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] Driver core: potentially fix use after free in class_device_attr_showManeesh Soni2005-08-161-4/+6
| | | | | | | | | | | | | This moves the code to free devt_attr from class_device_del() to class_dev_release() which is called after the last reference to the corresponding kobject() is gone. This allows us to keep the devt_attr alive while the corresponding sysfs file is open. Signed-off-by: Maneesh Soni <maneesh@in.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] class: add kerneldoc for the new class functions.gregkh@suse.de2005-06-201-0/+43
| | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] CLASS: move a "simple" class logic into the class core.gregkh@suse.de2005-06-201-11/+134
| | | | | | | | | | One step on improving the class api so that it can not be used incorrectly. This also fixes the module owner issue with the dev files that happened when the devt logic moved to the class core. Based on a patch originally written by Kay Sievers <kay.sievers@vrfy.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] kobject/hotplug split - class corekay.sievers@vrfy.org2005-04-181-0/+2
| | | | | | | | | | 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/+591
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