diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2013-06-29 00:24:40 +0800 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-15 01:33:10 +0200 |
commit | 7d2421f84b445dc48c68d33911f1fd6ce6853ee3 (patch) | |
tree | 8526f0747a4fcfff28176e5e8c890a9bf0246a28 /drivers/acpi/scan.c | |
parent | 0db98202605c3d32e023d43c30b5bd878f520976 (diff) |
ACPI: introduce two helper functions for _EJ0 and _LCK
Introduce two helper functions, acpi_evaluate_ej0() and
acpi_evaluate_lck(), that will execute the _EJ0 and _LCK ACPI
control methods, respectively, and use them to simplify the
ACPI scan code.
[rjw: Changelog]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index ada0b4cf2ba5..4c25c3b7ef81 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -193,8 +193,6 @@ static acpi_status acpi_bus_online_companions(acpi_handle handle, u32 lvl, static int acpi_scan_hot_remove(struct acpi_device *device) { acpi_handle handle = device->handle; - struct acpi_object_list arg_list; - union acpi_object arg; struct device *errdev; acpi_status status; unsigned long long sta; @@ -257,32 +255,15 @@ static int acpi_scan_hot_remove(struct acpi_device *device) put_device(&device->dev); device = NULL; - if (acpi_has_method(handle, "_LCK")) { - arg_list.count = 1; - arg_list.pointer = &arg; - arg.type = ACPI_TYPE_INTEGER; - arg.integer.value = 0; - acpi_evaluate_object(handle, "_LCK", &arg_list, NULL); - } - - arg_list.count = 1; - arg_list.pointer = &arg; - arg.type = ACPI_TYPE_INTEGER; - arg.integer.value = 1; - + acpi_evaluate_lck(handle, 0); /* * TBD: _EJD support. */ - status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); - if (ACPI_FAILURE(status)) { - if (status == AE_NOT_FOUND) { - return -ENODEV; - } else { - acpi_handle_warn(handle, "Eject failed (0x%x)\n", - status); - return -EIO; - } - } + status = acpi_evaluate_ej0(handle); + if (status == AE_NOT_FOUND) + return -ENODEV; + else if (ACPI_FAILURE(status)) + return -EIO; /* * Verify if eject was indeed successful. If not, log an error |