aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-atmel.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-09-09 04:54:12 -0400
committerMark Brown <broonie@linaro.org>2013-09-16 19:13:57 -0400
commitec60dd37e1d907d0524fa4c5806ecf24b16ea712 (patch)
treeb15ff3f9fe7e60f6706ecc5d4a860812ed629614 /drivers/spi/spi-atmel.c
parent272b98c6455f00884f0350f775c5342358ebb73f (diff)
spi: atmel: 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. Also, duplicated 'return' is removed from atmel_spi_resume(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-atmel.c')
-rw-r--r--drivers/spi/spi-atmel.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index fd7cc566095a..3daf754f96f8 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1675,29 +1675,30 @@ static int atmel_spi_remove(struct platform_device *pdev)
1675 return 0; 1675 return 0;
1676} 1676}
1677 1677
1678#ifdef CONFIG_PM 1678#ifdef CONFIG_PM_SLEEP
1679 1679static int atmel_spi_suspend(struct device *dev)
1680static int atmel_spi_suspend(struct platform_device *pdev, pm_message_t mesg)
1681{ 1680{
1682 struct spi_master *master = platform_get_drvdata(pdev); 1681 struct spi_master *master = dev_get_drvdata(dev);
1683 struct atmel_spi *as = spi_master_get_devdata(master); 1682 struct atmel_spi *as = spi_master_get_devdata(master);
1684 1683
1685 clk_disable_unprepare(as->clk); 1684 clk_disable_unprepare(as->clk);
1686 return 0; 1685 return 0;
1687} 1686}
1688 1687
1689static int atmel_spi_resume(struct platform_device *pdev) 1688static int atmel_spi_resume(struct device *dev)
1690{ 1689{
1691 struct spi_master *master = platform_get_drvdata(pdev); 1690 struct spi_master *master = dev_get_drvdata(dev);
1692 struct atmel_spi *as = spi_master_get_devdata(master); 1691 struct atmel_spi *as = spi_master_get_devdata(master);
1693 1692
1694 return clk_prepare_enable(as->clk); 1693 clk_prepare_enable(as->clk);
1695 return 0; 1694 return 0;
1696} 1695}
1697 1696
1697static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume);
1698
1699#define ATMEL_SPI_PM_OPS (&atmel_spi_pm_ops)
1698#else 1700#else
1699#define atmel_spi_suspend NULL 1701#define ATMEL_SPI_PM_OPS NULL
1700#define atmel_spi_resume NULL
1701#endif 1702#endif
1702 1703
1703#if defined(CONFIG_OF) 1704#if defined(CONFIG_OF)
@@ -1713,10 +1714,9 @@ static struct platform_driver atmel_spi_driver = {
1713 .driver = { 1714 .driver = {
1714 .name = "atmel_spi", 1715 .name = "atmel_spi",
1715 .owner = THIS_MODULE, 1716 .owner = THIS_MODULE,
1717 .pm = ATMEL_SPI_PM_OPS,
1716 .of_match_table = of_match_ptr(atmel_spi_dt_ids), 1718 .of_match_table = of_match_ptr(atmel_spi_dt_ids),
1717 }, 1719 },
1718 .suspend = atmel_spi_suspend,
1719 .resume = atmel_spi_resume,
1720 .probe = atmel_spi_probe, 1720 .probe = atmel_spi_probe,
1721 .remove = atmel_spi_remove, 1721 .remove = atmel_spi_remove,
1722}; 1722};