From: Rafael J. Wysocki <[email protected]>

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 <[email protected]>
---
 drivers/hwmon/abituguru.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru.c
===================================================================
--- linux.orig/drivers/hwmon/abituguru.c
+++ linux/drivers/hwmon/abituguru.c
@@ -1514,9 +1514,11 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru_suspend(struct device *dev)
 {
-       struct abituguru_data *data = platform_get_drvdata(pdev);
+       struct abituguru_data *data;
+
+       data = platform_get_drvdata(to_platform_device(dev));
        /*
         * make sure all communications with the uguru are done and no new
         * ones are started
@@ -1525,29 +1527,32 @@ static int abituguru_suspend(struct plat
        return 0;
 }
 
-static int abituguru_resume(struct platform_device *pdev)
+static int abituguru_resume(struct device *dev)
 {
-       struct abituguru_data *data = platform_get_drvdata(pdev);
+       struct abituguru_data *data;
+
+       data = platform_get_drvdata(to_platform_device(dev));
        /* See if the uGuru is still ready */
        if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT)
                data->uguru_ready = 0;
        mutex_unlock(&data->update_lock);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
+#define ABIT_UGURU_PM  (&abituguru_pm)
 #else
-#define abituguru_suspend      NULL
-#define abituguru_resume       NULL
+#define ABIT_UGURU_PM  NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru_driver = {
        .driver = {
                .owner  = THIS_MODULE,
                .name   = ABIT_UGURU_NAME,
+               .pm     = ABIT_UGURU_PM,
        },
        .probe          = abituguru_probe,
        .remove         = __devexit_p(abituguru_remove),
-       .suspend        = abituguru_suspend,
-       .resume         = abituguru_resume,
 };
 
 static int __init abituguru_detect(void)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to