diff options
-rw-r--r-- | drivers/acpi/battery.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index f3b0024e5760..fc9c50ab5219 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -123,7 +123,7 @@ struct acpi_battery_flags { | |||
123 | 123 | ||
124 | struct acpi_battery { | 124 | struct acpi_battery { |
125 | struct mutex mutex; | 125 | struct mutex mutex; |
126 | struct acpi_device * device; | 126 | struct acpi_device *device; |
127 | struct acpi_battery_flags flags; | 127 | struct acpi_battery_flags flags; |
128 | struct acpi_buffer bif_data; | 128 | struct acpi_buffer bif_data; |
129 | struct acpi_buffer bst_data; | 129 | struct acpi_buffer bst_data; |
@@ -241,7 +241,9 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
241 | 241 | ||
242 | /* Evalute _BIF */ | 242 | /* Evalute _BIF */ |
243 | 243 | ||
244 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL, &buffer); | 244 | status = |
245 | acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL, | ||
246 | &buffer); | ||
245 | if (ACPI_FAILURE(status)) { | 247 | if (ACPI_FAILURE(status)) { |
246 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); | 248 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); |
247 | return -ENODEV; | 249 | return -ENODEV; |
@@ -253,7 +255,9 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
253 | 255 | ||
254 | /* Extract Package Data */ | 256 | /* Extract Package Data */ |
255 | 257 | ||
256 | result = acpi_battery_extract_package(battery, package, &format, data, "_BIF"); | 258 | result = |
259 | acpi_battery_extract_package(battery, package, &format, data, | ||
260 | "_BIF"); | ||
257 | if (result) | 261 | if (result) |
258 | goto end; | 262 | goto end; |
259 | 263 | ||
@@ -289,7 +293,9 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
289 | 293 | ||
290 | /* Evalute _BST */ | 294 | /* Evalute _BST */ |
291 | 295 | ||
292 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL, &buffer); | 296 | status = |
297 | acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL, | ||
298 | &buffer); | ||
293 | if (ACPI_FAILURE(status)) { | 299 | if (ACPI_FAILURE(status)) { |
294 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); | 300 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); |
295 | return -ENODEV; | 301 | return -ENODEV; |
@@ -301,7 +307,9 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
301 | 307 | ||
302 | /* Extract Package Data */ | 308 | /* Extract Package Data */ |
303 | 309 | ||
304 | result = acpi_battery_extract_package(battery, package, &format, data, "_BST"); | 310 | result = |
311 | acpi_battery_extract_package(battery, package, &format, data, | ||
312 | "_BST"); | ||
305 | if (result) | 313 | if (result) |
306 | goto end; | 314 | goto end; |
307 | 315 | ||
@@ -320,7 +328,8 @@ static int acpi_battery_get_alarm(struct acpi_battery *battery) | |||
320 | return 0; | 328 | return 0; |
321 | } | 329 | } |
322 | 330 | ||
323 | static int acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) | 331 | static int acpi_battery_set_alarm(struct acpi_battery *battery, |
332 | unsigned long alarm) | ||
324 | { | 333 | { |
325 | acpi_status status = 0; | 334 | acpi_status status = 0; |
326 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 335 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
@@ -336,7 +345,9 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long al | |||
336 | 345 | ||
337 | arg0.integer.value = alarm; | 346 | arg0.integer.value = alarm; |
338 | 347 | ||
339 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", &arg_list, NULL); | 348 | status = |
349 | acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", | ||
350 | &arg_list, NULL); | ||
340 | if (ACPI_FAILURE(status)) | 351 | if (ACPI_FAILURE(status)) |
341 | return -ENODEV; | 352 | return -ENODEV; |
342 | 353 | ||
@@ -400,7 +411,7 @@ static int acpi_battery_init_update(struct acpi_battery *battery) | |||
400 | } | 411 | } |
401 | 412 | ||
402 | static int acpi_battery_update(struct acpi_battery *battery, | 413 | static int acpi_battery_update(struct acpi_battery *battery, |
403 | int update, int *update_result_ptr) | 414 | int update, int *update_result_ptr) |
404 | { | 415 | { |
405 | int result = 0; | 416 | int result = 0; |
406 | int update_result = ACPI_BATTERY_NONE_UPDATE; | 417 | int update_result = ACPI_BATTERY_NONE_UPDATE; |
@@ -418,7 +429,8 @@ static int acpi_battery_update(struct acpi_battery *battery, | |||
418 | result = acpi_battery_get_status(battery); | 429 | result = acpi_battery_get_status(battery); |
419 | if (result) | 430 | if (result) |
420 | goto end;; | 431 | goto end;; |
421 | if (acpi_battery_inserted(battery) || acpi_battery_removed(battery)) { | 432 | if (acpi_battery_inserted(battery) |
433 | || acpi_battery_removed(battery)) { | ||
422 | result = acpi_battery_init_update(battery); | 434 | result = acpi_battery_init_update(battery); |
423 | if (result) | 435 | if (result) |
424 | goto end;; | 436 | goto end;; |
@@ -770,7 +782,6 @@ acpi_battery_write_alarm(struct file *file, | |||
770 | struct acpi_battery *battery = m->private; | 782 | struct acpi_battery *battery = m->private; |
771 | int update_result = ACPI_BATTERY_NONE_UPDATE; | 783 | int update_result = ACPI_BATTERY_NONE_UPDATE; |
772 | 784 | ||
773 | |||
774 | if (!battery || (count > sizeof(alarm_string) - 1)) | 785 | if (!battery || (count > sizeof(alarm_string) - 1)) |
775 | return -EINVAL; | 786 | return -EINVAL; |
776 | 787 | ||
@@ -845,7 +856,6 @@ static int acpi_battery_add_fs(struct acpi_device *device) | |||
845 | { | 856 | { |
846 | struct proc_dir_entry *entry = NULL; | 857 | struct proc_dir_entry *entry = NULL; |
847 | 858 | ||
848 | |||
849 | if (!acpi_device_dir(device)) { | 859 | if (!acpi_device_dir(device)) { |
850 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 860 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
851 | acpi_battery_dir); | 861 | acpi_battery_dir); |
@@ -917,7 +927,6 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
917 | struct acpi_battery *battery = data; | 927 | struct acpi_battery *battery = data; |
918 | struct acpi_device *device = NULL; | 928 | struct acpi_device *device = NULL; |
919 | 929 | ||
920 | |||
921 | if (!battery) | 930 | if (!battery) |
922 | return; | 931 | return; |
923 | 932 | ||
@@ -932,7 +941,8 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
932 | device = battery->device; | 941 | device = battery->device; |
933 | acpi_battery_notify_update(battery); | 942 | acpi_battery_notify_update(battery); |
934 | acpi_battery_mutex_unlock(battery); | 943 | acpi_battery_mutex_unlock(battery); |
935 | acpi_bus_generate_event(device, event, acpi_battery_present(battery)); | 944 | acpi_bus_generate_event(device, event, |
945 | acpi_battery_present(battery)); | ||
936 | break; | 946 | break; |
937 | default: | 947 | default: |
938 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 948 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |