aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/abituguru.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-07-07 17:59:12 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-07-22 00:48:44 -0400
commit4f0928c6652d8b512f81002ebf66ef0b22cf1af4 (patch)
tree0b1f8c8ba791cac2c912ad2eab335a3b2e6483bf /drivers/hwmon/abituguru.c
parent75311bea569d7ea77a5a3c5395bae27bb8a2df96 (diff)
hwmon: (abituguru) Use struct dev_pm_ops for power management
Make the Abit uGuru 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/abituguru.c')
-rw-r--r--drivers/hwmon/abituguru.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c
index a72bf25601a4..d4419b47f3d4 100644
--- a/drivers/hwmon/abituguru.c
+++ b/drivers/hwmon/abituguru.c
@@ -1513,10 +1513,10 @@ LEAVE_UPDATE:
1513 return NULL; 1513 return NULL;
1514} 1514}
1515 1515
1516#ifdef CONFIG_PM 1516#ifdef CONFIG_PM_SLEEP
1517static int abituguru_suspend(struct platform_device *pdev, pm_message_t state) 1517static int abituguru_suspend(struct device *dev)
1518{ 1518{
1519 struct abituguru_data *data = platform_get_drvdata(pdev); 1519 struct abituguru_data *data = dev_get_drvdata(dev);
1520 /* 1520 /*
1521 * make sure all communications with the uguru are done and no new 1521 * make sure all communications with the uguru are done and no new
1522 * ones are started 1522 * ones are started
@@ -1525,29 +1525,30 @@ static int abituguru_suspend(struct platform_device *pdev, pm_message_t state)
1525 return 0; 1525 return 0;
1526} 1526}
1527 1527
1528static int abituguru_resume(struct platform_device *pdev) 1528static int abituguru_resume(struct device *dev)
1529{ 1529{
1530 struct abituguru_data *data = platform_get_drvdata(pdev); 1530 struct abituguru_data *data = dev_get_drvdata(dev);
1531 /* See if the uGuru is still ready */ 1531 /* See if the uGuru is still ready */
1532 if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT) 1532 if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT)
1533 data->uguru_ready = 0; 1533 data->uguru_ready = 0;
1534 mutex_unlock(&data->update_lock); 1534 mutex_unlock(&data->update_lock);
1535 return 0; 1535 return 0;
1536} 1536}
1537
1538static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
1539#define ABIT_UGURU_PM &abituguru_pm
1537#else 1540#else
1538#define abituguru_suspend NULL 1541#define ABIT_UGURU_PM NULL
1539#define abituguru_resume NULL
1540#endif /* CONFIG_PM */ 1542#endif /* CONFIG_PM */
1541 1543
1542static struct platform_driver abituguru_driver = { 1544static struct platform_driver abituguru_driver = {
1543 .driver = { 1545 .driver = {
1544 .owner = THIS_MODULE, 1546 .owner = THIS_MODULE,
1545 .name = ABIT_UGURU_NAME, 1547 .name = ABIT_UGURU_NAME,
1548 .pm = ABIT_UGURU_PM,
1546 }, 1549 },
1547 .probe = abituguru_probe, 1550 .probe = abituguru_probe,
1548 .remove = __devexit_p(abituguru_remove), 1551 .remove = __devexit_p(abituguru_remove),
1549 .suspend = abituguru_suspend,
1550 .resume = abituguru_resume,
1551}; 1552};
1552 1553
1553static int __init abituguru_detect(void) 1554static int __init abituguru_detect(void)