diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2013-06-28 12:24:40 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-14 19:33:10 -0400 |
commit | 7d2421f84b445dc48c68d33911f1fd6ce6853ee3 (patch) | |
tree | 8526f0747a4fcfff28176e5e8c890a9bf0246a28 /drivers/acpi/utils.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/utils.c')
-rw-r--r-- | drivers/acpi/utils.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 87b85882b5df..552248b0005b 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -522,3 +522,46 @@ acpi_status acpi_execute_simple_method(acpi_handle handle, char *method, | |||
522 | return acpi_evaluate_object(handle, method, &arg_list, NULL); | 522 | return acpi_evaluate_object(handle, method, &arg_list, NULL); |
523 | } | 523 | } |
524 | EXPORT_SYMBOL(acpi_execute_simple_method); | 524 | EXPORT_SYMBOL(acpi_execute_simple_method); |
525 | |||
526 | /** | ||
527 | * acpi_evaluate_ej0: Evaluate _EJ0 method for hotplug operations | ||
528 | * @handle: ACPI device handle | ||
529 | * | ||
530 | * Evaluate device's _EJ0 method for hotplug operations. | ||
531 | */ | ||
532 | acpi_status acpi_evaluate_ej0(acpi_handle handle) | ||
533 | { | ||
534 | acpi_status status; | ||
535 | |||
536 | status = acpi_execute_simple_method(handle, "_EJ0", 1); | ||
537 | if (status == AE_NOT_FOUND) | ||
538 | acpi_handle_warn(handle, "No _EJ0 support for device\n"); | ||
539 | else if (ACPI_FAILURE(status)) | ||
540 | acpi_handle_warn(handle, "Eject failed (0x%x)\n", status); | ||
541 | |||
542 | return status; | ||
543 | } | ||
544 | |||
545 | /** | ||
546 | * acpi_evaluate_lck: Evaluate _LCK method to lock/unlock device | ||
547 | * @handle: ACPI device handle | ||
548 | * @lock: lock device if non-zero, otherwise unlock device | ||
549 | * | ||
550 | * Evaluate device's _LCK method if present to lock/unlock device | ||
551 | */ | ||
552 | acpi_status acpi_evaluate_lck(acpi_handle handle, int lock) | ||
553 | { | ||
554 | acpi_status status; | ||
555 | |||
556 | status = acpi_execute_simple_method(handle, "_LCK", !!lock); | ||
557 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | ||
558 | if (lock) | ||
559 | acpi_handle_warn(handle, | ||
560 | "Locking device failed (0x%x)\n", status); | ||
561 | else | ||
562 | acpi_handle_warn(handle, | ||
563 | "Unlocking device failed (0x%x)\n", status); | ||
564 | } | ||
565 | |||
566 | return status; | ||
567 | } | ||