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>
This commit is contained in:
Rafael J. Wysocki
2008-03-23 20:28:24 +01:00
committed by Greg Kroah-Hartman
parent 138fe4e069
commit b844eba292
13 changed files with 22 additions and 146 deletions

View File

@@ -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);