diff options
Diffstat (limited to 'drivers/acpi/ac.c')
-rw-r--r-- | drivers/acpi/ac.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 36ca365bcead..4537ae4838c4 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -65,7 +65,7 @@ static struct acpi_driver acpi_ac_driver = { | |||
65 | }; | 65 | }; |
66 | 66 | ||
67 | struct acpi_ac { | 67 | struct acpi_ac { |
68 | acpi_handle handle; | 68 | struct acpi_device * device; |
69 | unsigned long state; | 69 | unsigned long state; |
70 | }; | 70 | }; |
71 | 71 | ||
@@ -88,7 +88,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) | |||
88 | if (!ac) | 88 | if (!ac) |
89 | return -EINVAL; | 89 | return -EINVAL; |
90 | 90 | ||
91 | status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); | 91 | status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL, &ac->state); |
92 | if (ACPI_FAILURE(status)) { | 92 | if (ACPI_FAILURE(status)) { |
93 | ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); | 93 | ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); |
94 | ac->state = ACPI_AC_STATUS_UNKNOWN; | 94 | ac->state = ACPI_AC_STATUS_UNKNOWN; |
@@ -191,9 +191,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) | |||
191 | if (!ac) | 191 | if (!ac) |
192 | return; | 192 | return; |
193 | 193 | ||
194 | if (acpi_bus_get_device(ac->handle, &device)) | 194 | device = ac->device; |
195 | return; | ||
196 | |||
197 | switch (event) { | 195 | switch (event) { |
198 | case ACPI_AC_NOTIFY_STATUS: | 196 | case ACPI_AC_NOTIFY_STATUS: |
199 | acpi_ac_get_state(ac); | 197 | acpi_ac_get_state(ac); |
@@ -223,7 +221,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
223 | return -ENOMEM; | 221 | return -ENOMEM; |
224 | memset(ac, 0, sizeof(struct acpi_ac)); | 222 | memset(ac, 0, sizeof(struct acpi_ac)); |
225 | 223 | ||
226 | ac->handle = device->handle; | 224 | ac->device = device; |
227 | strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME); | 225 | strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME); |
228 | strcpy(acpi_device_class(device), ACPI_AC_CLASS); | 226 | strcpy(acpi_device_class(device), ACPI_AC_CLASS); |
229 | acpi_driver_data(device) = ac; | 227 | acpi_driver_data(device) = ac; |
@@ -236,7 +234,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
236 | if (result) | 234 | if (result) |
237 | goto end; | 235 | goto end; |
238 | 236 | ||
239 | status = acpi_install_notify_handler(ac->handle, | 237 | status = acpi_install_notify_handler(device->handle, |
240 | ACPI_DEVICE_NOTIFY, acpi_ac_notify, | 238 | ACPI_DEVICE_NOTIFY, acpi_ac_notify, |
241 | ac); | 239 | ac); |
242 | if (ACPI_FAILURE(status)) { | 240 | if (ACPI_FAILURE(status)) { |
@@ -268,7 +266,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type) | |||
268 | 266 | ||
269 | ac = (struct acpi_ac *)acpi_driver_data(device); | 267 | ac = (struct acpi_ac *)acpi_driver_data(device); |
270 | 268 | ||
271 | status = acpi_remove_notify_handler(ac->handle, | 269 | status = acpi_remove_notify_handler(device->handle, |
272 | ACPI_DEVICE_NOTIFY, acpi_ac_notify); | 270 | ACPI_DEVICE_NOTIFY, acpi_ac_notify); |
273 | 271 | ||
274 | acpi_ac_remove_fs(device); | 272 | acpi_ac_remove_fs(device); |