summaryrefslogtreecommitdiffstats
path: root/drivers/base
Commit message (Collapse)AuthorAgeFilesLines
* driver core: fix small mem leak in driver_add_kobj()Jesper Juhl2008-03-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Coverity checker spotted that we leak the storage allocated to 'name' in int driver_add_kobj(). The leak looks legit to me - this is the code : int driver_add_kobj(struct device_driver *drv, struct kobject *kobj, const char *fmt, ...) { va_list args; char *name; int ret; va_start(args, fmt); name = kvasprintf(GFP_KERNEL, fmt, args); ^^^^^^^^ This dynamically allocates space... va_end(args); if (!name) return -ENOMEM; return kobject_add(kobj, &drv->p->kobj, "%s", name); ^^^^^^^^ This neglects to free the space allocated } Inside kobject_add() a copy of 'name' will be made and used. As far as I can see, Coverity is correct in flagging this as a leak, but I'd like some configmation before the patch is applied. This should fix it. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* 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>
* drivers: fix dma_get_required_maskJames Bottomley2008-03-101-1/+1
| | | | | | | | | | | | | | | | | There's a bug in the current implementation of dma_get_required_mask() where it ands the returned mask with the current device mask. This rather defeats the purpose if you're using the call to determine what your mask should be (since you will at that time have the default DMA_32BIT_MASK). This bug results in any driver that uses this function *always* getting a 32 bit mask, which is wrong. Fix by removing the and with dev->dma_mask. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* sysdev: fix problem with sysdev_class being re-registeredGreg Kroah-Hartman2008-03-101-0/+4
| | | | | | | | | | | | | | | | We need to initialize the kobject for a sysdev_class as it could have been recycled (stupid static kobjects...) We also do the same thing in case sysdev devices are being re-registered. Thanks to Balaji Rao <balajirrao@gmail.com> for pointing out the problem. Signed-off-by: Balaji Rao <balajirrao@gmail.com> Tested-by: Mikael Pettersson <mikpe@it.uu.se> 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: fix new mutex-locking bug in the PM coreAlan Stern2008-03-041-1/+1
| | | | | | | | | | This patch (as1041) fixes a bug introduced by the acquire-all-device-semaphores reversion. The error pathway of dpm_suspend() fails to reacquire a mutex it should be holding. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* PM: Do not acquire device semaphores upfront during suspendRafael J. Wysocki2008-03-042-98/+16
| | | | | | | | | | | | | | | | | | | 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>
* docbook: fix kernel-api source filesRandy Dunlap2008-03-031-3/+1
| | | | | | | | Fix docbook problems in kernel-api.tmpl. These cause the generated docbook to be incorrect. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge branch 'release' of ↵Linus Torvalds2008-02-211-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (26 commits) PM: Make suspend_device() static PCI ACPI: Fix comment describing acpi_pci_choose_state Hibernation: Handle DEBUG_PAGEALLOC on x86 ACPI: fix build warning ACPI: TSC breaks atkbd suspend ACPI: remove is_processor_present prototype acer-wmi: Add DMI match for mail LED on Acer TravelMate 4200 series ACPI: sparse fix, replace macro with static function ACPI: thinkpad-acpi: add tablet-mode reporting ACPI: thinkpad-acpi: minor hotkey_radio_sw fixes ACPI: thinkpad-acpi: improve thinkpad-acpi input device documentation ACPI: thinkpad-acpi: issue input events for tablet swivel events ACPI: thinkpad-acpi: make the video output feature optional ACPI: thinkpad-acpi: synchronize input device switches ACPI: thinkpad-acpi: always track input device open/close ACPI: thinkpad-acpi: trivial fix to documentation ACPI: thinkpad-acpi: trivial fix to module_desc typo intel_menlo: extract return values using PTR_ERR ACPI video: check for error from thermal_cooling_device_register ACPI thermal: extract return values using PTR_ERR ...
| * PM: Make suspend_device() staticAdrian Bunk2008-02-211-1/+1
| | | | | | | | | | | | | | | | | | suspend_device() can become static. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Len Brown <len.brown@intel.com>
* | PM: Remove unbalanced mutex_unlock() from dpm_resume()Rafael J. Wysocki2008-02-211-1/+0
| | | | | | | | | | | | | | | | | | | | Remove an unnecessary unlocking of dpm_list_mtx in the error path in drivers/base/power/main.c:dpm_suspend() . Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Driver core: Fix error handling in bus_add_driver().Cornelia Huck2008-02-211-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | - If the allocation of ->priv fails, the reference on the bus must be dropped. - If adding the kobject fails, kobject_put must be called to clean things up. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | driver-core: fix kernel-doc function parametersRandy Dunlap2008-02-212-0/+4
|/ | | | | | | | | | | | Fix drivers/base/ missing kernel-doc parameters: Warning(linux-2.6.24-git12//drivers/base/driver.c:133): No description found for parameter 'drv' Warning(linux-2.6.24-git12//drivers/base/driver.c:133): No description found for parameter 'kobj' Warning(linux-2.6.24-git12//drivers/base/driver.c:133): No description found for parameter 'fmt' Warning(linux-2.6.24-git12//drivers/base/power/main.c:530): No description found for parameter 'state' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Driver core: Revert "Fix Firmware class name collision"Michael E Brown2008-02-071-1/+2
| | | | | | | | | | | | | | | This reverts commit 109f0e93b6b728f03c1eb4af02bc25d71b646c59. The original patch breaks BIOS updates on all Dell machines. The path to the firmware file for the dell_rbu driver changes, which breaks all of the userspace tools which rely on it. Note that this patch re-introduces a problem with i2c name collision that was previously fixed by this patch. Signed-off-by: Michael E Brown <michael_e_brown@dell.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* register_cpu __devinit or __cpuinitRandy Dunlap2008-02-061-1/+1
| | | | | | | | | Is there some reason why register_cpu() is __devinit instead of __cpuinit ? Make it __cpuinit. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge branch 'dmapool' of ↵Linus Torvalds2008-02-052-482/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc * 'dmapool' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc: pool: Improve memory usage for devices which can't cross boundaries Change dmapool free block management dmapool: Tidy up includes and add comments dmapool: Validate parameters to dma_pool_create Avoid taking waitqueue lock in dmapool dmapool: Fix style problems Move dmapool.c to mm/ directory
| * Move dmapool.c to mm/ directoryMatthew Wilcox2007-12-042-482/+1
| | | | | | | | Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
* | Driver core: Remove unneeded get_{device,driver}() calls.Cornelia Huck2008-02-022-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | PM: Export device_pm_schedule_removalRafael J. Wysocki2008-02-022-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Move the declaration of device_pm_schedule_removal() to device.h and make it exported, as it will be used directly by some drivers for unregistering device objects during suspend/resume cycles in a safe way. 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: Make PM_TRACE more architecture independentJohannes Berg2008-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to debug a suspend failure I started implementing PM_TRACE for powerpc. I then noticed that I'm debugging a suspend failure and so PM_TRACE isn't useful at all, but thought that nonetheless this could be useful in the future. Basically, to support PM_TRACE, you add a Kconfig option that selects PM_TRACE and provides the infrastructure as per the help text of PM_TRACE. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
* | Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6Linus Torvalds2008-01-313-24/+49
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: PPC: Fix powerpc vio_find_name to not use devices_subsys Driver core: add bus_find_device_by_name function Module: check to see if we have a built in module with the same name x86: fix runtime error in arch/x86/kernel/cpu/mcheck/mce_amd_64.c Driver core: Fix up build when CONFIG_BLOCK=N
| * | Driver core: add bus_find_device_by_name functionGreg Kroah-Hartman2008-01-271-12/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver core, and some other parts of the kernel just want to find a device based on a name for a specific bus. Give them a simple wrapper to prevent them from having to always roll their own. This will be used in the PPC patch later in this series. Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * | Driver core: Fix up build when CONFIG_BLOCK=NGreg Kroah-Hartman2008-01-272-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | docbook: fix drivers/base/class warningRandy Dunlap2008-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fix kernel-doc empty line warning: Warning(linux-2.6.24-git8//drivers/base/class.c:866): bad line: Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | | convert drivers/base/power/Makefile to ccflagsJohannes Berg2008-01-281-6/+2
|/ / | | | | | | | | | | | | | | This patch converts drivers/base/power/Makefile to use ccflags instead of EXTRA_CFLAGS. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* | Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6Linus Torvalds2008-01-251-2/+12
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits) [SCSI] usbstorage: use last_sector_bug flag universally [SCSI] libsas: abstract STP task status into a function [SCSI] ultrastor: clean up inline asm warnings [SCSI] aic7xxx: fix firmware build [SCSI] aacraid: fib context lock for management ioctls [SCSI] ch: remove forward declarations [SCSI] ch: fix device minor number management bug [SCSI] ch: handle class_device_create failure properly [SCSI] NCR5380: fix section mismatch [SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices [SCSI] IB/iSER: add logical unit reset support [SCSI] don't use __GFP_DMA for sense buffers if not required [SCSI] use dynamically allocated sense buffer [SCSI] scsi.h: add macro for enclosure bit of inquiry data [SCSI] sd: add fix for devices with last sector access problems [SCSI] fix pcmcia compile problem [SCSI] aacraid: add Voodoo Lite class of cards. [SCSI] aacraid: add new driver features flags [SCSI] qla2xxx: Update version number to 8.02.00-k7. [SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command. ...
| * | [SCSI] attribute_container: update to use the group interfaceJames Bottomley2008-01-231-2/+12
| |/ | | | | | | | | | | | | | | | | | | | | This patch is the beginning of moving the attribute_containers to use attribute groups exclusively. The attr element is now deprecated and will eventually be removed (along with all the hand rolled code for doing exactly what attribute groups do) when all the consumers are converted to attribute groups. Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
* | Driver core: coding style fixesGreg Kroah-Hartman2008-01-248-583/+545
| | | | | | | | | | | | | | 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: add class iteration apiDave Young2008-01-241-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the following class iteration functions for driver use: class_for_each_device class_find_device class_for_each_child class_find_child Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> 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>
* | Driver Core: constify the name passed to platform_device_register_simpleStephen Rothwell2008-01-241-1/+1
| | | | | | | | | | | | | | | | | | This name is just passed to platform_device_alloc which has its parameter declared const. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | driver core: fix build with SYSFS=nRandy Dunlap2008-01-242-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When SYSFS=n and MODULES=y, build ends with: linux-2.6.24-rc6-mm1/drivers/base/module.c: In function 'module_add_driver': linux-2.6.24-rc6-mm1/drivers/base/module.c:49: error: 'module_kset' undeclared (first use in this function) make[3]: *** [drivers/base/module.o] Error 1 Below is one possible fix. Build-tested with all 4 config combinations of SYSFS & MODULES. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __initDenis Cheng2008-01-243-10/+1
| | | | | | | | | | | | | | | | LIST_HEAD has been widely used, so switch to this simpler method. Signed-off-by: Denis Cheng <crquan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Driver core: change sysdev classes to use dynamic kobject namesKay Sievers2008-01-245-4/+5
| | | | | | | | | | | | | | | | | | | | All kobjects require a dynamically allocated name now. We no longer need to keep track if the name is statically assigned, we can just unconditionally free() all kobject names on cleanup. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Kobject: convert drivers/* from kobject_unregister() to kobject_put()Greg Kroah-Hartman2008-01-242-3/+3
| | | | | | | | | | | | | | | | | | | | | | There is no need for kobject_unregister() anymore, thanks to Kay's kobject cleanup changes, so replace all instances of it with kobject_put(). 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-242-2/+2
| | | | | | | | | | | | | | | | | | 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-243-6/+6
| | | | | | | | | | | | | | | | | | 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-242-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: fix race in __device_release_driverAlan Stern2008-01-241-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch (as1013) was suggested by David Woodhouse; it fixes a race in the driver core. If a device is unregistered at the same time as its driver is unloaded, the driver's code pages may be unmapped while the remove method is still running. The calls to get_driver() and put_driver() were intended to prevent this, but they don't work if the driver's module count has already dropped to 0. Instead, the patch keeps the device on the driver's list until after the remove method has returned. This forces the necessary synchronization to occur. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Kobject: change drivers/base/bus to use kobject_init_and_addGreg Kroah-Hartman2008-01-241-6/+4
| | | | | | | | | | | | | | | | | | Stop using kobject_register, as this way we can control the sending of the uevent properly, after everything is properly initialized. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Driver core: clean up debugging messagesGreg Kroah-Hartman2008-01-243-25/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: move the static kobject out of struct driverGreg Kroah-Hartman2008-01-246-65/+92
| | | | | | | | | | | | | | | | | | | | This patch removes the kobject, and a few other driver-core-only fields out of struct driver and into the driver core only. Now drivers can be safely create on the stack or statically (like they currently are.) Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Driver core: move the driver specific module code into the driver coreGreg Kroah-Hartman2008-01-243-0/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The module driver specific code should belong in the driver core, not in the kernel/ directory. So move this code. This is done in preparation for some struct device_driver rework that should be confined to the driver core code only. This also lets us keep from exporting these functions, as no external code should ever be calling it. Thanks to Andrew Morton for the !CONFIG_MODULES fix. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | Driver: add driver_add_kobj for looney iseries_veth driverGreg Kroah-Hartman2008-01-241-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The iseries driver wants to hang kobjects off of its driver, so, to preserve backwards compatibility, we need to add a call to the driver core to allow future changes to work properly. Hopefully no one uses this function in the future and the iseries_veth driver authors come to their senses so I can remove this hack... Cc: Dave Larson <larson1@us.ibm.com> Cc: Santiago Leon <santil@us.ibm.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | driver core: Introduce default attribute groups.Cornelia Huck2008-01-241-1/+41
| | | | | | | | | | | | | | | | | | This is lot like default attributes for devices (and indeed, a lot of the code is lifted from there). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | driver core: remove fields from struct bus_typeGreg Kroah-Hartman2008-01-246-60/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>