spi: bfin-sport: convert from legacy pm ops to dev_pm_ops
authorJingoo Han <jg1.han@samsung.com>
Mon, 9 Sep 2013 08:56:17 +0000 (17:56 +0900)
committerMark Brown <broonie@linaro.org>
Mon, 16 Sep 2013 23:15:56 +0000 (00:15 +0100)
Instead of using legacy suspend/resume methods, using newer
dev_pm_ops structure allows better control over power management.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-bfin-sport.c

index 91921b5f58171fcd8de5faf0d33099f8fc490f2f..6c81a5978ecae0fa0a9ac40a383f45a159ac8a31 100644 (file)
@@ -879,11 +879,10 @@ static int bfin_sport_spi_remove(struct platform_device *pdev)
        return 0;
 }
 
-#ifdef CONFIG_PM
-static int
-bfin_sport_spi_suspend(struct platform_device *pdev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int bfin_sport_spi_suspend(struct device *dev)
 {
-       struct bfin_sport_spi_master_data *drv_data = platform_get_drvdata(pdev);
+       struct bfin_sport_spi_master_data *drv_data = dev_get_drvdata(dev);
        int status;
 
        status = bfin_sport_spi_stop_queue(drv_data);
@@ -896,10 +895,9 @@ bfin_sport_spi_suspend(struct platform_device *pdev, pm_message_t state)
        return status;
 }
 
-static int
-bfin_sport_spi_resume(struct platform_device *pdev)
+static int bfin_sport_spi_resume(struct device *dev)
 {
-       struct bfin_sport_spi_master_data *drv_data = platform_get_drvdata(pdev);
+       struct bfin_sport_spi_master_data *drv_data = dev_get_drvdata(dev);
        int status;
 
        /* Enable the SPI interface */
@@ -912,19 +910,22 @@ bfin_sport_spi_resume(struct platform_device *pdev)
 
        return status;
 }
+
+static SIMPLE_DEV_PM_OPS(bfin_sport_spi_pm_ops, bfin_sport_spi_suspend,
+                       bfin_sport_spi_resume);
+
+#define BFIN_SPORT_SPI_PM_OPS          (&bfin_sport_spi_pm_ops)
 #else
-# define bfin_sport_spi_suspend NULL
-# define bfin_sport_spi_resume  NULL
+#define BFIN_SPORT_SPI_PM_OPS          NULL
 #endif
 
 static struct platform_driver bfin_sport_spi_driver = {
        .driver = {
-               .name = DRV_NAME,
-               .owner = THIS_MODULE,
+               .name   = DRV_NAME,
+               .owner  = THIS_MODULE,
+               .pm     = BFIN_SPORT_SPI_PM_OPS,
        },
        .probe   = bfin_sport_spi_probe,
        .remove  = bfin_sport_spi_remove,
-       .suspend = bfin_sport_spi_suspend,
-       .resume  = bfin_sport_spi_resume,
 };
 module_platform_driver(bfin_sport_spi_driver);