diff options
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 81 |
1 files changed, 5 insertions, 76 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 59f9e272562e..8bb48bfab1df 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -470,7 +470,7 @@ static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type) | |||
470 | return -EINVAL; | 470 | return -EINVAL; |
471 | } | 471 | } |
472 | 472 | ||
473 | static void acpi_device_hotplug(void *data, u32 src) | 473 | void acpi_device_hotplug(void *data, u32 src) |
474 | { | 474 | { |
475 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | 475 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; |
476 | struct acpi_device *adev = data; | 476 | struct acpi_device *adev = data; |
@@ -520,75 +520,6 @@ static void acpi_device_hotplug(void *data, u32 src) | |||
520 | unlock_device_hotplug(); | 520 | unlock_device_hotplug(); |
521 | } | 521 | } |
522 | 522 | ||
523 | static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) | ||
524 | { | ||
525 | u32 ost_code = ACPI_OST_SC_SUCCESS; | ||
526 | struct acpi_device *adev; | ||
527 | acpi_status status; | ||
528 | |||
529 | switch (type) { | ||
530 | case ACPI_NOTIFY_BUS_CHECK: | ||
531 | acpi_handle_debug(handle, "ACPI_NOTIFY_BUS_CHECK event\n"); | ||
532 | break; | ||
533 | |||
534 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
535 | acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK event\n"); | ||
536 | break; | ||
537 | |||
538 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
539 | acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); | ||
540 | break; | ||
541 | |||
542 | case ACPI_NOTIFY_DEVICE_WAKE: | ||
543 | return; | ||
544 | |||
545 | case ACPI_NOTIFY_FREQUENCY_MISMATCH: | ||
546 | acpi_handle_err(handle, "Device cannot be configured due " | ||
547 | "to a frequency mismatch\n"); | ||
548 | goto out; | ||
549 | |||
550 | case ACPI_NOTIFY_BUS_MODE_MISMATCH: | ||
551 | acpi_handle_err(handle, "Device cannot be configured due " | ||
552 | "to a bus mode mismatch\n"); | ||
553 | goto out; | ||
554 | |||
555 | case ACPI_NOTIFY_POWER_FAULT: | ||
556 | acpi_handle_err(handle, "Device has suffered a power fault\n"); | ||
557 | goto out; | ||
558 | |||
559 | default: | ||
560 | acpi_handle_warn(handle, "Unsupported event type 0x%x\n", type); | ||
561 | ost_code = ACPI_OST_SC_UNRECOGNIZED_NOTIFY; | ||
562 | goto out; | ||
563 | } | ||
564 | |||
565 | ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | ||
566 | adev = acpi_bus_get_acpi_device(handle); | ||
567 | if (!adev) | ||
568 | goto out; | ||
569 | |||
570 | status = acpi_hotplug_execute(acpi_device_hotplug, adev, type); | ||
571 | if (ACPI_SUCCESS(status)) | ||
572 | return; | ||
573 | |||
574 | acpi_bus_put_acpi_device(adev); | ||
575 | |||
576 | out: | ||
577 | acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); | ||
578 | } | ||
579 | |||
580 | void acpi_install_hotplug_notify_handler(acpi_handle handle) | ||
581 | { | ||
582 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
583 | acpi_hotplug_notify_cb, NULL); | ||
584 | } | ||
585 | |||
586 | void acpi_remove_hotplug_notify_handler(acpi_handle handle) | ||
587 | { | ||
588 | acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
589 | acpi_hotplug_notify_cb); | ||
590 | } | ||
591 | |||
592 | static ssize_t real_power_state_show(struct device *dev, | 523 | static ssize_t real_power_state_show(struct device *dev, |
593 | struct device_attribute *attr, char *buf) | 524 | struct device_attribute *attr, char *buf) |
594 | { | 525 | { |
@@ -2037,12 +1968,10 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev) | |||
2037 | struct acpi_scan_handler *handler; | 1968 | struct acpi_scan_handler *handler; |
2038 | 1969 | ||
2039 | handler = acpi_scan_match_handler(hwid->id, NULL); | 1970 | handler = acpi_scan_match_handler(hwid->id, NULL); |
2040 | if (!handler) | 1971 | if (handler) { |
2041 | continue; | 1972 | adev->flags.hotplug_notify = true; |
2042 | 1973 | break; | |
2043 | acpi_install_hotplug_notify_handler(adev->handle); | 1974 | } |
2044 | adev->flags.hotplug_notify = true; | ||
2045 | break; | ||
2046 | } | 1975 | } |
2047 | } | 1976 | } |
2048 | 1977 | ||