diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/core.c | 29 | ||||
-rw-r--r-- | drivers/base/power/main.c | 40 | ||||
-rw-r--r-- | drivers/char/hw_random/core.c | 10 | ||||
-rw-r--r-- | drivers/char/misc.c | 13 | ||||
-rw-r--r-- | drivers/leds/led-class.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/b43/leds.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 8 |
7 files changed, 17 insertions, 99 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 | } |
1164 | EXPORT_SYMBOL_GPL(device_destroy); | 1164 | EXPORT_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 | */ | ||
1182 | void 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 | } | ||
1192 | EXPORT_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 @@ | |||
50 | LIST_HEAD(dpm_active); | 50 | LIST_HEAD(dpm_active); |
51 | static LIST_HEAD(dpm_off); | 51 | static LIST_HEAD(dpm_off); |
52 | static LIST_HEAD(dpm_off_irq); | 52 | static LIST_HEAD(dpm_off_irq); |
53 | static LIST_HEAD(dpm_destroy); | ||
54 | 53 | ||
55 | static DEFINE_MUTEX(dpm_list_mtx); | 54 | static 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 | */ | ||
114 | void 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 | } | ||
123 | EXPORT_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 | */ | ||
253 | static 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 | } |
280 | EXPORT_SYMBOL_GPL(device_resume); | 240 | EXPORT_SYMBOL_GPL(device_resume); |
281 | 241 | ||
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 349b6edc5794..662d60e44e9a 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -238,11 +238,11 @@ static DEVICE_ATTR(rng_available, S_IRUGO, | |||
238 | NULL); | 238 | NULL); |
239 | 239 | ||
240 | 240 | ||
241 | static void unregister_miscdev(bool suspended) | 241 | static void unregister_miscdev(void) |
242 | { | 242 | { |
243 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); | 243 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); |
244 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); | 244 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); |
245 | __misc_deregister(&rng_miscdev, suspended); | 245 | misc_deregister(&rng_miscdev); |
246 | } | 246 | } |
247 | 247 | ||
248 | static int register_miscdev(void) | 248 | static int register_miscdev(void) |
@@ -317,7 +317,7 @@ out: | |||
317 | } | 317 | } |
318 | EXPORT_SYMBOL_GPL(hwrng_register); | 318 | EXPORT_SYMBOL_GPL(hwrng_register); |
319 | 319 | ||
320 | void __hwrng_unregister(struct hwrng *rng, bool suspended) | 320 | void hwrng_unregister(struct hwrng *rng) |
321 | { | 321 | { |
322 | int err; | 322 | int err; |
323 | 323 | ||
@@ -336,11 +336,11 @@ void __hwrng_unregister(struct hwrng *rng, bool suspended) | |||
336 | } | 336 | } |
337 | } | 337 | } |
338 | if (list_empty(&rng_list)) | 338 | if (list_empty(&rng_list)) |
339 | unregister_miscdev(suspended); | 339 | unregister_miscdev(); |
340 | 340 | ||
341 | mutex_unlock(&rng_mutex); | 341 | mutex_unlock(&rng_mutex); |
342 | } | 342 | } |
343 | EXPORT_SYMBOL_GPL(__hwrng_unregister); | 343 | EXPORT_SYMBOL_GPL(hwrng_unregister); |
344 | 344 | ||
345 | 345 | ||
346 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); | 346 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); |
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index a39101feb2ed..4d058dadbfcc 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -232,9 +232,8 @@ int misc_register(struct miscdevice * misc) | |||
232 | } | 232 | } |
233 | 233 | ||
234 | /** | 234 | /** |
235 | * __misc_deregister - unregister a miscellaneous device | 235 | * misc_deregister - unregister a miscellaneous device |
236 | * @misc: device to unregister | 236 | * @misc: device to unregister |
237 | * @suspended: to be set if the function is used during suspend/resume | ||
238 | * | 237 | * |
239 | * Unregister a miscellaneous device that was previously | 238 | * Unregister a miscellaneous device that was previously |
240 | * successfully registered with misc_register(). Success | 239 | * successfully registered with misc_register(). Success |
@@ -242,7 +241,7 @@ int misc_register(struct miscdevice * misc) | |||
242 | * indicates an error. | 241 | * indicates an error. |
243 | */ | 242 | */ |
244 | 243 | ||
245 | int __misc_deregister(struct miscdevice *misc, bool suspended) | 244 | int misc_deregister(struct miscdevice *misc) |
246 | { | 245 | { |
247 | int i = misc->minor; | 246 | int i = misc->minor; |
248 | 247 | ||
@@ -251,11 +250,7 @@ int __misc_deregister(struct miscdevice *misc, bool suspended) | |||
251 | 250 | ||
252 | mutex_lock(&misc_mtx); | 251 | mutex_lock(&misc_mtx); |
253 | list_del(&misc->list); | 252 | list_del(&misc->list); |
254 | if (suspended) | 253 | device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); |
255 | destroy_suspended_device(misc_class, | ||
256 | MKDEV(MISC_MAJOR, misc->minor)); | ||
257 | else | ||
258 | device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); | ||
259 | if (i < DYNAMIC_MINORS && i>0) { | 254 | if (i < DYNAMIC_MINORS && i>0) { |
260 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); | 255 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); |
261 | } | 256 | } |
@@ -264,7 +259,7 @@ int __misc_deregister(struct miscdevice *misc, bool suspended) | |||
264 | } | 259 | } |
265 | 260 | ||
266 | EXPORT_SYMBOL(misc_register); | 261 | EXPORT_SYMBOL(misc_register); |
267 | EXPORT_SYMBOL(__misc_deregister); | 262 | EXPORT_SYMBOL(misc_deregister); |
268 | 263 | ||
269 | static int __init misc_init(void) | 264 | static int __init misc_init(void) |
270 | { | 265 | { |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 4a938780dfc3..63aad90247c4 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -139,12 +139,10 @@ EXPORT_SYMBOL_GPL(led_classdev_register); | |||
139 | /** | 139 | /** |
140 | * __led_classdev_unregister - unregisters a object of led_properties class. | 140 | * __led_classdev_unregister - unregisters a object of led_properties class. |
141 | * @led_cdev: the led device to unregister | 141 | * @led_cdev: the led device to unregister |
142 | * @suspended: indicates whether system-wide suspend or resume is in progress | ||
143 | * | 142 | * |
144 | * Unregisters a previously registered via led_classdev_register object. | 143 | * Unregisters a previously registered via led_classdev_register object. |
145 | */ | 144 | */ |
146 | void __led_classdev_unregister(struct led_classdev *led_cdev, | 145 | void led_classdev_unregister(struct led_classdev *led_cdev) |
147 | bool suspended) | ||
148 | { | 146 | { |
149 | device_remove_file(led_cdev->dev, &dev_attr_brightness); | 147 | device_remove_file(led_cdev->dev, &dev_attr_brightness); |
150 | #ifdef CONFIG_LEDS_TRIGGERS | 148 | #ifdef CONFIG_LEDS_TRIGGERS |
@@ -155,16 +153,13 @@ void __led_classdev_unregister(struct led_classdev *led_cdev, | |||
155 | up_write(&led_cdev->trigger_lock); | 153 | up_write(&led_cdev->trigger_lock); |
156 | #endif | 154 | #endif |
157 | 155 | ||
158 | if (suspended) | 156 | device_unregister(led_cdev->dev); |
159 | device_pm_schedule_removal(led_cdev->dev); | ||
160 | else | ||
161 | device_unregister(led_cdev->dev); | ||
162 | 157 | ||
163 | down_write(&leds_list_lock); | 158 | down_write(&leds_list_lock); |
164 | list_del(&led_cdev->node); | 159 | list_del(&led_cdev->node); |
165 | up_write(&leds_list_lock); | 160 | up_write(&leds_list_lock); |
166 | } | 161 | } |
167 | EXPORT_SYMBOL_GPL(__led_classdev_unregister); | 162 | EXPORT_SYMBOL_GPL(led_classdev_unregister); |
168 | 163 | ||
169 | static int __init leds_init(void) | 164 | static int __init leds_init(void) |
170 | { | 165 | { |
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c index 0aac1ff511df..36a9c42df835 100644 --- a/drivers/net/wireless/b43/leds.c +++ b/drivers/net/wireless/b43/leds.c | |||
@@ -116,10 +116,7 @@ static void b43_unregister_led(struct b43_led *led) | |||
116 | { | 116 | { |
117 | if (!led->dev) | 117 | if (!led->dev) |
118 | return; | 118 | return; |
119 | if (led->dev->suspend_in_progress) | 119 | led_classdev_unregister(&led->led_dev); |
120 | led_classdev_unregister_suspended(&led->led_dev); | ||
121 | else | ||
122 | led_classdev_unregister(&led->led_dev); | ||
123 | b43_led_turn_off(led->dev, led->index, led->activelow); | 120 | b43_led_turn_off(led->dev, led->index, led->activelow); |
124 | led->dev = NULL; | 121 | led->dev = NULL; |
125 | } | 122 | } |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index cf5c046c9fa8..943cc851c504 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2804,10 +2804,10 @@ static int b43_rng_read(struct hwrng *rng, u32 * data) | |||
2804 | return (sizeof(u16)); | 2804 | return (sizeof(u16)); |
2805 | } | 2805 | } |
2806 | 2806 | ||
2807 | static void b43_rng_exit(struct b43_wl *wl, bool suspended) | 2807 | static void b43_rng_exit(struct b43_wl *wl) |
2808 | { | 2808 | { |
2809 | if (wl->rng_initialized) | 2809 | if (wl->rng_initialized) |
2810 | __hwrng_unregister(&wl->rng, suspended); | 2810 | hwrng_unregister(&wl->rng); |
2811 | } | 2811 | } |
2812 | 2812 | ||
2813 | static int b43_rng_init(struct b43_wl *wl) | 2813 | static int b43_rng_init(struct b43_wl *wl) |
@@ -3824,7 +3824,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev) | |||
3824 | 3824 | ||
3825 | if (!dev->suspend_in_progress) { | 3825 | if (!dev->suspend_in_progress) { |
3826 | b43_leds_exit(dev); | 3826 | b43_leds_exit(dev); |
3827 | b43_rng_exit(dev->wl, false); | 3827 | b43_rng_exit(dev->wl); |
3828 | } | 3828 | } |
3829 | b43_dma_free(dev); | 3829 | b43_dma_free(dev); |
3830 | b43_pio_free(dev); | 3830 | b43_pio_free(dev); |
@@ -4589,7 +4589,7 @@ static int b43_resume(struct ssb_device *dev) | |||
4589 | err = b43_wireless_core_start(wldev); | 4589 | err = b43_wireless_core_start(wldev); |
4590 | if (err) { | 4590 | if (err) { |
4591 | b43_leds_exit(wldev); | 4591 | b43_leds_exit(wldev); |
4592 | b43_rng_exit(wldev->wl, true); | 4592 | b43_rng_exit(wldev->wl); |
4593 | b43_wireless_core_exit(wldev); | 4593 | b43_wireless_core_exit(wldev); |
4594 | b43err(wl, "Resume failed at core start\n"); | 4594 | b43err(wl, "Resume failed at core start\n"); |
4595 | goto out; | 4595 | goto out; |