aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/gpio-fan.c21
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
480static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state) 480static 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
492static int gpio_fan_resume(struct platform_device *pdev) 492static 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
502static 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
506static struct platform_driver gpio_fan_driver = { 508static 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