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:15:43 -0700
From:	Shuah Khan <shuah.kh@...sung.com>
To:	rjw@...ysocki.net, ingo.tuchscherer@...ibm.com,
	schwidefsky@...ibm.com, heiko.carstens@...ibm.com
Cc:	Shuah Khan <shuah.kh@...sung.com>, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux390@...ibm.com,
	linux-s390@...r.kernel.org, shuahkhan@...il.com
Subject: [RFT][PATCH 12/12] drivers/s390/crypto: change ap_bus driver power management to use dev_pm_ops

Change ap_bus 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/s390/crypto/ap_bus.c |   30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index ab3baa7..c39c917 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -799,7 +799,7 @@ static int ap_uevent (struct device *dev, struct kobj_uevent_env *env)
 	return retval;
 }
 
-static int ap_bus_suspend(struct device *dev, pm_message_t state)
+static int __ap_bus_suspend(struct device *dev, pm_message_t state)
 {
 	struct ap_device *ap_dev = to_ap_dev(dev);
 	unsigned long flags;
@@ -833,6 +833,21 @@ static int ap_bus_suspend(struct device *dev, pm_message_t state)
 	return 0;
 }
 
+static int ap_bus_suspend(struct device *dev)
+{
+	return __ap_bus_suspend(dev, PMSG_SUSPEND);
+}
+
+static int ap_bus_freeze(struct device *dev)
+{
+	return __ap_bus_suspend(dev, PMSG_FREEZE);
+}
+
+static int ap_bus_poweroff(struct device *dev)
+{
+	return __ap_bus_suspend(dev, PMSG_HIBERNATE);
+}
+
 static int ap_bus_resume(struct device *dev)
 {
 	struct ap_device *ap_dev = to_ap_dev(dev);
@@ -886,12 +901,21 @@ static int ap_bus_resume(struct device *dev)
 	return rc;
 }
 
+static const struct dev_pm_ops ap_bus_dev_pm_ops = {
+	.suspend = ap_bus_suspend,
+	.resume = ap_bus_resume,
+	/* Hibernate callbacks */
+	.freeze = ap_bus_freeze,
+	.thaw = ap_bus_resume,
+	.poweroff = ap_bus_poweroff,
+	.restore = ap_bus_resume,
+};
+
 static struct bus_type ap_bus_type = {
 	.name = "ap",
 	.match = &ap_bus_match,
 	.uevent = &ap_uevent,
-	.suspend = ap_bus_suspend,
-	.resume = ap_bus_resume
+	.pm = &ap_bus_dev_pm_ops,
 };
 
 static int ap_device_probe(struct device *dev)
-- 
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