diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-08-26 23:25:28 (GMT) |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-08-26 23:25:28 (GMT) |
commit | c92f56cbdfc08c8c207c9476c69c99fdbadbd77b (patch) | |
tree | c38480e47fc7c85ea609a6f882f5c5143c33cb74 /drivers/acpi/battery.c | |
parent | d8dfad3876e4386666b759da3c833d62fb8b2267 (diff) | |
parent | 0177f29fea534ef5e6af2d76e9a9be0fdd325c4d (diff) | |
download | linux-c92f56cbdfc08c8c207c9476c69c99fdbadbd77b.tar.xz |
Merge branch 'acpi-cleanup'
* acpi-cleanup: (21 commits)
ACPI / dock: fix error return code in dock_add()
ACPI / dock: Drop unnecessary local variable from dock_add()
ACPI / dock / PCI: Drop ACPI dock notifier chain
ACPI / dock: Do not check CONFIG_ACPI_DOCK_MODULE
ACPI / dock: Do not leak memory on falilures to add a dock station
ACPI: Drop ACPI bus notifier call chain
ACPI / dock: Rework the handling of notifications
ACPI / dock: Simplify dock_init_hotplug() and dock_release_hotplug()
ACPI / dock: Walk list in reverse order during removal of devices
ACPI / dock: Rework and simplify find_dock_devices()
ACPI / dock: Drop the hp_lock mutex from struct dock_station
ACPI: simplify acpiphp driver with new helper functions
ACPI: simplify dock driver with new helper functions
ACPI: Export acpi_(bay)|(dock)_match() from scan.c
ACPI: introduce two helper functions for _EJ0 and _LCK
ACPI: introduce helper function acpi_execute_simple_method()
ACPI: introduce helper function acpi_has_method()
ACPI / dock: simplify dock_create_acpi_device()
ACPI / dock: mark initialization functions with __init
ACPI / dock: drop redundant spin lock in dock station object
...
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index d405fba..da9fcaa 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -527,18 +527,14 @@ static int acpi_battery_get_state(struct acpi_battery *battery) static int acpi_battery_set_alarm(struct acpi_battery *battery) { acpi_status status = 0; - union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER }; - struct acpi_object_list arg_list = { 1, &arg0 }; if (!acpi_battery_present(battery) || !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags)) return -ENODEV; - arg0.integer.value = battery->alarm; - mutex_lock(&battery->lock); - status = acpi_evaluate_object(battery->device->handle, "_BTP", - &arg_list, NULL); + status = acpi_execute_simple_method(battery->device->handle, "_BTP", + battery->alarm); mutex_unlock(&battery->lock); if (ACPI_FAILURE(status)) @@ -550,12 +546,8 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) static int acpi_battery_init_alarm(struct acpi_battery *battery) { - acpi_status status = AE_OK; - acpi_handle handle = NULL; - /* See if alarms are supported, and if so, set default */ - status = acpi_get_handle(battery->device->handle, "_BTP", &handle); - if (ACPI_FAILURE(status)) { + if (!acpi_has_method(battery->device->handle, "_BTP")) { clear_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); return 0; } @@ -1068,7 +1060,7 @@ static int acpi_battery_add(struct acpi_device *device) { int result = 0; struct acpi_battery *battery = NULL; - acpi_handle handle; + if (!device) return -EINVAL; battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); @@ -1080,8 +1072,7 @@ static int acpi_battery_add(struct acpi_device *device) device->driver_data = battery; mutex_init(&battery->lock); mutex_init(&battery->sysfs_lock); - if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, - "_BIX", &handle))) + if (acpi_has_method(battery->device->handle, "_BIX")) set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); result = acpi_battery_update(battery); if (result) |