aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-06-27 17:26:07 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-07-01 07:30:59 -0400
commit62fcbdd95ccabcff7b41a859032496f6ca492045 (patch)
tree27febe8360efdae138d04d95d6bbb4b0d2e68d27 /drivers/acpi
parent67699c5f0c68f5dc49e92b172d372c99cdd2bf09 (diff)
ACPI: Use struct dev_pm_ops for power management in the fan driver
Make the ACPI fan 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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/fan.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index ed1e58dc19d8..669d9ee80d16 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -46,8 +46,6 @@ MODULE_LICENSE("GPL");
46 46
47static int acpi_fan_add(struct acpi_device *device); 47static int acpi_fan_add(struct acpi_device *device);
48static int acpi_fan_remove(struct acpi_device *device, int type); 48static int acpi_fan_remove(struct acpi_device *device, int type);
49static int acpi_fan_suspend(struct acpi_device *device);
50static int acpi_fan_resume(struct acpi_device *device);
51 49
52static const struct acpi_device_id fan_device_ids[] = { 50static const struct acpi_device_id fan_device_ids[] = {
53 {"PNP0C0B", 0}, 51 {"PNP0C0B", 0},
@@ -55,6 +53,10 @@ static const struct acpi_device_id fan_device_ids[] = {
55}; 53};
56MODULE_DEVICE_TABLE(acpi, fan_device_ids); 54MODULE_DEVICE_TABLE(acpi, fan_device_ids);
57 55
56static int acpi_fan_suspend(struct device *dev);
57static int acpi_fan_resume(struct device *dev);
58static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume);
59
58static struct acpi_driver acpi_fan_driver = { 60static struct acpi_driver acpi_fan_driver = {
59 .name = "fan", 61 .name = "fan",
60 .class = ACPI_FAN_CLASS, 62 .class = ACPI_FAN_CLASS,
@@ -62,9 +64,8 @@ static struct acpi_driver acpi_fan_driver = {
62 .ops = { 64 .ops = {
63 .add = acpi_fan_add, 65 .add = acpi_fan_add,
64 .remove = acpi_fan_remove, 66 .remove = acpi_fan_remove,
65 .suspend = acpi_fan_suspend,
66 .resume = acpi_fan_resume,
67 }, 67 },
68 .drv.pm = &acpi_fan_pm,
68}; 69};
69 70
70/* thermal cooling device callbacks */ 71/* thermal cooling device callbacks */
@@ -183,24 +184,24 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
183 return 0; 184 return 0;
184} 185}
185 186
186static int acpi_fan_suspend(struct acpi_device *device) 187static int acpi_fan_suspend(struct device *dev)
187{ 188{
188 if (!device) 189 if (!dev)
189 return -EINVAL; 190 return -EINVAL;
190 191
191 acpi_bus_set_power(device->handle, ACPI_STATE_D0); 192 acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0);
192 193
193 return AE_OK; 194 return AE_OK;
194} 195}
195 196
196static int acpi_fan_resume(struct acpi_device *device) 197static int acpi_fan_resume(struct device *dev)
197{ 198{
198 int result; 199 int result;
199 200
200 if (!device) 201 if (!dev)
201 return -EINVAL; 202 return -EINVAL;
202 203
203 result = acpi_bus_update_power(device->handle, NULL); 204 result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL);
204 if (result) 205 if (result)
205 printk(KERN_ERR PREFIX "Error updating fan power state\n"); 206 printk(KERN_ERR PREFIX "Error updating fan power state\n");
206 207