diff options
author | Len Brown <len.brown@intel.com> | 2006-07-01 11:05:19 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-07-01 11:05:19 -0400 |
commit | b2f71bade430d468398167d696731bf770de2db8 (patch) | |
tree | b804b0b21e722a42d5f2ee5edead8cab2e41be8b /drivers/acpi/battery.c | |
parent | ba290ab7dace8b3339c0cc86c221d48eed21e956 (diff) | |
parent | d07a8577f695c807977af003b6e75f996e01a15f (diff) |
Pull acpi_device_handle_cleanup into release branch
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 7d92f73b265f..2b8aab560b58 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -108,7 +108,7 @@ struct acpi_battery_trips { | |||
108 | }; | 108 | }; |
109 | 109 | ||
110 | struct acpi_battery { | 110 | struct acpi_battery { |
111 | acpi_handle handle; | 111 | struct acpi_device * device; |
112 | struct acpi_battery_flags flags; | 112 | struct acpi_battery_flags flags; |
113 | struct acpi_battery_trips trips; | 113 | struct acpi_battery_trips trips; |
114 | unsigned long alarm; | 114 | unsigned long alarm; |
@@ -138,7 +138,7 @@ acpi_battery_get_info(struct acpi_battery *battery, | |||
138 | 138 | ||
139 | /* Evalute _BIF */ | 139 | /* Evalute _BIF */ |
140 | 140 | ||
141 | status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer); | 141 | status = acpi_evaluate_object(battery->device->handle, "_BIF", NULL, &buffer); |
142 | if (ACPI_FAILURE(status)) { | 142 | if (ACPI_FAILURE(status)) { |
143 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); | 143 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); |
144 | return -ENODEV; | 144 | return -ENODEV; |
@@ -198,7 +198,7 @@ acpi_battery_get_status(struct acpi_battery *battery, | |||
198 | 198 | ||
199 | /* Evalute _BST */ | 199 | /* Evalute _BST */ |
200 | 200 | ||
201 | status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); | 201 | status = acpi_evaluate_object(battery->device->handle, "_BST", NULL, &buffer); |
202 | if (ACPI_FAILURE(status)) { | 202 | if (ACPI_FAILURE(status)) { |
203 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); | 203 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); |
204 | return -ENODEV; | 204 | return -ENODEV; |
@@ -255,7 +255,7 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) | |||
255 | 255 | ||
256 | arg0.integer.value = alarm; | 256 | arg0.integer.value = alarm; |
257 | 257 | ||
258 | status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL); | 258 | status = acpi_evaluate_object(battery->device->handle, "_BTP", &arg_list, NULL); |
259 | if (ACPI_FAILURE(status)) | 259 | if (ACPI_FAILURE(status)) |
260 | return -ENODEV; | 260 | return -ENODEV; |
261 | 261 | ||
@@ -278,9 +278,7 @@ static int acpi_battery_check(struct acpi_battery *battery) | |||
278 | if (!battery) | 278 | if (!battery) |
279 | return -EINVAL; | 279 | return -EINVAL; |
280 | 280 | ||
281 | result = acpi_bus_get_device(battery->handle, &device); | 281 | device = battery->device; |
282 | if (result) | ||
283 | return result; | ||
284 | 282 | ||
285 | result = acpi_bus_get_status(device); | 283 | result = acpi_bus_get_status(device); |
286 | if (result) | 284 | if (result) |
@@ -305,7 +303,7 @@ static int acpi_battery_check(struct acpi_battery *battery) | |||
305 | 303 | ||
306 | /* See if alarms are supported, and if so, set default */ | 304 | /* See if alarms are supported, and if so, set default */ |
307 | 305 | ||
308 | status = acpi_get_handle(battery->handle, "_BTP", &handle); | 306 | status = acpi_get_handle(battery->device->handle, "_BTP", &handle); |
309 | if (ACPI_SUCCESS(status)) { | 307 | if (ACPI_SUCCESS(status)) { |
310 | battery->flags.alarm = 1; | 308 | battery->flags.alarm = 1; |
311 | acpi_battery_set_alarm(battery, battery->trips.warning); | 309 | acpi_battery_set_alarm(battery, battery->trips.warning); |
@@ -662,8 +660,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
662 | if (!battery) | 660 | if (!battery) |
663 | return; | 661 | return; |
664 | 662 | ||
665 | if (acpi_bus_get_device(handle, &device)) | 663 | device = battery->device; |
666 | return; | ||
667 | 664 | ||
668 | switch (event) { | 665 | switch (event) { |
669 | case ACPI_BATTERY_NOTIFY_STATUS: | 666 | case ACPI_BATTERY_NOTIFY_STATUS: |
@@ -695,7 +692,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
695 | return -ENOMEM; | 692 | return -ENOMEM; |
696 | memset(battery, 0, sizeof(struct acpi_battery)); | 693 | memset(battery, 0, sizeof(struct acpi_battery)); |
697 | 694 | ||
698 | battery->handle = device->handle; | 695 | battery->device = device; |
699 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); | 696 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); |
700 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); | 697 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); |
701 | acpi_driver_data(device) = battery; | 698 | acpi_driver_data(device) = battery; |
@@ -708,7 +705,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
708 | if (result) | 705 | if (result) |
709 | goto end; | 706 | goto end; |
710 | 707 | ||
711 | status = acpi_install_notify_handler(battery->handle, | 708 | status = acpi_install_notify_handler(device->handle, |
712 | ACPI_DEVICE_NOTIFY, | 709 | ACPI_DEVICE_NOTIFY, |
713 | acpi_battery_notify, battery); | 710 | acpi_battery_notify, battery); |
714 | if (ACPI_FAILURE(status)) { | 711 | if (ACPI_FAILURE(status)) { |
@@ -740,7 +737,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
740 | 737 | ||
741 | battery = (struct acpi_battery *)acpi_driver_data(device); | 738 | battery = (struct acpi_battery *)acpi_driver_data(device); |
742 | 739 | ||
743 | status = acpi_remove_notify_handler(battery->handle, | 740 | status = acpi_remove_notify_handler(device->handle, |
744 | ACPI_DEVICE_NOTIFY, | 741 | ACPI_DEVICE_NOTIFY, |
745 | acpi_battery_notify); | 742 | acpi_battery_notify); |
746 | 743 | ||