diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-07-07 18:01:03 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:44 -0400 |
commit | 6d20a6c060c41a7a9c8f5bd4b9d44b8f13b78694 (patch) | |
tree | 7a319d71dc26e868def844fde878bcdc3677eabf /drivers/hwmon/gpio-fan.c | |
parent | c248f24cffc3d6692f428ccc9f2ba76cea1fa6ab (diff) |
hwmon: (gpio-fan) Use struct dev_pm_ops for power management
Make the gpio-fan driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
[linux@roeck-us.net: CONFIG_PM->CONFIG_PM_SLEEP, and remove unnecessary ()]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/gpio-fan.c')
-rw-r--r-- | drivers/hwmon/gpio-fan.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index b90b3e9617b0..2f4b01bda87c 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
@@ -41,7 +41,7 @@ struct gpio_fan_data { | |||
41 | int num_speed; | 41 | int num_speed; |
42 | struct gpio_fan_speed *speed; | 42 | struct gpio_fan_speed *speed; |
43 | int speed_index; | 43 | int speed_index; |
44 | #ifdef CONFIG_PM | 44 | #ifdef CONFIG_PM_SLEEP |
45 | int resume_speed; | 45 | int resume_speed; |
46 | #endif | 46 | #endif |
47 | bool pwm_enable; | 47 | bool pwm_enable; |
@@ -476,10 +476,10 @@ static int __devexit gpio_fan_remove(struct platform_device *pdev) | |||
476 | return 0; | 476 | return 0; |
477 | } | 477 | } |
478 | 478 | ||
479 | #ifdef CONFIG_PM | 479 | #ifdef CONFIG_PM_SLEEP |
480 | static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state) | 480 | static int gpio_fan_suspend(struct device *dev) |
481 | { | 481 | { |
482 | struct gpio_fan_data *fan_data = platform_get_drvdata(pdev); | 482 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
483 | 483 | ||
484 | if (fan_data->ctrl) { | 484 | if (fan_data->ctrl) { |
485 | fan_data->resume_speed = fan_data->speed_index; | 485 | fan_data->resume_speed = fan_data->speed_index; |
@@ -489,27 +489,28 @@ static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state) | |||
489 | return 0; | 489 | return 0; |
490 | } | 490 | } |
491 | 491 | ||
492 | static int gpio_fan_resume(struct platform_device *pdev) | 492 | static int gpio_fan_resume(struct device *dev) |
493 | { | 493 | { |
494 | struct gpio_fan_data *fan_data = platform_get_drvdata(pdev); | 494 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
495 | 495 | ||
496 | if (fan_data->ctrl) | 496 | if (fan_data->ctrl) |
497 | set_fan_speed(fan_data, fan_data->resume_speed); | 497 | set_fan_speed(fan_data, fan_data->resume_speed); |
498 | 498 | ||
499 | return 0; | 499 | return 0; |
500 | } | 500 | } |
501 | |||
502 | static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume); | ||
503 | #define GPIO_FAN_PM &gpio_fan_pm | ||
501 | #else | 504 | #else |
502 | #define gpio_fan_suspend NULL | 505 | #define GPIO_FAN_PM NULL |
503 | #define gpio_fan_resume NULL | ||
504 | #endif | 506 | #endif |
505 | 507 | ||
506 | static struct platform_driver gpio_fan_driver = { | 508 | static struct platform_driver gpio_fan_driver = { |
507 | .probe = gpio_fan_probe, | 509 | .probe = gpio_fan_probe, |
508 | .remove = __devexit_p(gpio_fan_remove), | 510 | .remove = __devexit_p(gpio_fan_remove), |
509 | .suspend = gpio_fan_suspend, | ||
510 | .resume = gpio_fan_resume, | ||
511 | .driver = { | 511 | .driver = { |
512 | .name = "gpio-fan", | 512 | .name = "gpio-fan", |
513 | .pm = GPIO_FAN_PM, | ||
513 | }, | 514 | }, |
514 | }; | 515 | }; |
515 | 516 | ||