diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2013-06-28 12:24:39 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-14 19:33:10 -0400 |
commit | 0db98202605c3d32e023d43c30b5bd878f520976 (patch) | |
tree | 7aec122f45db5c6b6c2f046ccf1eb9fa160fb616 /drivers/acpi/battery.c | |
parent | 952c63e9512b63220886105cfc791507046fa39a (diff) |
ACPI: introduce helper function acpi_execute_simple_method()
Introduce helper function acpi_execute_simple_method() and use it in
a number of places to simplify 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/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index a7627166e18b..74669ac4c615 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -525,18 +525,14 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
525 | static int acpi_battery_set_alarm(struct acpi_battery *battery) | 525 | static int acpi_battery_set_alarm(struct acpi_battery *battery) |
526 | { | 526 | { |
527 | acpi_status status = 0; | 527 | acpi_status status = 0; |
528 | union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER }; | ||
529 | struct acpi_object_list arg_list = { 1, &arg0 }; | ||
530 | 528 | ||
531 | if (!acpi_battery_present(battery) || | 529 | if (!acpi_battery_present(battery) || |
532 | !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags)) | 530 | !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags)) |
533 | return -ENODEV; | 531 | return -ENODEV; |
534 | 532 | ||
535 | arg0.integer.value = battery->alarm; | ||
536 | |||
537 | mutex_lock(&battery->lock); | 533 | mutex_lock(&battery->lock); |
538 | status = acpi_evaluate_object(battery->device->handle, "_BTP", | 534 | status = acpi_execute_simple_method(battery->device->handle, "_BTP", |
539 | &arg_list, NULL); | 535 | battery->alarm); |
540 | mutex_unlock(&battery->lock); | 536 | mutex_unlock(&battery->lock); |
541 | 537 | ||
542 | if (ACPI_FAILURE(status)) | 538 | if (ACPI_FAILURE(status)) |