summaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
Commit message (Collapse)AuthorAgeFilesLines
...
* class: rename "interfaces" to "class_interfaces" in internal class structureGreg Kroah-Hartman2008-07-211-4/+4
| | | | | | | | | | | | This renames the struct class "interfaces" field to be "class_interfaces" to make things easier when struct bus_type and struct class merge in the future. It also makes grepping for fields easier as well. Based on an idea from Kay. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* class: rename "devices" to "class_devices" in internal class structureGreg Kroah-Hartman2008-07-211-1/+1
| | | | | | | | | | | This renames the struct class "devices" field to be "class_devices" to make things easier when struct bus_type and struct class merge in the future. It also makes grepping for fields easier as well. Based on an idea from Kay. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* class: move driver core specific parts to a private structureGreg Kroah-Hartman2008-07-211-27/+30
| | | | | | | | | | | This moves the portions of struct class that are dynamic (kobject and lock and lists) out of the main structure and into a dynamic, private, structure. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver Core: add ability for class_find_device to start in middle of listGreg Kroah-Hartman2008-07-211-1/+1
| | | | | | | | | | | | | | | This mirrors the functionality that driver_find_device has as well. We add a start variable, and all callers of the function are fixed up at the same time. The block layer will be using this new functionality in a follow-on patch. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* device create: convert device_create_drvdata to device_createGreg Kroah-Hartman2008-07-211-7/+4
| | | | | | | | | | Now that device_create() has been audited, rename things back to the original call to be sane. Keep the device_create_drvdata macro around to make merges easier. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: remove device_create()Greg Kroah-Hartman2008-07-211-34/+0
| | | | | | | | There are no more users of this, and it is racy. Use device_create_drvdata() or device_create_vargs() instead. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* sysfs: add /sys/dev/{char,block} to lookup sysfs path by major:minorDan Williams2008-07-211-1/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why?: There are occasions where userspace would like to access sysfs attributes for a device but it may not know how sysfs has named the device or the path. For example what is the sysfs path for /dev/disk/by-id/ata-ST3160827AS_5MT004CK? With this change a call to stat(2) returns the major:minor then userspace can see that /sys/dev/block/8:32 links to /sys/block/sdc. What are the alternatives?: 1/ Add an ioctl to return the path: Doable, but sysfs is meant to reduce the need to proliferate ioctl interfaces into the kernel, so this seems counter productive. 2/ Use udev to create these symlinks: Also doable, but it adds a udev dependency to utilities that might be running in a limited environment like an initramfs. 3/ Do a full-tree search of sysfs. [kay.sievers@vrfy.org: fix duplicate registrations] [kay.sievers@vrfy.org: cleanup suggestions] Cc: Neil Brown <neilb@suse.de> Cc: Tejun Heo <htejun@gmail.com> Acked-by: Kay Sievers <kay.sievers@vrfy.org> Reviewed-by: SL Baur <steve@xemacs.org> Acked-by: Kay Sievers <kay.sievers@vrfy.org> Acked-by: Mark Lord <lkml@rtr.ca> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* dev_set_name: fix missing kernel-docRandy Dunlap2008-06-111-0/+1
| | | | | | | | | | Fix kernel-doc for new dev_set_name() function: Warning(lin2626-rc5//drivers/base/core.c:767): No description found for parameter 'fmt' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver-core: prepare for 2.6.27 api change by adding dev_set_nameStephen Rothwell2008-05-291-0/+15
| | | | | | | | | | Create the dev_set_name function now so that various subsystems can start changing over to it before other changes in 2.6.27 will make it compulsory. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6Linus Torvalds2008-05-201-5/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (27 commits) pktgen: make sure that pktgen_thread_worker has been executed [VLAN]: Propagate selected feature bits to VLAN devices drivers/atm/: remove CVS keywords vlan: Correctly handle device notifications for layered VLAN devices net: Fix call to ->change_rx_flags(dev, IFF_MULTICAST) in dev_change_flags() net_sched: cls_api: fix return value for non-existant classifiers ipsec: Use the correct ip_local_out function ipv6 addrconf: Allow infinite prefix lifetime. ipv6 route: Fix lifetime in netlink. ipv6 addrconf: Fix route lifetime setting in corner case. ndisc: Add missing strategies for per-device retrans timer/reachable time settings. ipv6: Move <linux/in6.h> from header-y to unifdef-y. l2tp: avoid skb truesize bug if headroom is increased wireless: Create 'device' symlink in sysfs wireless, airo: waitbusy() won't delay libertas: fix command timeout after firmware failure mac80211: Add RTNL version of ieee80211_iterate_active_interfaces mac80211 : Association with 11n hidden ssid ap. hostap: fix "registers" registration in procfs isdn/capi: Return proper errnos on module init. ...
| * sysfs: remove error messages for -EEXIST caseStephen Hemminger2008-05-141-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible that the entry in sysfs already exists, one case of this is when a network device is renamed to bonding_masters. Anyway, in this case the proper error path is for device_rename to return an error code, not to generate bogus backtrace and errors. Also, to avoid possible races, the create link should be done before the remove link. This makes a device rename atomic operation like other renames. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: David S. Miller <davem@davemloft.net>
* | Driver core: add device_create_vargs and device_create_drvdataGreg Kroah-Hartman2008-05-201-6/+79
|/ | | | | | | | | | | | | | | | We want to have the drvdata field set properly when creating the device as sysfs callbacks can assume it is present and it can race the later setting of this field. So, create two new functions, deviec_create_vargs() and device_create_drvdata() that take this new field. device_create_drvdata() will go away in 2.6.27 as the drvdata field will just be moved to the device_create() call as it should be. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: try parent numa_node at first before using defaultYinghai Lu2008-04-261-2/+12
| | | | | | | | | | in the device_add, we try to use use parent numa_node. need to make sure pci root bus's bridge device numa_node is set. then we could use device->numa_node direclty for all device. and don't need to call pcibus_to_node(). Signed-off-by: Yinghai Lu <yinghai.lu@sun.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6Linus Torvalds2008-04-211-44/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits) SCSI: convert struct class_device to struct device DRM: remove unused dev_class IB: rename "dev" to "srp_dev" in srp_host structure IB: convert struct class_device to struct device memstick: convert struct class_device to struct device driver core: replace remaining __FUNCTION__ occurrences sysfs: refill attribute buffer when reading from offset 0 PM: Remove destroy_suspended_device() Firmware: add iSCSI iBFT Support PM: Remove legacy PM (fix) Kobject: Replace list_for_each() with list_for_each_entry(). SYSFS: Explicitly include required header file slab.h. Driver core: make device_is_registered() work for class devices PM: Convert wakeup flag accessors to inline functions PM: Make wakeup flags available whenever CONFIG_PM is set PM: Fix misuse of wakeup flag accessors in serial core Driver core: Call device_pm_add() after bus_add_device() in device_add() PM: Handle device registrations during suspend/resume block: send disk "change" event for rescan_partitions() sysdev: detect multiple driver registrations ... Fixed trivial conflict in include/linux/memory.h due to semaphore header file change (made irrelevant by the change to mutex).
| * driver core: replace remaining __FUNCTION__ occurrencesHarvey Harrison2008-04-191-9/+9
| | | | | | | | | | | | | | | | __FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * PM: Remove destroy_suspended_device()Rafael J. Wysocki2008-04-191-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After 2.6.24 there was a plan to make the PM core acquire all device semaphores during a suspend/hibernation to protect itself from concurrent operations involving device objects. That proved to be too heavy-handed and we found a better way to achieve the goal, but before it happened, we had introduced the functions device_pm_schedule_removal() and destroy_suspended_device() to allow drivers to "safely" destroy a suspended device and we had adapted some drivers to use them. Now that these functions are no longer necessary, it seems reasonable to remove them and modify their users to use the normal device unregistration instead. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * Driver core: Call device_pm_add() after bus_add_device() in device_add()Rafael J. Wysocki2008-04-191-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Include dpm_sysfs_add() into device_pm_add(), in analogy with device_pm_remove(), and modify device_add() to call the latter after bus_add_device(), to avoid situations in which the PM core may attempt to suspend a device the registration of which has not been successful. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * PM: Handle device registrations during suspend/resumeRafael J. Wysocki2008-04-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify the PM core to protect its data structures, specifically the dpm_active list, from being corrupted if a child of the currently suspending device is registered concurrently with its ->suspend() callback. In that case, since the new device (the child) is added to dpm_active after its parent, the PM core will attempt to suspend it after the parent, which is wrong. Introduce a new member of struct dev_pm_info, called 'sleeping', and use it to check if the parent of the device being added to dpm_active has been suspended, in which case the device registration fails. Also, use 'sleeping' for checking if the ordering of devices on dpm_active is correct. Introduce variable 'all_sleeping' that will be set to 'true' once all devices have been suspended and make new device registrations fail until 'all_sleeping' is reset to 'false', in order to avoid having unsuspended devices around while the system is going into a sleep state. Remove pm_sleep_rwsem which is not necessary any more. Special thanks to Alan Stern for discussions and suggestions that lead to the creation of this patch. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Convert asm/semaphore.h users to linux/semaphore.hMatthew Wilcox2008-04-181-1/+1
|/ | | | Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
* driver core: debug for bad dev_attr_show() return value.Andrew Morton2008-03-241-0/+5
| | | | | | | | | | Try to find the culprit who caused http://bugzilla.kernel.org/show_bug.cgi?id=10150 Cc: <balajirrao@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: Fix cleanup when failing device_add().Cornelia Huck2008-03-041-2/+3
| | | | | | | | | | | | | Driver core: Fix cleanup when failing device_add(). - Don't call cleanup_device_parent() if we didn't call setup_parent(). - dev->kobj.parent may be NULL when cleanup_device_parent() is called, so we need to handle glue_dir == NULL in cleanup_glue_dir(). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: Remove dpm_sysfs_remove() from error path of device_add()Rafael J. Wysocki2008-03-041-1/+0
| | | | | | | | | | Since device_pm_remove(dev) calls dpm_sysfs_remove(dev), it's incorrect to call the latter after the former in the device_add() error path. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* PM: Do not acquire device semaphores upfront during suspendRafael J. Wysocki2008-03-041-8/+0
| | | | | | | | | | | | | | | | | | | Remove the code that acquires all device semaphores from the suspend code path as it causes multiple problems to appear (most notably, http://bugzilla.kernel.org/show_bug.cgi?id=10030) and revert the change introduced by commit 4145ed6dc597a9bea5f6ae8c574653b2de10620f depending on the code being removed. Remove pm_sleep_lock()/pm_sleep_unlock() from device_add() to avoid the issue reported at http://bugzilla.kernel.org/show_bug.cgi?id=9874. It should fix the regreesions reported at: http://bugzilla.kernel.org/show_bug.cgi?id=9874 http://bugzilla.kernel.org/show_bug.cgi?id=10030 Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: Remove unneeded get_{device,driver}() calls.Cornelia Huck2008-02-021-6/+2
| | | | | | | | | | | | | Driver core: Remove unneeded get_{device,driver}() calls. Code trying to add/remove attributes must hold a reference to the device resp. driver anyway, so let's remove those reference count games. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: convert to use class_find_device apiDave Young2008-02-021-21/+11
| | | | | | | | | Convert to use class_find_device api in drivers/base/core.c Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: Fix up build when CONFIG_BLOCK=NGreg Kroah-Hartman2008-01-271-11/+19
| | | | | | | | | | | | | | | This fixes up the driver core build errors when CONFIG_BLOCK=N Thanks to Alexander van Heukelum <heukelum@mailshack.com> for the basis of this patch, and to Jeremy Fitzhardinge <jeremy@goop.org> for reporting the problem. Cc: Alexander van Heukelum <heukelum@mailshack.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: coding style fixesGreg Kroah-Hartman2008-01-241-108/+95
| | | | | | | Fix up a number of coding style issues in the drivers/base/ directory that have annoyed me over the years. checkpatch.pl is now very happy. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: Cleanup get_device_parent() in device_add() and device_move()Cornelia Huck2008-01-241-15/+14
| | | | | | | | | | | | | | | | | | | | | | | Make setup_parent() void as get_device_parent() will always return either a valid kobject or NULL. Introduce cleanup_glue_dir() to drop reference grabbed on "glue" directory by get_device_parent(). Use it for cleanup in device_move() and device_add() on errors. This should fix the refcounting problem reported in http://marc.info/?l=linux-kernel&m=120052487909200&w=2 Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Dave Young <hidave.darkstar@gmail.com> Cc: Gabor Gombas <gombasg@sztaki.hu> Cc: Tejun Heo <htejun@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Marcel Holtmann <marcel@holtmann.org> Cc: David Miller <davem@davemloft.net> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Kobject: auto-cleanup on final unrefKay Sievers2008-01-241-25/+7
| | | | | | | | | | | | | | | | We save the current state in the object itself, so we can do proper cleanup when the last reference is dropped. If the initial reference is dropped, the object will be removed from sysfs if needed, if an "add" event was sent, "remove" will be send, and the allocated resources are released. This allows us to clean up some driver core usage as well as allowing us to do other such changes to the rest of the kernel. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Kobject: rename kobject_init_ng() to kobject_init()Greg Kroah-Hartman2008-01-241-1/+1
| | | | | | | | | Now that the old kobject_init() function is gone, rename kobject_init_ng() to kobject_init() to clean up the namespace. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Kobject: rename kobject_add_ng() to kobject_add()Greg Kroah-Hartman2008-01-241-3/+3
| | | | | | | | | Now that the old kobject_add() function is gone, rename kobject_add_ng() to kobject_add() to clean up the namespace. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: convert block from raw kobjects to core devicesKay Sievers2008-01-241-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | This moves the block devices to /sys/class/block. It will create a flat list of all block devices, with the disks and partitions in one directory. For compatibility /sys/block is created and contains symlinks to the disks. /sys/class/block |-- sda -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda |-- sda1 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1 |-- sda10 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10 |-- sda5 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5 |-- sda6 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6 |-- sda7 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7 |-- sda8 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8 |-- sda9 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 `-- sr0 -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0 /sys/block/ |-- sda -> ../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda `-- sr0 -> ../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0 Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: fix class glue dir cleanup logicKay Sievers2008-01-241-112/+94
| | | | | | | | | | | | We should remove the glue directory between the class and the bus device _after_ we sent out the 'remove' event for the device, otherwise the parent relationship is no longer valid, and composing the path with deleted sysfs entries will not work. Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: clean up debugging messagesGreg Kroah-Hartman2008-01-241-10/+13
| | | | | | | | | | | | | | | | The driver core debugging messages are a mess. This provides a unified message that makes them actually useful. The format for new kobject debug messages should be: driver/bus/class: 'OBJECT_NAME': FUNCTION_NAME: message.\n Note, the class code is not changed in this patch due to pending patches in my queue that this would conflict with. A later patch will clean them up. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: remove fields from struct bus_typeGreg Kroah-Hartman2008-01-241-3/+3
| | | | | | | | | | | | | | | struct bus_type is static everywhere in the kernel. This moves the kobject in the structure out of it, and a bunch of other private only to the driver core fields are now moved to a private structure. This lets us dynamically create the backing kobject properly and gives us the chance to be able to document to users exactly how to use the struct bus_type as there are no fields they can improperly access. Thanks to Kay for the build fixes on this patch. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Kobject: convert drivers/base/core.c to use kobject_init/add_ng()Greg Kroah-Hartman2008-01-241-5/+3
| | | | | | | | This converts the code to use the new kobject functions, cleaning up the logic in doing so. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* driver core: clean up device_shutdownGreg Kroah-Hartman2008-01-241-1/+19
| | | | | | | | | | | device_shutdown does not need to be in a separate file. Move it into the driver core file where it belongs. This also moves us one more step closer to making devices_kset static, now only the crazy sysdevs are keeping that from happening... Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* kset: convert /sys/devices to use kset_createGreg Kroah-Hartman2008-01-241-8/+8
| | | | | | | | | | Dynamically create the kset instead of declaring it statically. We also rename devices_subsys to devices_kset to catch all users of the variable. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* kobject: get rid of kobject_kset_add_dirGreg Kroah-Hartman2008-01-241-2/+14
| | | | | | | | | kobject_kset_add_dir is only called in one place so remove it and use kobject_create() instead. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* kobject: get rid of kobject_add_dirGreg Kroah-Hartman2008-01-241-1/+2
| | | | | | | | | | kobject_create_and_add is the same as kobject_add_dir, so drop kobject_add_dir. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* kobject: remove struct kobj_type from struct ksetGreg Kroah-Hartman2008-01-241-2/+3
| | | | | | | | | | | | | | | | | We don't need a "default" ktype for a kset. We should set this explicitly every time for each kset. This change is needed so that we can make ksets dynamic, and cleans up one of the odd, undocumented assumption that the kset/kobject/ktype model has. This patch is based on a lot of help from Kay Sievers. Nasty bug in the block code was found by Dave Young <hidave.darkstar@gmail.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* PM: Acquire device locks on suspendRafael J. Wysocki2008-01-241-8/+57
| | | | | | | | | | | | | | | | | | This patch reorganizes the way suspend and resume notifications are sent to drivers. The major changes are that now the PM core acquires every device semaphore before calling the methods, and calls to device_add() during suspends will fail, while calls to device_del() during suspends will block. It also provides a way to safely remove a suspended device with the help of the PM core, by using the device_pm_schedule_removal() callback introduced specifically for this purpose, and updates two drivers (msr and cpuid) that need to use it. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* create /sys/.../power when CONFIG_PM is setDaniel Drake2007-11-281-1/+3
| | | | | | | | | | | | | | | | | | | | | The CONFIG_SUSPEND changes in 2.6.23 caused a regression under certain configuration conditions (SUSPEND=n, USB_AUTOSUSPEND=y) where all USB device attributes in sysfs (idVendor, idProduct, ...) silently disappeared, causing udev breakage and more. The cause of this is that the /sys/.../power subdirectory is now only created when CONFIG_PM_SLEEP is set, however, it should be created whenever CONFIG_PM is set to handle the above situation. The following patch fixes the regression. Signed-off-by: Daniel Drake <dsd@gentoo.org> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: stable <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver Core: fix bug in device_rename() for SYSFS_DEPRECATED=yKay Sievers2007-10-301-3/+3
| | | | | | | | | | | | | | | | | | This should fix the sysfs warnings that renaming network devices is causing to show up with CONFIG_SYSFS_DEPRECATED=y The code just shouldn't run if class devices are real directories, it's an update for the symlink in the class directory. Nobody noticed that as long as the creation of sysfs files silently failed, and we both missed it before the merge, because we don't run SYSFS_DEPRECATED=y. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Larry Finger <Larry.Finger@lwfinger.net> Cc: David Miller <davem@davemloft.net> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: Tejun Heo <htejun@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: rename ktype_deviceGreg Kroah-Hartman2007-10-121-3/+3
| | | | | | | | | | | 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: exclude kobject_uevent.c for !CONFIG_HOTPLUGKay Sievers2007-10-121-14/+4
| | | | | | | | | | Move uevent specific logic from the core into kobject_uevent.c, which does no longer require to link the unused string array if hotplug is not compiled in. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: change add_uevent_var to use a structKay Sievers2007-10-121-59/+25
| | | | | | | | | | | | | | | | | | 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: fix SYSF_DEPRECATED breakage for nested classdevsDmitry Torokhov2007-10-071-3/+7
| | | | | | | | | | | We should only reparent to a class former class devices that form the base of class hierarchy. Nested devices should still grow from their real parents. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Tested-by: Andrey Borzenkov <arvidjaar@mail.ru> Tested-by: Anssi Hannula <anssi.hannula@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Add explicit zeroing to "envp" array in device 'show' methodLinus Torvalds2007-09-261-0/+1
| | | | | | | | | | | | | | | | As Stephen Hemminger says, this is a "belt and suspenders" patch that zeroes the envp array at allocation time, even though all the users should NULL-terminate it anyway (and we've hopefully fixed everybody that doesn't do that). And we'll apparently clean the whole envp thing up for 2.6.24 anyway. But let's just be robust, and do both this *and* make sure that all users are doing the right thing. Acked-by: Stephen Hemminger <shemminger@linux-foundation.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Driver core: fix deprectated sysfs structure for nested class devicesDmitry Torokhov2007-09-191-6/+23
| | | | | | | | | | | | | | Nested class devices used to have 'device' symlink point to a real (physical) device instead of a parent class device. When converting subsystems to struct device we need to keep doing what class devices did if CONFIG_SYSFS_DEPRECATED is Y, otherwise parts of udev break. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Cc: Kay Sievers <kay.sievers@vrfy.org> Acked-by: Greg KH <greg@kroah.com> Tested-by: Anssi Hannula <anssi.hannula@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
OpenPOWER on IntegriCloud