aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/battery.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 00b0728efe82..ba34ca611d71 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -109,6 +109,7 @@ struct acpi_battery_trips {
109 109
110struct acpi_battery { 110struct acpi_battery {
111 acpi_handle handle; 111 acpi_handle handle;
112 struct acpi_device * device;
112 struct acpi_battery_flags flags; 113 struct acpi_battery_flags flags;
113 struct acpi_battery_trips trips; 114 struct acpi_battery_trips trips;
114 unsigned long alarm; 115 unsigned long alarm;
@@ -278,9 +279,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
278 if (!battery) 279 if (!battery)
279 return -EINVAL; 280 return -EINVAL;
280 281
281 result = acpi_bus_get_device(battery->handle, &device); 282 device = battery->device;
282 if (result)
283 return result;
284 283
285 result = acpi_bus_get_status(device); 284 result = acpi_bus_get_status(device);
286 if (result) 285 if (result)
@@ -662,8 +661,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
662 if (!battery) 661 if (!battery)
663 return; 662 return;
664 663
665 if (acpi_bus_get_device(handle, &device)) 664 device = battery->device;
666 return;
667 665
668 switch (event) { 666 switch (event) {
669 case ACPI_BATTERY_NOTIFY_STATUS: 667 case ACPI_BATTERY_NOTIFY_STATUS:
@@ -696,6 +694,7 @@ static int acpi_battery_add(struct acpi_device *device)
696 memset(battery, 0, sizeof(struct acpi_battery)); 694 memset(battery, 0, sizeof(struct acpi_battery));
697 695
698 battery->handle = device->handle; 696 battery->handle = device->handle;
697 battery->device = device;
699 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); 698 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
700 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); 699 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
701 acpi_driver_data(device) = battery; 700 acpi_driver_data(device) = battery;