aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/scan.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 984eaff235df..a3f5d6eabe46 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -459,6 +459,12 @@ static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type)
459 return acpi_scan_device_check(adev); 459 return acpi_scan_device_check(adev);
460 case ACPI_NOTIFY_EJECT_REQUEST: 460 case ACPI_NOTIFY_EJECT_REQUEST:
461 case ACPI_OST_EC_OSPM_EJECT: 461 case ACPI_OST_EC_OSPM_EJECT:
462 if (adev->handler && !adev->handler->hotplug.enabled) {
463 dev_info(&adev->dev, "Eject disabled\n");
464 return -EPERM;
465 }
466 acpi_evaluate_hotplug_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST,
467 ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
462 return acpi_scan_hot_remove(adev); 468 return acpi_scan_hot_remove(adev);
463 } 469 }
464 return -EINVAL; 470 return -EINVAL;
@@ -483,6 +489,10 @@ static void acpi_device_hotplug(void *data, u32 src)
483 489
484 if (adev->flags.hotplug_notify) { 490 if (adev->flags.hotplug_notify) {
485 error = acpi_generic_hotplug_event(adev, src); 491 error = acpi_generic_hotplug_event(adev, src);
492 if (error == -EPERM) {
493 ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
494 goto err_out;
495 }
486 } else { 496 } else {
487 int (*event)(struct acpi_device *, u32); 497 int (*event)(struct acpi_device *, u32);
488 498
@@ -512,7 +522,6 @@ static void acpi_device_hotplug(void *data, u32 src)
512 522
513static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) 523static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
514{ 524{
515 struct acpi_scan_handler *handler = data;
516 u32 ost_code = ACPI_OST_SC_SUCCESS; 525 u32 ost_code = ACPI_OST_SC_SUCCESS;
517 struct acpi_device *adev; 526 struct acpi_device *adev;
518 acpi_status status; 527 acpi_status status;
@@ -528,13 +537,6 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
528 537
529 case ACPI_NOTIFY_EJECT_REQUEST: 538 case ACPI_NOTIFY_EJECT_REQUEST:
530 acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); 539 acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n");
531 if (handler && !handler->hotplug.enabled) {
532 acpi_handle_err(handle, "Eject disabled\n");
533 ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
534 goto out;
535 }
536 acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST,
537 ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
538 break; 540 break;
539 541
540 case ACPI_NOTIFY_DEVICE_WAKE: 542 case ACPI_NOTIFY_DEVICE_WAKE:
@@ -632,8 +634,6 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
632 if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable) 634 if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable)
633 return -ENODEV; 635 return -ENODEV;
634 636
635 acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT,
636 ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
637 get_device(&acpi_device->dev); 637 get_device(&acpi_device->dev);
638 status = acpi_hotplug_execute(acpi_device_hotplug, acpi_device, 638 status = acpi_hotplug_execute(acpi_device_hotplug, acpi_device,
639 ACPI_OST_EC_OSPM_EJECT); 639 ACPI_OST_EC_OSPM_EJECT);