diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-09-10 17:14:53 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-09-10 17:14:53 -0400 |
commit | 85fb0a1c35d86ed9a4de8d6cba79ba0801f7a1f7 (patch) | |
tree | 4373e14df0aa4064e64cf318edd3e07f5e162270 /drivers/acpi/scan.c | |
parent | a9238741987386bb549d61572973c7e62b2a4145 (diff) | |
parent | 942f40155a743f4204308d62405dacaa4bfadb11 (diff) |
Merge branch 'acpi-hotplug'
* acpi-hotplug:
PM / hibernate / memory hotplug: Rework mutual exclusion
PM / hibernate: Create memory bitmaps after freezing user space
ACPI / scan: Change ordering of locks for device hotplug
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 61d090b6ce25..fbdb82e70d10 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -204,8 +204,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device) | |||
204 | return -EINVAL; | 204 | return -EINVAL; |
205 | } | 205 | } |
206 | 206 | ||
207 | lock_device_hotplug(); | ||
208 | |||
209 | /* | 207 | /* |
210 | * Carry out two passes here and ignore errors in the first pass, | 208 | * Carry out two passes here and ignore errors in the first pass, |
211 | * because if the devices in question are memory blocks and | 209 | * because if the devices in question are memory blocks and |
@@ -236,9 +234,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device) | |||
236 | ACPI_UINT32_MAX, | 234 | ACPI_UINT32_MAX, |
237 | acpi_bus_online_companions, NULL, | 235 | acpi_bus_online_companions, NULL, |
238 | NULL, NULL); | 236 | NULL, NULL); |
239 | |||
240 | unlock_device_hotplug(); | ||
241 | |||
242 | put_device(&device->dev); | 237 | put_device(&device->dev); |
243 | return -EBUSY; | 238 | return -EBUSY; |
244 | } | 239 | } |
@@ -249,8 +244,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device) | |||
249 | 244 | ||
250 | acpi_bus_trim(device); | 245 | acpi_bus_trim(device); |
251 | 246 | ||
252 | unlock_device_hotplug(); | ||
253 | |||
254 | /* Device node has been unregistered. */ | 247 | /* Device node has been unregistered. */ |
255 | put_device(&device->dev); | 248 | put_device(&device->dev); |
256 | device = NULL; | 249 | device = NULL; |
@@ -289,6 +282,7 @@ static void acpi_bus_device_eject(void *context) | |||
289 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | 282 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; |
290 | int error; | 283 | int error; |
291 | 284 | ||
285 | lock_device_hotplug(); | ||
292 | mutex_lock(&acpi_scan_lock); | 286 | mutex_lock(&acpi_scan_lock); |
293 | 287 | ||
294 | acpi_bus_get_device(handle, &device); | 288 | acpi_bus_get_device(handle, &device); |
@@ -312,6 +306,7 @@ static void acpi_bus_device_eject(void *context) | |||
312 | 306 | ||
313 | out: | 307 | out: |
314 | mutex_unlock(&acpi_scan_lock); | 308 | mutex_unlock(&acpi_scan_lock); |
309 | unlock_device_hotplug(); | ||
315 | return; | 310 | return; |
316 | 311 | ||
317 | err_out: | 312 | err_out: |
@@ -326,8 +321,8 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source) | |||
326 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | 321 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; |
327 | int error; | 322 | int error; |
328 | 323 | ||
329 | mutex_lock(&acpi_scan_lock); | ||
330 | lock_device_hotplug(); | 324 | lock_device_hotplug(); |
325 | mutex_lock(&acpi_scan_lock); | ||
331 | 326 | ||
332 | if (ost_source != ACPI_NOTIFY_BUS_CHECK) { | 327 | if (ost_source != ACPI_NOTIFY_BUS_CHECK) { |
333 | acpi_bus_get_device(handle, &device); | 328 | acpi_bus_get_device(handle, &device); |
@@ -353,9 +348,9 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source) | |||
353 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); | 348 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); |
354 | 349 | ||
355 | out: | 350 | out: |
356 | unlock_device_hotplug(); | ||
357 | acpi_evaluate_hotplug_ost(handle, ost_source, ost_code, NULL); | 351 | acpi_evaluate_hotplug_ost(handle, ost_source, ost_code, NULL); |
358 | mutex_unlock(&acpi_scan_lock); | 352 | mutex_unlock(&acpi_scan_lock); |
353 | unlock_device_hotplug(); | ||
359 | } | 354 | } |
360 | 355 | ||
361 | static void acpi_scan_bus_check(void *context) | 356 | static void acpi_scan_bus_check(void *context) |
@@ -446,6 +441,7 @@ void acpi_bus_hot_remove_device(void *context) | |||
446 | acpi_handle handle = device->handle; | 441 | acpi_handle handle = device->handle; |
447 | int error; | 442 | int error; |
448 | 443 | ||
444 | lock_device_hotplug(); | ||
449 | mutex_lock(&acpi_scan_lock); | 445 | mutex_lock(&acpi_scan_lock); |
450 | 446 | ||
451 | error = acpi_scan_hot_remove(device); | 447 | error = acpi_scan_hot_remove(device); |
@@ -455,6 +451,7 @@ void acpi_bus_hot_remove_device(void *context) | |||
455 | NULL); | 451 | NULL); |
456 | 452 | ||
457 | mutex_unlock(&acpi_scan_lock); | 453 | mutex_unlock(&acpi_scan_lock); |
454 | unlock_device_hotplug(); | ||
458 | kfree(context); | 455 | kfree(context); |
459 | } | 456 | } |
460 | EXPORT_SYMBOL(acpi_bus_hot_remove_device); | 457 | EXPORT_SYMBOL(acpi_bus_hot_remove_device); |