diff mbox

[RFT,12/12] drivers/s390/crypto: change ap_bus driver power management to use dev_pm_ops

Message ID 8c806d9343e9b28ee505908d6171e99032a5bf52.1392040068.git.shuah.kh@samsung.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Shuah Khan Feb. 10, 2014, 4:15 p.m. UTC
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@samsung.com>
---
 drivers/s390/crypto/ap_bus.c |   30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)
diff mbox

Patch

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)