lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 10 Feb 2014 09:12:32 -0700
From:	Shuah Khan <shuah.kh@...sung.com>
To:	rjw@...ysocki.net, davidb@...eaurora.org, dwalker@...o99.com,
	bryanh@...eaurora.org, chris@...ntf.net
Cc:	Shuah Khan <shuah.kh@...sung.com>, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
	linux-mmc@...r.kernel.org, shuahkhan@...il.com
Subject: [RFT][PATCH 09/12] mmc: change msm_sdcc platform power management to use dev_pm_ops

Change msm_sdcc 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@...sung.com>
---
 drivers/mmc/host/msm_sdcc.c |   42 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 9405ecd..311e32a 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -1417,7 +1417,7 @@ ioremap_free:
 
 #ifdef CONFIG_PM
 static int
-msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
+__msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct mmc_host *mmc = mmc_get_drvdata(dev);
 
@@ -1434,8 +1434,23 @@ msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
+static int msmsdcc_suspend(struct device *dev)
+{
+	return __msmsdcc_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int msmsdcc_freeze(struct device *dev)
+{
+	return __msmsdcc_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int msmsdcc_poweroff(struct device *dev)
+{
+	return __msmsdcc_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
 static int
-msmsdcc_resume(struct platform_device *dev)
+__msmsdcc_resume(struct platform_device *dev)
 {
 	struct mmc_host *mmc = mmc_get_drvdata(dev);
 
@@ -1454,17 +1469,30 @@ msmsdcc_resume(struct platform_device *dev)
 	}
 	return 0;
 }
-#else
-#define msmsdcc_suspend	0
-#define msmsdcc_resume 0
+
+static int msmsdcc_resume(struct device *dev)
+{
+	return __msmsdcc_resume(to_platform_device(dev));
+}
+
+static const struct dev_pm_ops msmsdcc_dev_pm_ops = {
+	.suspend = msmsdcc_suspend,
+	.resume = msmsdcc_resume,
+	/* Hibernate hooks */
+	.freeze = msmsdcc_freeze,
+	.thaw = msmsdcc_resume,
+	.poweroff = msmsdcc_poweroff,
+	.restore = msmsdcc_resume,
+};
 #endif
 
 static struct platform_driver msmsdcc_driver = {
 	.probe		= msmsdcc_probe,
-	.suspend	= msmsdcc_suspend,
-	.resume		= msmsdcc_resume,
 	.driver		= {
 		.name	= "msm_sdcc",
+#ifdef CONFIG_PM
+		.pm	= &msmsdcc_dev_pm_ops,
+#endif
 	},
 };
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ