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 <[email protected]>
---
 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to