spi/s3c64xx: Convert to dev_pm_ops
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 4 Dec 2011 00:36:18 +0000 (00:36 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 21 Jan 2012 13:10:01 +0000 (13:10 +0000)
In preparation for the addition of runtime PM ops.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/spi/spi-s3c64xx.c

index d56066bcbb94f32ccd8d6045843bc41e39254d60..56dbdf15cba14c0364913dd97dfb9bde1238f405 100644 (file)
@@ -1231,9 +1231,9 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-static int s3c64xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
+static int s3c64xx_spi_suspend(struct device *dev)
 {
-       struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
+       struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
        struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
        unsigned long flags;
 
@@ -1253,9 +1253,10 @@ static int s3c64xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
        return 0;
 }
 
-static int s3c64xx_spi_resume(struct platform_device *pdev)
+static int s3c64xx_spi_resume(struct device *dev)
 {
-       struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
+       struct platform_device *pdev = to_platform_device(dev);
+       struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
        struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
        struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
        unsigned long flags;
@@ -1274,19 +1275,19 @@ static int s3c64xx_spi_resume(struct platform_device *pdev)
 
        return 0;
 }
-#else
-#define s3c64xx_spi_suspend    NULL
-#define s3c64xx_spi_resume     NULL
 #endif /* CONFIG_PM */
 
+static const struct dev_pm_ops s3c64xx_spi_pm = {
+       SET_SYSTEM_SLEEP_PM_OPS(s3c64xx_spi_suspend, s3c64xx_spi_resume)
+};
+
 static struct platform_driver s3c64xx_spi_driver = {
        .driver = {
                .name   = "s3c64xx-spi",
                .owner = THIS_MODULE,
+               .pm = &s3c64xx_spi_pm,
        },
        .remove = s3c64xx_spi_remove,
-       .suspend = s3c64xx_spi_suspend,
-       .resume = s3c64xx_spi_resume,
 };
 MODULE_ALIAS("platform:s3c64xx-spi");