From da19cbcf71cde3c09587b5924d113f0c7f1fd23a Mon Sep 17 00:00:00 2001 From: Daniel Walker Date: Mon, 4 Feb 2008 23:35:47 -0800 Subject: driver core: memory: semaphore to mutex Signed-off-by: Daniel Walker Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/base/memory.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 7ae413fdd5f..1f3801a8184 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -205,7 +206,7 @@ static int memory_block_change_state(struct memory_block *mem, unsigned long to_state, unsigned long from_state_req) { int ret = 0; - down(&mem->state_sem); + mutex_lock(&mem->state_mutex); if (mem->state != from_state_req) { ret = -EINVAL; @@ -217,7 +218,7 @@ static int memory_block_change_state(struct memory_block *mem, mem->state = to_state; out: - up(&mem->state_sem); + mutex_unlock(&mem->state_mutex); return ret; } @@ -341,7 +342,7 @@ static int add_memory_block(unsigned long node_id, struct mem_section *section, mem->phys_index = __section_nr(section); mem->state = state; - init_MUTEX(&mem->state_sem); + mutex_init(&mem->state_mutex); mem->phys_device = phys_device; ret = register_memory(mem, section, NULL); -- cgit v1.2.3 From 00a41db522c77af33ea5ee9837d4f043ce150249 Mon Sep 17 00:00:00 2001 From: Badari Pulavarty Date: Mon, 11 Feb 2008 09:23:18 -0800 Subject: driver core: register_memory/unregister_memory clean ups and bugfix register_memory()/unregister_memory() never gets called with "root". unregister_memory() is accessing kobject_name of the object just freed up. Since no one uses the code, lets take the code out. And also, make register_memory() static. Another bug fix - before calling unregister_memory() remove_memory_block() gets a ref on kobject. unregister_memory() need to drop that ref before calling sysdev_unregister(). Signed-off-by: Badari Pulavarty Signed-off-by: Greg Kroah-Hartman --- drivers/base/memory.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 1f3801a8184..7891f7c9726 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -62,8 +62,8 @@ void unregister_memory_notifier(struct notifier_block *nb) /* * register_memory - Setup a sysfs device for a memory block */ -int register_memory(struct memory_block *memory, struct mem_section *section, - struct node *root) +static +int register_memory(struct memory_block *memory, struct mem_section *section) { int error; @@ -71,26 +71,18 @@ int register_memory(struct memory_block *memory, struct mem_section *section, memory->sysdev.id = __section_nr(section); error = sysdev_register(&memory->sysdev); - - if (root && !error) - error = sysfs_create_link(&root->sysdev.kobj, - &memory->sysdev.kobj, - kobject_name(&memory->sysdev.kobj)); - return error; } static void -unregister_memory(struct memory_block *memory, struct mem_section *section, - struct node *root) +unregister_memory(struct memory_block *memory, struct mem_section *section) { BUG_ON(memory->sysdev.cls != &memory_sysdev_class); BUG_ON(memory->sysdev.id != __section_nr(section)); + /* drop the ref. we got in remove_memory_block() */ + kobject_put(&memory->sysdev.kobj); sysdev_unregister(&memory->sysdev); - if (root) - sysfs_remove_link(&root->sysdev.kobj, - kobject_name(&memory->sysdev.kobj)); } /* @@ -345,7 +337,7 @@ static int add_memory_block(unsigned long node_id, struct mem_section *section, mutex_init(&mem->state_mutex); mem->phys_device = phys_device; - ret = register_memory(mem, section, NULL); + ret = register_memory(mem, section); if (!ret) ret = mem_create_simple_file(mem, phys_index); if (!ret) @@ -396,7 +388,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section, mem_remove_simple_file(mem, phys_index); mem_remove_simple_file(mem, state); mem_remove_simple_file(mem, phys_device); - unregister_memory(mem, section, NULL); + unregister_memory(mem, section); return 0; } -- cgit v1.2.3 From 35d313b8744dc64c31b9cfcdb083112937643b45 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Thu, 21 Feb 2008 13:58:10 +0100 Subject: power_state: remove it from driver core power_state is scheduled for removal, and it is used only for debug prints by driver core. Remove it. Signed-off-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/base/power/main.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index d887d5cb5be..26de2c0fda8 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -377,11 +377,6 @@ static int suspend_device(struct device *dev, pm_message_t state) down(&dev->sem); - if (dev->power.power_state.event) { - dev_dbg(dev, "PM: suspend %d-->%d\n", - dev->power.power_state.event, state.event); - } - if (dev->class && dev->class->suspend) { suspend_device_dbg(dev, state, "class "); error = dev->class->suspend(dev, state); -- cgit v1.2.3 From 6c847402e1c69c1cfe2bddeadc8391bacbb3d0a5 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Tue, 4 Mar 2008 15:09:05 -0800 Subject: driver core: cpu: fix section mismatch in cpu.c:store_online Fix following warning: WARNING: vmlinux.o(.text+0x64609c): Section mismatch in reference from the function store_online() to the function .cpuinit.text:cpu_up() store_online() is defined inside a HOTPLUG_CPU block so references are OK. Ignore references by annotating store_online() with __ref. Note: This is needed because cpu_up() most likely should not have been __cpuinit but all the hotplug cpu code misuses the __cpuinit annotation. Signed-off-by: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/base/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 499b003f927..3e417a97681 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -28,7 +28,7 @@ static ssize_t show_online(struct sys_device *dev, char *buf) return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); } -static ssize_t store_online(struct sys_device *dev, const char *buf, +static ssize_t __ref store_online(struct sys_device *dev, const char *buf, size_t count) { struct cpu *cpu = container_of(dev, struct cpu, sysdev); @@ -55,7 +55,7 @@ static ssize_t store_online(struct sys_device *dev, const char *buf, } static SYSDEV_ATTR(online, 0644, show_online, store_online); -static void __devinit register_cpu_control(struct cpu *cpu) +static void __cpuinit register_cpu_control(struct cpu *cpu) { sysdev_create_file(&cpu->sysdev, &attr_online); } -- cgit v1.2.3 From da009f39f85a3ee9deeb10f0f05ddd4efdd67020 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Tue, 4 Mar 2008 15:09:06 -0800 Subject: sysdev: detect multiple driver registrations I've just found how easy it is to accidentally register a sysdev_driver for two different classes. When this happens, bad things happen as the sysdev_driver structure keeps has the list entry for the driver registration. The following patch makes a WARN_ON() if this happens, although I think BUG_ON or returning -EAGAIN could also be valid responses to this. Signed-off-by: Ben Dooks Cc: Kay Sievers Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/base/sys.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'drivers/base') diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 8e13fd94216..1a06c239371 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c @@ -167,6 +167,22 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) { int err = 0; + if (!cls) { + printk(KERN_WARNING "sysdev: invalid class passed to " + "sysdev_driver_register!\n"); + WARN_ON(1); + return -EINVAL; + } + + /* Check whether this driver has already been added to a class. */ + if ((drv->entry.next != drv->entry.prev) || + (drv->entry.next != NULL)) { + printk(KERN_WARNING "sysdev: class %s: driver (%p) has already" + " been registered to a class, something is wrong, but " + "will forge on!\n", cls->name, drv); + WARN_ON(1); + } + mutex_lock(&sysdev_drivers_lock); if (cls && kset_get(&cls->kset)) { list_add_tail(&drv->entry, &cls->drivers); -- cgit v1.2.3 From 58aca23226a19983571bd3b65167521fc64f5869 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Wed, 12 Mar 2008 00:57:22 +0100 Subject: PM: Handle device registrations during suspend/resume 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 Acked-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 6 ++++- drivers/base/power/main.c | 57 +++++++++++++++++++++------------------------- drivers/base/power/power.h | 23 +++---------------- 3 files changed, 34 insertions(+), 52 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/core.c b/drivers/base/core.c index 24198ad0197..79848e6c5db 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -820,7 +820,11 @@ int device_add(struct device *dev) error = dpm_sysfs_add(dev); if (error) goto PMError; - device_pm_add(dev); + error = device_pm_add(dev); + if (error) { + dpm_sysfs_remove(dev); + goto PMError; + } error = bus_add_device(dev); if (error) goto BusError; diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 26de2c0fda8..0e3991a437c 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -54,7 +54,8 @@ static LIST_HEAD(dpm_destroy); static DEFINE_MUTEX(dpm_list_mtx); -static DECLARE_RWSEM(pm_sleep_rwsem); +/* 'true' if all devices have been suspended, protected by dpm_list_mtx */ +static bool all_sleeping; int (*platform_enable_wakeup)(struct device *dev, int is_on); @@ -62,14 +63,28 @@ int (*platform_enable_wakeup)(struct device *dev, int is_on); * device_pm_add - add a device to the list of active devices * @dev: Device to be added to the list */ -void device_pm_add(struct device *dev) +int device_pm_add(struct device *dev) { + int error = 0; + pr_debug("PM: Adding info for %s:%s\n", dev->bus ? dev->bus->name : "No Bus", kobject_name(&dev->kobj)); mutex_lock(&dpm_list_mtx); - list_add_tail(&dev->power.entry, &dpm_active); + if ((dev->parent && dev->parent->power.sleeping) || all_sleeping) { + if (dev->parent->power.sleeping) + dev_warn(dev, + "parent %s is sleeping, will not add\n", + dev->parent->bus_id); + else + dev_warn(dev, "devices are sleeping, will not add\n"); + WARN_ON(true); + error = -EBUSY; + } else { + list_add_tail(&dev->power.entry, &dpm_active); + } mutex_unlock(&dpm_list_mtx); + return error; } /** @@ -107,32 +122,6 @@ void device_pm_schedule_removal(struct device *dev) } EXPORT_SYMBOL_GPL(device_pm_schedule_removal); -/** - * pm_sleep_lock - mutual exclusion for registration and suspend - * - * Returns 0 if no suspend is underway and device registration - * may proceed, otherwise -EBUSY. - */ -int pm_sleep_lock(void) -{ - if (down_read_trylock(&pm_sleep_rwsem)) - return 0; - - return -EBUSY; -} - -/** - * pm_sleep_unlock - mutual exclusion for registration and suspend - * - * This routine undoes the effect of device_pm_add_lock - * when a device's registration is complete. - */ -void pm_sleep_unlock(void) -{ - up_read(&pm_sleep_rwsem); -} - - /*------------------------- Resume routines -------------------------*/ /** @@ -242,11 +231,13 @@ static int resume_device(struct device *dev) static void dpm_resume(void) { mutex_lock(&dpm_list_mtx); + all_sleeping = false; while(!list_empty(&dpm_off)) { struct list_head *entry = dpm_off.next; struct device *dev = to_device(entry); list_move_tail(entry, &dpm_active); + dev->power.sleeping = false; mutex_unlock(&dpm_list_mtx); resume_device(dev); mutex_lock(&dpm_list_mtx); @@ -285,7 +276,6 @@ void device_resume(void) might_sleep(); dpm_resume(); unregister_dropped_devices(); - up_write(&pm_sleep_rwsem); } EXPORT_SYMBOL_GPL(device_resume); @@ -421,6 +411,9 @@ static int dpm_suspend(pm_message_t state) struct list_head *entry = dpm_active.prev; struct device *dev = to_device(entry); + WARN_ON(dev->parent && dev->parent->power.sleeping); + + dev->power.sleeping = true; mutex_unlock(&dpm_list_mtx); error = suspend_device(dev, state); mutex_lock(&dpm_list_mtx); @@ -432,11 +425,14 @@ static int dpm_suspend(pm_message_t state) (error == -EAGAIN ? " (please convert to suspend_late)" : "")); + dev->power.sleeping = false; break; } if (!list_empty(&dev->power.entry)) list_move(&dev->power.entry, &dpm_off); } + if (!error) + all_sleeping = true; mutex_unlock(&dpm_list_mtx); return error; @@ -454,7 +450,6 @@ int device_suspend(pm_message_t state) int error; might_sleep(); - down_write(&pm_sleep_rwsem); error = dpm_suspend(state); if (error) device_resume(); diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index e32d3bdb92c..a6894f2a4b9 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h @@ -11,30 +11,13 @@ static inline struct device *to_device(struct list_head *entry) return container_of(entry, struct device, power.entry); } -extern void device_pm_add(struct device *); +extern int device_pm_add(struct device *); extern void device_pm_remove(struct device *); -extern int pm_sleep_lock(void); -extern void pm_sleep_unlock(void); #else /* CONFIG_PM_SLEEP */ - -static inline void device_pm_add(struct device *dev) -{ -} - -static inline void device_pm_remove(struct device *dev) -{ -} - -static inline int pm_sleep_lock(void) -{ - return 0; -} - -static inline void pm_sleep_unlock(void) -{ -} +static inline int device_pm_add(struct device *dev) { return 0; } +static inline void device_pm_remove(struct device *dev) {} #endif -- cgit v1.2.3 From 57eee3d23e8833ca18708b374c648235691942ba Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Wed, 12 Mar 2008 00:59:38 +0100 Subject: Driver core: Call device_pm_add() after bus_add_device() in device_add() 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 Acked-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 15 +++++---------- drivers/base/power/main.c | 4 +++- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/core.c b/drivers/base/core.c index 79848e6c5db..adbc0178844 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -817,17 +817,12 @@ int device_add(struct device *dev) error = device_add_attrs(dev); if (error) goto AttrsError; - error = dpm_sysfs_add(dev); - if (error) - goto PMError; - error = device_pm_add(dev); - if (error) { - dpm_sysfs_remove(dev); - goto PMError; - } error = bus_add_device(dev); if (error) goto BusError; + error = device_pm_add(dev); + if (error) + goto PMError; kobject_uevent(&dev->kobj, KOBJ_ADD); bus_attach_device(dev); if (parent) @@ -847,9 +842,9 @@ int device_add(struct device *dev) Done: put_device(dev); return error; - BusError: - device_pm_remove(dev); PMError: + bus_remove_device(dev); + BusError: if (dev->bus) blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_DEL_DEVICE, dev); diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 0e3991a437c..93a146940b9 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -81,7 +81,9 @@ int device_pm_add(struct device *dev) WARN_ON(true); error = -EBUSY; } else { - list_add_tail(&dev->power.entry, &dpm_active); + error = dpm_sysfs_add(dev); + if (!error) + list_add_tail(&dev->power.entry, &dpm_active); } mutex_unlock(&dpm_list_mtx); return error; -- cgit v1.2.3 From d288e47c471e1090e80c62ad95882fafbf3f499d Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Wed, 19 Mar 2008 22:37:42 +0100 Subject: PM: Make wakeup flags available whenever CONFIG_PM is set The various wakeup flags and their accessor macros in struct dev_pm_info should be available whenever CONFIG_PM is enabled, not just when CONFIG_PM_SLEEP is on. Otherwise remote wakeup won't always be configurable for runtime power management. This patch (as1056b) fixes the oversight. David Brownell adds: More accurately, fixes the "regression" ... as noted sometime last summer, after 296699de6bdc717189a331ab6bbe90e05c94db06 introduced CONFIG_SUSPEND. But that didn't make the regression list for that kernel, ergo the delay in fixing it. [rjw: rebased] Signed-off-by: Alan Stern Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/base/power/main.c | 2 -- drivers/base/power/sysfs.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 93a146940b9..5630af302b2 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -57,8 +57,6 @@ static DEFINE_MUTEX(dpm_list_mtx); /* 'true' if all devices have been suspended, protected by dpm_list_mtx */ static bool all_sleeping; -int (*platform_enable_wakeup)(struct device *dev, int is_on); - /** * device_pm_add - add a device to the list of active devices * @dev: Device to be added to the list diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index f2ed179cd69..d11f74b038d 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c @@ -6,6 +6,8 @@ #include #include "power.h" +int (*platform_enable_wakeup)(struct device *dev, int is_on); + /* * wakeup - Report/change current wakeup option for device -- cgit v1.2.3 From 3f62e5700b2a679ae987b32a68126dd6dcf2488f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 13 Mar 2008 17:07:03 -0400 Subject: Driver core: make device_is_registered() work for class devices device_is_registered() can use the kobject value for this, so it will now work with devices that are associated with only a class, not a bus and a driver. Cc: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- drivers/base/bus.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 2d207ad3033..450942acca1 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -505,14 +505,11 @@ void bus_attach_device(struct device *dev) int ret = 0; if (bus) { - dev->is_registered = 1; if (bus->p->drivers_autoprobe) ret = device_attach(dev); WARN_ON(ret < 0); if (ret >= 0) klist_add_tail(&dev->knode_bus, &bus->p->klist_devices); - else - dev->is_registered = 0; } } @@ -533,10 +530,8 @@ void bus_remove_device(struct device *dev) sysfs_remove_link(&dev->bus->p->devices_kset->kobj, dev->bus_id); device_remove_attrs(dev->bus, dev); - if (dev->is_registered) { - dev->is_registered = 0; - klist_del(&dev->knode_bus); - } + klist_del(&dev->knode_bus); + pr_debug("bus: '%s': remove device %s\n", dev->bus->name, dev->bus_id); device_release_driver(dev); -- cgit v1.2.3 From b844eba292b477cda14582bfc6f535deed57a82d Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Sun, 23 Mar 2008 20:28:24 +0100 Subject: PM: Remove destroy_suspended_device() 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 Acked-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 29 ----------------------------- drivers/base/power/main.c | 40 ---------------------------------------- 2 files changed, 69 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/core.c b/drivers/base/core.c index adbc0178844..0262fc7c45f 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1163,35 +1163,6 @@ void device_destroy(struct class *class, dev_t devt) } EXPORT_SYMBOL_GPL(device_destroy); -#ifdef CONFIG_PM_SLEEP -/** - * destroy_suspended_device - asks the PM core to remove a suspended device - * @class: pointer to the struct class that this device was registered with - * @devt: the dev_t of the device that was previously registered - * - * This call notifies the PM core of the necessity to unregister a suspended - * device created with a call to device_create() (devices cannot be - * unregistered directly while suspended, since the PM core holds their - * semaphores at that time). - * - * It can only be called within the scope of a system sleep transition. In - * practice this means it has to be directly or indirectly invoked either by - * a suspend or resume method, or by the PM core (e.g. via - * disable_nonboot_cpus() or enable_nonboot_cpus()). - */ -void destroy_suspended_device(struct class *class, dev_t devt) -{ - struct device *dev; - - dev = class_find_device(class, &devt, __match_devt); - if (dev) { - device_pm_schedule_removal(dev); - put_device(dev); - } -} -EXPORT_SYMBOL_GPL(destroy_suspended_device); -#endif /* CONFIG_PM_SLEEP */ - /** * device_rename - renames a device * @dev: the pointer to the struct device to be renamed diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 5630af302b2..c4568b82875 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -50,7 +50,6 @@ LIST_HEAD(dpm_active); static LIST_HEAD(dpm_off); static LIST_HEAD(dpm_off_irq); -static LIST_HEAD(dpm_destroy); static DEFINE_MUTEX(dpm_list_mtx); @@ -104,24 +103,6 @@ void device_pm_remove(struct device *dev) mutex_unlock(&dpm_list_mtx); } -/** - * device_pm_schedule_removal - schedule the removal of a suspended device - * @dev: Device to destroy - * - * Moves the device to the dpm_destroy list for further processing by - * unregister_dropped_devices(). - */ -void device_pm_schedule_removal(struct device *dev) -{ - pr_debug("PM: Preparing for removal: %s:%s\n", - dev->bus ? dev->bus->name : "No Bus", - kobject_name(&dev->kobj)); - mutex_lock(&dpm_list_mtx); - list_move_tail(&dev->power.entry, &dpm_destroy); - mutex_unlock(&dpm_list_mtx); -} -EXPORT_SYMBOL_GPL(device_pm_schedule_removal); - /*------------------------- Resume routines -------------------------*/ /** @@ -245,26 +226,6 @@ static void dpm_resume(void) mutex_unlock(&dpm_list_mtx); } -/** - * unregister_dropped_devices - Unregister devices scheduled for removal - * - * Unregister all devices on the dpm_destroy list. - */ -static void unregister_dropped_devices(void) -{ - mutex_lock(&dpm_list_mtx); - while (!list_empty(&dpm_destroy)) { - struct list_head *entry = dpm_destroy.next; - struct device *dev = to_device(entry); - - mutex_unlock(&dpm_list_mtx); - /* This also removes the device from the list */ - device_unregister(dev); - mutex_lock(&dpm_list_mtx); - } - mutex_unlock(&dpm_list_mtx); -} - /** * device_resume - Restore state of each device in system. * @@ -275,7 +236,6 @@ void device_resume(void) { might_sleep(); dpm_resume(); - unregister_dropped_devices(); } EXPORT_SYMBOL_GPL(device_resume); -- cgit v1.2.3 From 2b3a302a09735276e13421db56c20045a48eb06d Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Tue, 4 Mar 2008 16:41:05 -0800 Subject: driver core: replace remaining __FUNCTION__ occurrences __FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison Signed-off-by: Greg Kroah-Hartman --- drivers/base/bus.c | 8 ++++---- drivers/base/class.c | 8 ++++---- drivers/base/core.c | 18 +++++++++--------- drivers/base/dd.c | 14 +++++++------- drivers/base/firmware_class.c | 18 +++++++++--------- drivers/base/memory.c | 4 ++-- drivers/base/sys.c | 2 +- 7 files changed, 36 insertions(+), 36 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 450942acca1..be1cc514335 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -79,7 +79,7 @@ static void driver_release(struct kobject *kobj) { struct driver_private *drv_priv = to_driver(kobj); - pr_debug("driver: '%s': %s\n", kobject_name(kobj), __FUNCTION__); + pr_debug("driver: '%s': %s\n", kobject_name(kobj), __func__); kfree(drv_priv); } @@ -677,19 +677,19 @@ int bus_add_driver(struct device_driver *drv) error = driver_create_file(drv, &driver_attr_uevent); if (error) { printk(KERN_ERR "%s: uevent attr (%s) failed\n", - __FUNCTION__, drv->name); + __func__, drv->name); } error = driver_add_attrs(bus, drv); if (error) { /* How the hell do we get out of this pickle? Give up */ printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", - __FUNCTION__, drv->name); + __func__, drv->name); } error = add_bind_files(drv); if (error) { /* Ditto */ printk(KERN_ERR "%s: add_bind_files(%s) failed\n", - __FUNCTION__, drv->name); + __func__, drv->name); } kobject_uevent(&priv->kobj, KOBJ_ADD); diff --git a/drivers/base/class.c b/drivers/base/class.c index 9d915376c31..b4901799308 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -175,13 +175,13 @@ void class_unregister(struct class *cls) static void class_create_release(struct class *cls) { - pr_debug("%s called for %s\n", __FUNCTION__, cls->name); + pr_debug("%s called for %s\n", __func__, cls->name); kfree(cls); } static void class_device_create_release(struct class_device *class_dev) { - pr_debug("%s called for %s\n", __FUNCTION__, class_dev->class_id); + pr_debug("%s called for %s\n", __func__, class_dev->class_id); kfree(class_dev); } @@ -189,7 +189,7 @@ static void class_device_create_release(struct class_device *class_dev) static int class_device_create_uevent(struct class_device *class_dev, struct kobj_uevent_env *env) { - pr_debug("%s called for %s\n", __FUNCTION__, class_dev->class_id); + pr_debug("%s called for %s\n", __func__, class_dev->class_id); return 0; } @@ -415,7 +415,7 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, struct device *dev = class_dev->dev; int retval = 0; - pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); + pr_debug("%s - name = %s\n", __func__, class_dev->class_id); if (MAJOR(class_dev->devt)) { add_uevent_var(env, "MAJOR=%u", MAJOR(class_dev->devt)); diff --git a/drivers/base/core.c b/drivers/base/core.c index 0262fc7c45f..0737fe5392a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -207,7 +207,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, retval = dev->bus->uevent(dev, env); if (retval) pr_debug("device: '%s': %s: bus uevent() returned %d\n", - dev->bus_id, __FUNCTION__, retval); + dev->bus_id, __func__, retval); } /* have the class specific function add its stuff */ @@ -216,7 +216,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, if (retval) pr_debug("device: '%s': %s: class uevent() " "returned %d\n", dev->bus_id, - __FUNCTION__, retval); + __func__, retval); } /* have the device type specific fuction add its stuff */ @@ -225,7 +225,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, if (retval) pr_debug("device: '%s': %s: dev_type uevent() " "returned %d\n", dev->bus_id, - __FUNCTION__, retval); + __func__, retval); } return retval; @@ -782,7 +782,7 @@ int device_add(struct device *dev) goto Done; } - pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); + pr_debug("device: '%s': %s\n", dev->bus_id, __func__); parent = get_device(dev->parent); setup_parent(dev, parent); @@ -980,7 +980,7 @@ void device_del(struct device *dev) */ void device_unregister(struct device *dev) { - pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); + pr_debug("device: '%s': %s\n", dev->bus_id, __func__); device_del(dev); put_device(dev); } @@ -1075,7 +1075,7 @@ EXPORT_SYMBOL_GPL(device_remove_file); static void device_create_release(struct device *dev) { - pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); + pr_debug("device: '%s': %s\n", dev->bus_id, __func__); kfree(dev); } @@ -1180,7 +1180,7 @@ int device_rename(struct device *dev, char *new_name) return -EINVAL; pr_debug("device: '%s': %s: renaming to '%s'\n", dev->bus_id, - __FUNCTION__, new_name); + __func__, new_name); #ifdef CONFIG_SYSFS_DEPRECATED if ((dev->class) && (dev->parent)) @@ -1219,7 +1219,7 @@ int device_rename(struct device *dev, char *new_name) dev->bus_id); if (error) { dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", - __FUNCTION__, error); + __func__, error); } } #endif @@ -1295,7 +1295,7 @@ int device_move(struct device *dev, struct device *new_parent) new_parent_kobj = get_device_parent(dev, new_parent); pr_debug("device: '%s': %s: moving to '%s'\n", dev->bus_id, - __FUNCTION__, new_parent ? new_parent->bus_id : ""); + __func__, new_parent ? new_parent->bus_id : ""); error = kobject_move(&dev->kobj, new_parent_kobj); if (error) { cleanup_glue_dir(dev, new_parent_kobj); diff --git a/drivers/base/dd.c b/drivers/base/dd.c index a5cde94bb98..3ac443b2ac0 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -30,12 +30,12 @@ static void driver_bound(struct device *dev) { if (klist_node_attached(&dev->knode_driver)) { printk(KERN_WARNING "%s: device %s already bound\n", - __FUNCTION__, kobject_name(&dev->kobj)); + __func__, kobject_name(&dev->kobj)); return; } pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->bus_id, - __FUNCTION__, dev->driver->name); + __func__, dev->driver->name); if (dev->bus) blocking_notifier_call_chain(&dev->bus->p->bus_notifier, @@ -104,13 +104,13 @@ static int really_probe(struct device *dev, struct device_driver *drv) atomic_inc(&probe_count); pr_debug("bus: '%s': %s: probing driver %s with device %s\n", - drv->bus->name, __FUNCTION__, drv->name, dev->bus_id); + drv->bus->name, __func__, drv->name, dev->bus_id); WARN_ON(!list_empty(&dev->devres_head)); dev->driver = drv; if (driver_sysfs_add(dev)) { printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", - __FUNCTION__, dev->bus_id); + __func__, dev->bus_id); goto probe_failed; } @@ -127,7 +127,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) driver_bound(dev); ret = 1; pr_debug("bus: '%s': %s: bound device %s to driver %s\n", - drv->bus->name, __FUNCTION__, dev->bus_id, drv->name); + drv->bus->name, __func__, dev->bus_id, drv->name); goto done; probe_failed: @@ -160,7 +160,7 @@ done: */ int driver_probe_done(void) { - pr_debug("%s: probe_count = %d\n", __FUNCTION__, + pr_debug("%s: probe_count = %d\n", __func__, atomic_read(&probe_count)); if (atomic_read(&probe_count)) return -EBUSY; @@ -194,7 +194,7 @@ int driver_probe_device(struct device_driver *drv, struct device *dev) goto done; pr_debug("bus: '%s': %s: matched device %s with driver %s\n", - drv->bus->name, __FUNCTION__, dev->bus_id, drv->name); + drv->bus->name, __func__, dev->bus_id, drv->name); ret = really_probe(dev, drv); diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 4a1b9bfc547..1fef7df8c9d 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -156,7 +156,7 @@ static ssize_t firmware_loading_store(struct device *dev, } /* fallthrough */ default: - printk(KERN_ERR "%s: unexpected value (%d)\n", __FUNCTION__, + printk(KERN_ERR "%s: unexpected value (%d)\n", __func__, loading); /* fallthrough */ case -1: @@ -209,7 +209,7 @@ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) new_size = ALIGN(min_size, PAGE_SIZE); new_data = vmalloc(new_size); if (!new_data) { - printk(KERN_ERR "%s: unable to alloc buffer\n", __FUNCTION__); + printk(KERN_ERR "%s: unable to alloc buffer\n", __func__); /* Make sure that we don't keep incomplete data */ fw_load_abort(fw_priv); return -ENOMEM; @@ -307,7 +307,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, *dev_p = NULL; if (!fw_priv || !f_dev) { - printk(KERN_ERR "%s: kmalloc failed\n", __FUNCTION__); + printk(KERN_ERR "%s: kmalloc failed\n", __func__); retval = -ENOMEM; goto error_kfree; } @@ -328,7 +328,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, retval = device_register(f_dev); if (retval) { printk(KERN_ERR "%s: device_register failed\n", - __FUNCTION__); + __func__); goto error_kfree; } *dev_p = f_dev; @@ -362,14 +362,14 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p, retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data); if (retval) { printk(KERN_ERR "%s: sysfs_create_bin_file failed\n", - __FUNCTION__); + __func__); goto error_unreg; } retval = device_create_file(f_dev, &dev_attr_loading); if (retval) { printk(KERN_ERR "%s: device_create_file failed\n", - __FUNCTION__); + __func__); goto error_unreg; } @@ -399,7 +399,7 @@ _request_firmware(const struct firmware **firmware_p, const char *name, *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); if (!firmware) { printk(KERN_ERR "%s: kmalloc(struct firmware) failed\n", - __FUNCTION__); + __func__); retval = -ENOMEM; goto out; } @@ -570,13 +570,13 @@ firmware_class_init(void) int error; error = class_register(&firmware_class); if (error) { - printk(KERN_ERR "%s: class_register failed\n", __FUNCTION__); + printk(KERN_ERR "%s: class_register failed\n", __func__); return error; } error = class_create_file(&firmware_class, &class_attr_timeout); if (error) { printk(KERN_ERR "%s: class_create_file failed\n", - __FUNCTION__); + __func__); class_unregister(&firmware_class); } return error; diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 7891f7c9726..8ce6de5a7e2 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -186,7 +186,7 @@ memory_block_action(struct memory_block *mem, unsigned long action) break; default: printk(KERN_WARNING "%s(%p, %ld) unknown action: %ld\n", - __FUNCTION__, mem, action, action); + __func__, mem, action, action); WARN_ON(1); ret = -EINVAL; } @@ -444,6 +444,6 @@ int __init memory_dev_init(void) ret = err; out: if (ret) - printk(KERN_ERR "%s() failed: %d\n", __FUNCTION__, ret); + printk(KERN_ERR "%s() failed: %d\n", __func__, ret); return ret; } diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 1a06c239371..4fbb56bcb1e 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c @@ -195,7 +195,7 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) } } else { err = -EINVAL; - printk(KERN_ERR "%s: invalid device class\n", __FUNCTION__); + printk(KERN_ERR "%s: invalid device class\n", __func__); WARN_ON(1); } mutex_unlock(&sysdev_drivers_lock); -- cgit v1.2.3 From ee959b00c335d7780136c5abda37809191fe52c3 Mon Sep 17 00:00:00 2001 From: Tony Jones Date: Fri, 22 Feb 2008 00:13:36 +0100 Subject: SCSI: convert struct class_device to struct device It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones Signed-off-by: Kay Sievers Cc: Roland Dreier Cc: Sean Hefty Cc: Hal Rosenstock Cc: James Bottomley Signed-off-by: Greg Kroah-Hartman --- drivers/base/attribute_container.c | 77 +++++++++++++++++++------------------- drivers/base/transport_class.c | 14 +++---- 2 files changed, 45 insertions(+), 46 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index 3b43e8a9f87..f57652db0a2 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c @@ -27,21 +27,21 @@ struct internal_container { struct klist_node node; struct attribute_container *cont; - struct class_device classdev; + struct device classdev; }; static void internal_container_klist_get(struct klist_node *n) { struct internal_container *ic = container_of(n, struct internal_container, node); - class_device_get(&ic->classdev); + get_device(&ic->classdev); } static void internal_container_klist_put(struct klist_node *n) { struct internal_container *ic = container_of(n, struct internal_container, node); - class_device_put(&ic->classdev); + put_device(&ic->classdev); } @@ -53,7 +53,7 @@ static void internal_container_klist_put(struct klist_node *n) * Returns the container associated with this classdev. */ struct attribute_container * -attribute_container_classdev_to_container(struct class_device *classdev) +attribute_container_classdev_to_container(struct device *classdev) { struct internal_container *ic = container_of(classdev, struct internal_container, classdev); @@ -110,11 +110,11 @@ attribute_container_unregister(struct attribute_container *cont) EXPORT_SYMBOL_GPL(attribute_container_unregister); /* private function used as class release */ -static void attribute_container_release(struct class_device *classdev) +static void attribute_container_release(struct device *classdev) { struct internal_container *ic = container_of(classdev, struct internal_container, classdev); - struct device *dev = classdev->dev; + struct device *dev = classdev->parent; kfree(ic); put_device(dev); @@ -129,12 +129,12 @@ static void attribute_container_release(struct class_device *classdev) * This function allocates storage for the class device(s) to be * attached to dev (one for each matching attribute_container). If no * fn is provided, the code will simply register the class device via - * class_device_add. If a function is provided, it is expected to add + * device_add. If a function is provided, it is expected to add * the class device at the appropriate time. One of the things that * might be necessary is to allocate and initialise the classdev and * then add it a later time. To do this, call this routine for * allocation and initialisation and then use - * attribute_container_device_trigger() to call class_device_add() on + * attribute_container_device_trigger() to call device_add() on * it. Note: after this, the class device contains a reference to dev * which is not relinquished until the release of the classdev. */ @@ -142,7 +142,7 @@ void attribute_container_add_device(struct device *dev, int (*fn)(struct attribute_container *, struct device *, - struct class_device *)) + struct device *)) { struct attribute_container *cont; @@ -163,11 +163,11 @@ attribute_container_add_device(struct device *dev, } ic->cont = cont; - class_device_initialize(&ic->classdev); - ic->classdev.dev = get_device(dev); + device_initialize(&ic->classdev); + ic->classdev.parent = get_device(dev); ic->classdev.class = cont->class; - cont->class->release = attribute_container_release; - strcpy(ic->classdev.class_id, dev->bus_id); + cont->class->dev_release = attribute_container_release; + strcpy(ic->classdev.bus_id, dev->bus_id); if (fn) fn(cont, dev, &ic->classdev); else @@ -195,20 +195,19 @@ attribute_container_add_device(struct device *dev, * @fn: A function to call to remove the device * * This routine triggers device removal. If fn is NULL, then it is - * simply done via class_device_unregister (note that if something + * simply done via device_unregister (note that if something * still has a reference to the classdev, then the memory occupied * will not be freed until the classdev is released). If you want a * two phase release: remove from visibility and then delete the * device, then you should use this routine with a fn that calls - * class_device_del() and then use - * attribute_container_device_trigger() to do the final put on the - * classdev. + * device_del() and then use attribute_container_device_trigger() + * to do the final put on the classdev. */ void attribute_container_remove_device(struct device *dev, void (*fn)(struct attribute_container *, struct device *, - struct class_device *)) + struct device *)) { struct attribute_container *cont; @@ -224,14 +223,14 @@ attribute_container_remove_device(struct device *dev, continue; klist_for_each_entry(ic, &cont->containers, node, &iter) { - if (dev != ic->classdev.dev) + if (dev != ic->classdev.parent) continue; klist_del(&ic->node); if (fn) fn(cont, dev, &ic->classdev); else { attribute_container_remove_attrs(&ic->classdev); - class_device_unregister(&ic->classdev); + device_unregister(&ic->classdev); } } } @@ -252,7 +251,7 @@ void attribute_container_device_trigger(struct device *dev, int (*fn)(struct attribute_container *, struct device *, - struct class_device *)) + struct device *)) { struct attribute_container *cont; @@ -270,7 +269,7 @@ attribute_container_device_trigger(struct device *dev, } klist_for_each_entry(ic, &cont->containers, node, &iter) { - if (dev == ic->classdev.dev) + if (dev == ic->classdev.parent) fn(cont, dev, &ic->classdev); } } @@ -313,11 +312,11 @@ attribute_container_trigger(struct device *dev, * attributes listed in the container */ int -attribute_container_add_attrs(struct class_device *classdev) +attribute_container_add_attrs(struct device *classdev) { struct attribute_container *cont = attribute_container_classdev_to_container(classdev); - struct class_device_attribute **attrs = cont->attrs; + struct device_attribute **attrs = cont->attrs; int i, error; BUG_ON(attrs && cont->grp); @@ -329,7 +328,7 @@ attribute_container_add_attrs(struct class_device *classdev) return sysfs_create_group(&classdev->kobj, cont->grp); for (i = 0; attrs[i]; i++) { - error = class_device_create_file(classdev, attrs[i]); + error = device_create_file(classdev, attrs[i]); if (error) return error; } @@ -338,18 +337,18 @@ attribute_container_add_attrs(struct class_device *classdev) } /** - * attribute_container_add_class_device - same function as class_device_add + * attribute_container_add_class_device - same function as device_add * * @classdev: the class device to add * - * This performs essentially the same function as class_device_add except for + * This performs essentially the same function as device_add except for * attribute containers, namely add the classdev to the system and then * create the attribute files */ int -attribute_container_add_class_device(struct class_device *classdev) +attribute_container_add_class_device(struct device *classdev) { - int error = class_device_add(classdev); + int error = device_add(classdev); if (error) return error; return attribute_container_add_attrs(classdev); @@ -364,7 +363,7 @@ attribute_container_add_class_device(struct class_device *classdev) int attribute_container_add_class_device_adapter(struct attribute_container *cont, struct device *dev, - struct class_device *classdev) + struct device *classdev) { return attribute_container_add_class_device(classdev); } @@ -376,11 +375,11 @@ attribute_container_add_class_device_adapter(struct attribute_container *cont, * */ void -attribute_container_remove_attrs(struct class_device *classdev) +attribute_container_remove_attrs(struct device *classdev) { struct attribute_container *cont = attribute_container_classdev_to_container(classdev); - struct class_device_attribute **attrs = cont->attrs; + struct device_attribute **attrs = cont->attrs; int i; if (!attrs && !cont->grp) @@ -392,7 +391,7 @@ attribute_container_remove_attrs(struct class_device *classdev) } for (i = 0; attrs[i]; i++) - class_device_remove_file(classdev, attrs[i]); + device_remove_file(classdev, attrs[i]); } /** @@ -401,13 +400,13 @@ attribute_container_remove_attrs(struct class_device *classdev) * @classdev: the class device * * This function simply removes all the attribute files and then calls - * class_device_del. + * device_del. */ void -attribute_container_class_device_del(struct class_device *classdev) +attribute_container_class_device_del(struct device *classdev) { attribute_container_remove_attrs(classdev); - class_device_del(classdev); + device_del(classdev); } /** @@ -419,16 +418,16 @@ attribute_container_class_device_del(struct class_device *classdev) * Looks up the device in the container's list of class devices and returns * the corresponding class_device. */ -struct class_device * +struct device * attribute_container_find_class_device(struct attribute_container *cont, struct device *dev) { - struct class_device *cdev = NULL; + struct device *cdev = NULL; struct internal_container *ic; struct klist_iter iter; klist_for_each_entry(ic, &cont->containers, node, &iter) { - if (ic->classdev.dev == dev) { + if (ic->classdev.parent == dev) { cdev = &ic->classdev; /* FIXME: must exit iterator then break */ klist_iter_exit(&iter); diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c index cabd0edf215..84997efdb23 100644 --- a/drivers/base/transport_class.c +++ b/drivers/base/transport_class.c @@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(transport_class_unregister); static int anon_transport_dummy_function(struct transport_container *tc, struct device *dev, - struct class_device *cdev) + struct device *cdev) { /* do nothing */ return 0; @@ -115,7 +115,7 @@ EXPORT_SYMBOL_GPL(anon_transport_class_unregister); static int transport_setup_classdev(struct attribute_container *cont, struct device *dev, - struct class_device *classdev) + struct device *classdev) { struct transport_class *tclass = class_to_transport_class(cont->class); struct transport_container *tcont = attribute_container_to_transport_container(cont); @@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(transport_setup_device); static int transport_add_class_device(struct attribute_container *cont, struct device *dev, - struct class_device *classdev) + struct device *classdev) { int error = attribute_container_add_class_device(classdev); struct transport_container *tcont = @@ -181,7 +181,7 @@ EXPORT_SYMBOL_GPL(transport_add_device); static int transport_configure(struct attribute_container *cont, struct device *dev, - struct class_device *cdev) + struct device *cdev) { struct transport_class *tclass = class_to_transport_class(cont->class); struct transport_container *tcont = attribute_container_to_transport_container(cont); @@ -212,7 +212,7 @@ EXPORT_SYMBOL_GPL(transport_configure_device); static int transport_remove_classdev(struct attribute_container *cont, struct device *dev, - struct class_device *classdev) + struct device *classdev) { struct transport_container *tcont = attribute_container_to_transport_container(cont); @@ -251,12 +251,12 @@ EXPORT_SYMBOL_GPL(transport_remove_device); static void transport_destroy_classdev(struct attribute_container *cont, struct device *dev, - struct class_device *classdev) + struct device *classdev) { struct transport_class *tclass = class_to_transport_class(cont->class); if (tclass->remove != anon_transport_dummy_function) - class_device_put(classdev); + put_device(classdev); } -- cgit v1.2.3