aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-06-27 17:26:35 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-07-01 07:31:00 -0400
commitccda70698057fd8dae7beeac147cdeead33dd543 (patch)
tree7db7fa727ac0a4d09272d432c57b294cd40c7f14
parente8110b64af8b7cce96d1878276770c76cb9c01d5 (diff)
ACPI: Use struct dev_pm_ops for power management in the AC driver
Make the ACPI AC adapter driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct acpi_device_ops. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r--drivers/acpi/ac.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 6512b20aeccd..ff9f6bd48301 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -61,7 +61,6 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file);
61 61
62static int acpi_ac_add(struct acpi_device *device); 62static int acpi_ac_add(struct acpi_device *device);
63static int acpi_ac_remove(struct acpi_device *device, int type); 63static int acpi_ac_remove(struct acpi_device *device, int type);
64static int acpi_ac_resume(struct acpi_device *device);
65static void acpi_ac_notify(struct acpi_device *device, u32 event); 64static void acpi_ac_notify(struct acpi_device *device, u32 event);
66 65
67static const struct acpi_device_id ac_device_ids[] = { 66static const struct acpi_device_id ac_device_ids[] = {
@@ -70,6 +69,9 @@ static const struct acpi_device_id ac_device_ids[] = {
70}; 69};
71MODULE_DEVICE_TABLE(acpi, ac_device_ids); 70MODULE_DEVICE_TABLE(acpi, ac_device_ids);
72 71
72static int acpi_ac_resume(struct device *dev);
73static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
74
73static struct acpi_driver acpi_ac_driver = { 75static struct acpi_driver acpi_ac_driver = {
74 .name = "ac", 76 .name = "ac",
75 .class = ACPI_AC_CLASS, 77 .class = ACPI_AC_CLASS,
@@ -78,9 +80,9 @@ static struct acpi_driver acpi_ac_driver = {
78 .ops = { 80 .ops = {
79 .add = acpi_ac_add, 81 .add = acpi_ac_add,
80 .remove = acpi_ac_remove, 82 .remove = acpi_ac_remove,
81 .resume = acpi_ac_resume,
82 .notify = acpi_ac_notify, 83 .notify = acpi_ac_notify,
83 }, 84 },
85 .drv.pm = &acpi_ac_pm,
84}; 86};
85 87
86struct acpi_ac { 88struct acpi_ac {
@@ -309,13 +311,18 @@ static int acpi_ac_add(struct acpi_device *device)
309 return result; 311 return result;
310} 312}
311 313
312static int acpi_ac_resume(struct acpi_device *device) 314static int acpi_ac_resume(struct device *dev)
313{ 315{
314 struct acpi_ac *ac; 316 struct acpi_ac *ac;
315 unsigned old_state; 317 unsigned old_state;
316 if (!device || !acpi_driver_data(device)) 318
319 if (!dev)
317 return -EINVAL; 320 return -EINVAL;
318 ac = acpi_driver_data(device); 321
322 ac = acpi_driver_data(to_acpi_device(dev));
323 if (!ac)
324 return -EINVAL;
325
319 old_state = ac->state; 326 old_state = ac->state;
320 if (acpi_ac_get_state(ac)) 327 if (acpi_ac_get_state(ac))
321 return 0; 328 return 0;