diff options
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 5cd7f8c5666a..276cde70a514 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -285,8 +285,9 @@ static int acpi_scan_hot_remove(struct acpi_device *device) | |||
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | void acpi_bus_device_eject(struct acpi_device *device, u32 ost_src) | 288 | void acpi_bus_device_eject(void *data, u32 ost_src) |
289 | { | 289 | { |
290 | struct acpi_device *device = data; | ||
290 | acpi_handle handle = device->handle; | 291 | acpi_handle handle = device->handle; |
291 | struct acpi_scan_handler *handler; | 292 | struct acpi_scan_handler *handler; |
292 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | 293 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; |
@@ -327,8 +328,9 @@ void acpi_bus_device_eject(struct acpi_device *device, u32 ost_src) | |||
327 | goto out; | 328 | goto out; |
328 | } | 329 | } |
329 | 330 | ||
330 | static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source) | 331 | static void acpi_scan_bus_device_check(void *data, u32 ost_source) |
331 | { | 332 | { |
333 | acpi_handle handle = data; | ||
332 | struct acpi_device *device = NULL; | 334 | struct acpi_device *device = NULL; |
333 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | 335 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; |
334 | int error; | 336 | int error; |
@@ -363,18 +365,6 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source) | |||
363 | unlock_device_hotplug(); | 365 | unlock_device_hotplug(); |
364 | } | 366 | } |
365 | 367 | ||
366 | static void acpi_scan_bus_check(void *context) | ||
367 | { | ||
368 | acpi_scan_bus_device_check((acpi_handle)context, | ||
369 | ACPI_NOTIFY_BUS_CHECK); | ||
370 | } | ||
371 | |||
372 | static void acpi_scan_device_check(void *context) | ||
373 | { | ||
374 | acpi_scan_bus_device_check((acpi_handle)context, | ||
375 | ACPI_NOTIFY_DEVICE_CHECK); | ||
376 | } | ||
377 | |||
378 | static void acpi_hotplug_unsupported(acpi_handle handle, u32 type) | 368 | static void acpi_hotplug_unsupported(acpi_handle handle, u32 type) |
379 | { | 369 | { |
380 | u32 ost_status; | 370 | u32 ost_status; |
@@ -403,18 +393,8 @@ static void acpi_hotplug_unsupported(acpi_handle handle, u32 type) | |||
403 | acpi_evaluate_hotplug_ost(handle, type, ost_status, NULL); | 393 | acpi_evaluate_hotplug_ost(handle, type, ost_status, NULL); |
404 | } | 394 | } |
405 | 395 | ||
406 | /** | ||
407 | * acpi_bus_hot_remove_device: Hot-remove a device and its children. | ||
408 | * @context: Address of the ACPI device object to hot-remove. | ||
409 | */ | ||
410 | static void acpi_bus_hot_remove_device(void *context) | ||
411 | { | ||
412 | acpi_bus_device_eject(context, ACPI_NOTIFY_EJECT_REQUEST); | ||
413 | } | ||
414 | |||
415 | static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) | 396 | static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) |
416 | { | 397 | { |
417 | acpi_osd_exec_callback callback; | ||
418 | struct acpi_scan_handler *handler = data; | 398 | struct acpi_scan_handler *handler = data; |
419 | struct acpi_device *adev; | 399 | struct acpi_device *adev; |
420 | acpi_status status; | 400 | acpi_status status; |
@@ -425,11 +405,9 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) | |||
425 | switch (type) { | 405 | switch (type) { |
426 | case ACPI_NOTIFY_BUS_CHECK: | 406 | case ACPI_NOTIFY_BUS_CHECK: |
427 | acpi_handle_debug(handle, "ACPI_NOTIFY_BUS_CHECK event\n"); | 407 | acpi_handle_debug(handle, "ACPI_NOTIFY_BUS_CHECK event\n"); |
428 | callback = acpi_scan_bus_check; | ||
429 | break; | 408 | break; |
430 | case ACPI_NOTIFY_DEVICE_CHECK: | 409 | case ACPI_NOTIFY_DEVICE_CHECK: |
431 | acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK event\n"); | 410 | acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK event\n"); |
432 | callback = acpi_scan_device_check; | ||
433 | break; | 411 | break; |
434 | case ACPI_NOTIFY_EJECT_REQUEST: | 412 | case ACPI_NOTIFY_EJECT_REQUEST: |
435 | acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); | 413 | acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); |
@@ -438,8 +416,7 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) | |||
438 | goto err_out; | 416 | goto err_out; |
439 | 417 | ||
440 | get_device(&adev->dev); | 418 | get_device(&adev->dev); |
441 | callback = acpi_bus_hot_remove_device; | 419 | status = acpi_hotplug_execute(acpi_bus_device_eject, adev, type); |
442 | status = acpi_os_hotplug_execute(callback, adev); | ||
443 | if (ACPI_SUCCESS(status)) | 420 | if (ACPI_SUCCESS(status)) |
444 | return; | 421 | return; |
445 | 422 | ||
@@ -449,7 +426,7 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) | |||
449 | /* non-hotplug event; possibly handled by other handler */ | 426 | /* non-hotplug event; possibly handled by other handler */ |
450 | return; | 427 | return; |
451 | } | 428 | } |
452 | status = acpi_os_hotplug_execute(callback, handle); | 429 | status = acpi_hotplug_execute(acpi_scan_bus_device_check, handle, type); |
453 | if (ACPI_SUCCESS(status)) | 430 | if (ACPI_SUCCESS(status)) |
454 | return; | 431 | return; |
455 | 432 | ||
@@ -484,11 +461,6 @@ static ssize_t power_state_show(struct device *dev, | |||
484 | 461 | ||
485 | static DEVICE_ATTR(power_state, 0444, power_state_show, NULL); | 462 | static DEVICE_ATTR(power_state, 0444, power_state_show, NULL); |
486 | 463 | ||
487 | static void acpi_eject_store_work(void *context) | ||
488 | { | ||
489 | acpi_bus_device_eject(context, ACPI_OST_EC_OSPM_EJECT); | ||
490 | } | ||
491 | |||
492 | static ssize_t | 464 | static ssize_t |
493 | acpi_eject_store(struct device *d, struct device_attribute *attr, | 465 | acpi_eject_store(struct device *d, struct device_attribute *attr, |
494 | const char *buf, size_t count) | 466 | const char *buf, size_t count) |
@@ -511,7 +483,8 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, | |||
511 | acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT, | 483 | acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT, |
512 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | 484 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); |
513 | get_device(&acpi_device->dev); | 485 | get_device(&acpi_device->dev); |
514 | status = acpi_os_hotplug_execute(acpi_eject_store_work, acpi_device); | 486 | status = acpi_hotplug_execute(acpi_bus_device_eject, acpi_device, |
487 | ACPI_OST_EC_OSPM_EJECT); | ||
515 | if (ACPI_SUCCESS(status)) | 488 | if (ACPI_SUCCESS(status)) |
516 | return count; | 489 | return count; |
517 | 490 | ||