mmc: tmio_mmc: Convert from legacy to modern PM ops
authorUlf Hansson <ulf.hansson@linaro.org>
Wed, 23 Oct 2013 12:57:50 +0000 (14:57 +0200)
committerChris Ball <chris@printf.net>
Fri, 14 Feb 2014 03:58:01 +0000 (22:58 -0500)
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/host/tmio_mmc.c

index 1900abb0423695ea06f9444376c62f2516b3b998..cfad844730d80195ff63172c3f69aed3e3fe1155 100644 (file)
 
 #include "tmio_mmc.h"
 
-#ifdef CONFIG_PM
-static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int tmio_mmc_suspend(struct device *dev)
 {
-       const struct mfd_cell *cell = mfd_get_cell(dev);
+       struct platform_device *pdev = to_platform_device(dev);
+       const struct mfd_cell *cell = mfd_get_cell(pdev);
        int ret;
 
-       ret = tmio_mmc_host_suspend(&dev->dev);
+       ret = tmio_mmc_host_suspend(dev);
 
        /* Tell MFD core it can disable us now.*/
        if (!ret && cell->disable)
-               cell->disable(dev);
+               cell->disable(pdev);
 
        return ret;
 }
 
-static int tmio_mmc_resume(struct platform_device *dev)
+static int tmio_mmc_resume(struct device *dev)
 {
-       const struct mfd_cell *cell = mfd_get_cell(dev);
+       struct platform_device *pdev = to_platform_device(dev);
+       const struct mfd_cell *cell = mfd_get_cell(pdev);
        int ret = 0;
 
        /* Tell the MFD core we are ready to be enabled */
        if (cell->resume)
-               ret = cell->resume(dev);
+               ret = cell->resume(pdev);
 
        if (!ret)
-               ret = tmio_mmc_host_resume(&dev->dev);
+               ret = tmio_mmc_host_resume(dev);
 
        return ret;
 }
-#else
-#define tmio_mmc_suspend NULL
-#define tmio_mmc_resume NULL
 #endif
 
 static int tmio_mmc_probe(struct platform_device *pdev)
@@ -134,15 +133,18 @@ static int tmio_mmc_remove(struct platform_device *pdev)
 
 /* ------------------- device registration ----------------------- */
 
+static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
+       SET_SYSTEM_SLEEP_PM_OPS(tmio_mmc_suspend, tmio_mmc_resume)
+};
+
 static struct platform_driver tmio_mmc_driver = {
        .driver = {
                .name = "tmio-mmc",
                .owner = THIS_MODULE,
+               .pm = &tmio_mmc_dev_pm_ops,
        },
        .probe = tmio_mmc_probe,
        .remove = tmio_mmc_remove,
-       .suspend = tmio_mmc_suspend,
-       .resume = tmio_mmc_resume,
 };
 
 module_platform_driver(tmio_mmc_driver);