Commit 145def84 authored by Patrick Mochel's avatar Patrick Mochel Committed by Len Brown

ACPI: battery: add struct acpi_device to struct acpi_battery.

- Use it instead of acpi_bus_get_device()..
Signed-off-by: default avatarPatrick Mochel <mochel@linux.intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 3b74863d
...@@ -109,6 +109,7 @@ struct acpi_battery_trips { ...@@ -109,6 +109,7 @@ struct acpi_battery_trips {
struct acpi_battery { struct acpi_battery {
acpi_handle handle; acpi_handle handle;
struct acpi_device * device;
struct acpi_battery_flags flags; struct acpi_battery_flags flags;
struct acpi_battery_trips trips; struct acpi_battery_trips trips;
unsigned long alarm; unsigned long alarm;
...@@ -278,9 +279,7 @@ static int acpi_battery_check(struct acpi_battery *battery) ...@@ -278,9 +279,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
if (!battery) if (!battery)
return -EINVAL; return -EINVAL;
result = acpi_bus_get_device(battery->handle, &device); device = battery->device;
if (result)
return result;
result = acpi_bus_get_status(device); result = acpi_bus_get_status(device);
if (result) if (result)
...@@ -662,8 +661,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) ...@@ -662,8 +661,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
if (!battery) if (!battery)
return; return;
if (acpi_bus_get_device(handle, &device)) device = battery->device;
return;
switch (event) { switch (event) {
case ACPI_BATTERY_NOTIFY_STATUS: case ACPI_BATTERY_NOTIFY_STATUS:
...@@ -696,6 +694,7 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -696,6 +694,7 @@ static int acpi_battery_add(struct acpi_device *device)
memset(battery, 0, sizeof(struct acpi_battery)); memset(battery, 0, sizeof(struct acpi_battery));
battery->handle = device->handle; battery->handle = device->handle;
battery->device = device;
strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
acpi_driver_data(device) = battery; acpi_driver_data(device) = battery;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment