aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-09-09 04:55:32 -0400
committerMark Brown <broonie@linaro.org>2013-09-16 19:15:56 -0400
commitfbbfd68bc00d7bf431042b2e92cc4e540b827f67 (patch)
tree2b5295eb8a87f5d48c3e28655454839171477b4c
parent272b98c6455f00884f0350f775c5342358ebb73f (diff)
spi: bfin5xx: convert from legacy pm ops to dev_pm_ops
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>
-rw-r--r--drivers/spi/spi-bfin5xx.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c
index 45bdf73d6868..1e2894315bb0 100644
--- a/drivers/spi/spi-bfin5xx.c
+++ b/drivers/spi/spi-bfin5xx.c
@@ -1410,10 +1410,10 @@ static int bfin_spi_remove(struct platform_device *pdev)
1410 return 0; 1410 return 0;
1411} 1411}
1412 1412
1413#ifdef CONFIG_PM 1413#ifdef CONFIG_PM_SLEEP
1414static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state) 1414static int bfin_spi_suspend(struct device *dev)
1415{ 1415{
1416 struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev); 1416 struct bfin_spi_master_data *drv_data = dev_get_drvdata(dev);
1417 int status = 0; 1417 int status = 0;
1418 1418
1419 status = bfin_spi_stop_queue(drv_data); 1419 status = bfin_spi_stop_queue(drv_data);
@@ -1432,9 +1432,9 @@ static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state)
1432 return 0; 1432 return 0;
1433} 1433}
1434 1434
1435static int bfin_spi_resume(struct platform_device *pdev) 1435static int bfin_spi_resume(struct device *dev)
1436{ 1436{
1437 struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev); 1437 struct bfin_spi_master_data *drv_data = dev_get_drvdata(dev);
1438 int status = 0; 1438 int status = 0;
1439 1439
1440 bfin_write(&drv_data->regs->ctl, drv_data->ctrl_reg); 1440 bfin_write(&drv_data->regs->ctl, drv_data->ctrl_reg);
@@ -1443,25 +1443,27 @@ static int bfin_spi_resume(struct platform_device *pdev)
1443 /* Start the queue running */ 1443 /* Start the queue running */
1444 status = bfin_spi_start_queue(drv_data); 1444 status = bfin_spi_start_queue(drv_data);
1445 if (status != 0) { 1445 if (status != 0) {
1446 dev_err(&pdev->dev, "problem starting queue (%d)\n", status); 1446 dev_err(dev, "problem starting queue (%d)\n", status);
1447 return status; 1447 return status;
1448 } 1448 }
1449 1449
1450 return 0; 1450 return 0;
1451} 1451}
1452
1453static SIMPLE_DEV_PM_OPS(bfin_spi_pm_ops, bfin_spi_suspend, bfin_spi_resume);
1454
1455#define BFIN_SPI_PM_OPS (&bfin_spi_pm_ops)
1452#else 1456#else
1453#define bfin_spi_suspend NULL 1457#define BFIN_SPI_PM_OPS NULL
1454#define bfin_spi_resume NULL 1458#endif
1455#endif /* CONFIG_PM */
1456 1459
1457MODULE_ALIAS("platform:bfin-spi"); 1460MODULE_ALIAS("platform:bfin-spi");
1458static struct platform_driver bfin_spi_driver = { 1461static struct platform_driver bfin_spi_driver = {
1459 .driver = { 1462 .driver = {
1460 .name = DRV_NAME, 1463 .name = DRV_NAME,
1461 .owner = THIS_MODULE, 1464 .owner = THIS_MODULE,
1465 .pm = BFIN_SPI_PM_OPS,
1462 }, 1466 },
1463 .suspend = bfin_spi_suspend,
1464 .resume = bfin_spi_resume,
1465 .remove = bfin_spi_remove, 1467 .remove = bfin_spi_remove,
1466}; 1468};
1467 1469