aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-03-23 15:28:24 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:28 -0400
commitb844eba292b477cda14582bfc6f535deed57a82d (patch)
treeb2418a9a4fc672654f4592ae0a3e2853d82271c3 /drivers/base
parent138fe4e069798d9aa948a5402ff15e58f483ee4e (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.c29
-rw-r--r--drivers/base/power/main.c40
2 files changed, 0 insertions, 69 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index adbc01788447..0262fc7c45fc 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1163,35 +1163,6 @@ void device_destroy(struct class *class, dev_t devt)
1163} 1163}
1164EXPORT_SYMBOL_GPL(device_destroy); 1164EXPORT_SYMBOL_GPL(device_destroy);
1165 1165
1166#ifdef CONFIG_PM_SLEEP
1167/**
1168 * destroy_suspended_device - asks the PM core to remove a suspended device
1169 * @class: pointer to the struct class that this device was registered with
1170 * @devt: the dev_t of the device that was previously registered
1171 *
1172 * This call notifies the PM core of the necessity to unregister a suspended
1173 * device created with a call to device_create() (devices cannot be
1174 * unregistered directly while suspended, since the PM core holds their
1175 * semaphores at that time).
1176 *
1177 * It can only be called within the scope of a system sleep transition. In
1178 * practice this means it has to be directly or indirectly invoked either by
1179 * a suspend or resume method, or by the PM core (e.g. via
1180 * disable_nonboot_cpus() or enable_nonboot_cpus()).
1181 */
1182void destroy_suspended_device(struct class *class, dev_t devt)
1183{
1184 struct device *dev;
1185
1186 dev = class_find_device(class, &devt, __match_devt);
1187 if (dev) {
1188 device_pm_schedule_removal(dev);
1189 put_device(dev);
1190 }
1191}
1192EXPORT_SYMBOL_GPL(destroy_suspended_device);
1193#endif /* CONFIG_PM_SLEEP */
1194
1195/** 1166/**
1196 * device_rename - renames a device 1167 * device_rename - renames a device
1197 * @dev: the pointer to the struct device to be renamed 1168 * @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 5630af302b2f..c4568b82875b 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -50,7 +50,6 @@
50LIST_HEAD(dpm_active); 50LIST_HEAD(dpm_active);
51static LIST_HEAD(dpm_off); 51static LIST_HEAD(dpm_off);
52static LIST_HEAD(dpm_off_irq); 52static LIST_HEAD(dpm_off_irq);
53static LIST_HEAD(dpm_destroy);
54 53
55static DEFINE_MUTEX(dpm_list_mtx); 54static DEFINE_MUTEX(dpm_list_mtx);
56 55
@@ -104,24 +103,6 @@ void device_pm_remove(struct device *dev)
104 mutex_unlock(&dpm_list_mtx); 103 mutex_unlock(&dpm_list_mtx);
105} 104}
106 105
107/**
108 * device_pm_schedule_removal - schedule the removal of a suspended device
109 * @dev: Device to destroy
110 *
111 * Moves the device to the dpm_destroy list for further processing by
112 * unregister_dropped_devices().
113 */
114void device_pm_schedule_removal(struct device *dev)
115{
116 pr_debug("PM: Preparing for removal: %s:%s\n",
117 dev->bus ? dev->bus->name : "No Bus",
118 kobject_name(&dev->kobj));
119 mutex_lock(&dpm_list_mtx);
120 list_move_tail(&dev->power.entry, &dpm_destroy);
121 mutex_unlock(&dpm_list_mtx);
122}
123EXPORT_SYMBOL_GPL(device_pm_schedule_removal);
124
125/*------------------------- Resume routines -------------------------*/ 106/*------------------------- Resume routines -------------------------*/
126 107
127/** 108/**
@@ -246,26 +227,6 @@ static void dpm_resume(void)
246} 227}
247 228
248/** 229/**
249 * unregister_dropped_devices - Unregister devices scheduled for removal
250 *
251 * Unregister all devices on the dpm_destroy list.
252 */
253static void unregister_dropped_devices(void)
254{
255 mutex_lock(&dpm_list_mtx);
256 while (!list_empty(&dpm_destroy)) {
257 struct list_head *entry = dpm_destroy.next;
258 struct device *dev = to_device(entry);
259
260 mutex_unlock(&dpm_list_mtx);
261 /* This also removes the device from the list */
262 device_unregister(dev);
263 mutex_lock(&dpm_list_mtx);
264 }
265 mutex_unlock(&dpm_list_mtx);
266}
267
268/**
269 * device_resume - Restore state of each device in system. 230 * device_resume - Restore state of each device in system.
270 * 231 *
271 * Resume all the devices, unlock them all, and allow new 232 * Resume all the devices, unlock them all, and allow new
@@ -275,7 +236,6 @@ void device_resume(void)
275{ 236{
276 might_sleep(); 237 might_sleep();
277 dpm_resume(); 238 dpm_resume();
278 unregister_dropped_devices();
279} 239}
280EXPORT_SYMBOL_GPL(device_resume); 240EXPORT_SYMBOL_GPL(device_resume);
281 241