lkml.org 
[lkml]   [2014]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFT][PATCH 08/12] mmc: change cb710-mmc platform power management to use dev_pm_ops
Date
Change cb710-mmc platform driver to register pm ops using dev_pm_ops instead
of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
drivers/mmc/host/cb710-mmc.c | 37 +++++++++++++++++++++++++++++++++----
1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index 1087b4c..00fd93f 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -664,7 +664,7 @@ static const struct mmc_host_ops cb710_mmc_host = {

#ifdef CONFIG_PM

-static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state)
+static int __cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state)
{
struct cb710_slot *slot = cb710_pdev_to_slot(pdev);

@@ -672,7 +672,22 @@ static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}

-static int cb710_mmc_resume(struct platform_device *pdev)
+static int cb710_mmc_suspend(struct device *dev)
+{
+ return __cb710_mmc_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int cb710_mmc_freeze(struct device *dev)
+{
+ return __cb710_mmc_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int cb710_mmc_poweroff(struct device *dev)
+{
+ return __cb710_mmc_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __cb710_mmc_resume(struct platform_device *pdev)
{
struct cb710_slot *slot = cb710_pdev_to_slot(pdev);

@@ -680,6 +695,10 @@ static int cb710_mmc_resume(struct platform_device *pdev)
return 0;
}

+static int cb710_mmc_resume(struct device *dev)
+{
+ return __cb710_mmc_resume(to_platform_device(dev));
+}
#endif /* CONFIG_PM */

static int cb710_mmc_init(struct platform_device *pdev)
@@ -762,13 +781,23 @@ static int cb710_mmc_exit(struct platform_device *pdev)
return 0;
}

+#ifdef CONFIG_PM
+static const struct dev_pm_ops cb710_mmc_dev_pm_ops = {
+ .suspend = cb710_mmc_suspend,
+ .resume = cb710_mmc_resume,
+ /* Hibernate hooks */
+ .freeze = cb710_mmc_freeze,
+ .thaw = cb710_mmc_resume,
+ .poweroff = cb710_mmc_poweroff,
+ .restore = cb710_mmc_resume,
+};
+#endif
static struct platform_driver cb710_mmc_driver = {
.driver.name = "cb710-mmc",
.probe = cb710_mmc_init,
.remove = cb710_mmc_exit,
#ifdef CONFIG_PM
- .suspend = cb710_mmc_suspend,
- .resume = cb710_mmc_resume,
+ .driver.pm = &cb710_mmc_dev_pm_ops,
#endif
};

--
1.7.10.4


\
 
 \ /
  Last update: 2014-02-10 17:41    [W:0.136 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site