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:31 -0700
From:	Shuah Khan <shuah.kh@...sung.com>
To:	rjw@...ysocki.net, mirq-linux@...e.qmqm.pl, chris@...ntf.net
Cc:	Shuah Khan <shuah.kh@...sung.com>, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-mmc@...r.kernel.org,
	shuahkhan@...il.com
Subject: [RFT][PATCH 08/12] mmc: change cb710-mmc platform power management to use dev_pm_ops

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@...sung.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

--
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