diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-03-23 20:28:24 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-19 19:10:28 -0700 |
commit | b844eba292b477cda14582bfc6f535deed57a82d (patch) | |
tree | b2418a9a4fc672654f4592ae0a3e2853d82271c3 /drivers/base | |
parent | 138fe4e069798d9aa948a5402ff15e58f483ee4e (diff) |
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 <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/core.c | 29 | ||||
-rw-r--r-- | drivers/base/power/main.c | 40 |
2 files changed, 0 insertions, 69 deletions
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 -------------------------*/ /** @@ -246,26 +227,6 @@ static void dpm_resume(void) } /** - * 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. * * Resume all the devices, unlock them all, and allow new @@ -275,7 +236,6 @@ void device_resume(void) { might_sleep(); dpm_resume(); - unregister_dropped_devices(); } EXPORT_SYMBOL_GPL(device_resume); |