From patchwork Mon Feb 10 16:15:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3620321 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E748BBF418 for ; Mon, 10 Feb 2014 16:17:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA4ED201B6 for ; Mon, 10 Feb 2014 16:17:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 589D42010F for ; Mon, 10 Feb 2014 16:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726AbaBJQRt (ORCPT ); Mon, 10 Feb 2014 11:17:49 -0500 Received: from qmta11.emeryville.ca.mail.comcast.net ([76.96.27.211]:36343 "EHLO qmta11.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752814AbaBJQRt (ORCPT ); Mon, 10 Feb 2014 11:17:49 -0500 X-Greylist: delayed 307 seconds by postgrey-1.27 at vger.kernel.org; Mon, 10 Feb 2014 11:17:49 EST Received: from omta09.emeryville.ca.mail.comcast.net ([76.96.30.20]) by qmta11.emeryville.ca.mail.comcast.net with comcast id QeLy1n0060S2fkCABgFmmp; Mon, 10 Feb 2014 16:15:46 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta09.emeryville.ca.mail.comcast.net with comcast id QgFk1n00q0MU7Qa8VgFl2V; Mon, 10 Feb 2014 16:15:45 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 6D0CC4024C; Mon, 10 Feb 2014 09:15:44 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, ingo.tuchscherer@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux390@de.ibm.com, linux-s390@vger.kernel.org, shuahkhan@gmail.com Subject: [RFT][PATCH 12/12] drivers/s390/crypto: change ap_bus driver power management to use dev_pm_ops Date: Mon, 10 Feb 2014 09:15:43 -0700 Message-Id: <8c806d9343e9b28ee505908d6171e99032a5bf52.1392040068.git.shuah.kh@samsung.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1392048946; bh=NvI6xDtc/ZFSkgzwq6A5AutXXB77piIXxBl0gCvdGAY=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=WXp6nvfThzNtJ8X9x8D+jJ+Lu8C7JvZOibMzvFEpIkyqnPGHwDVWBjqRSB3oVChFw 6dCyLdA9pLB17gqWXTTpChUJU6ZkTsoVukq6QihAjBdYJbDtkWYdqgp1Aebe+YYbql mQ9M473rbw7moqsSMUOY43tG8L7xM9KcoYOzbpA18aWSYoc0V2nZIXrM9HUWSKGOwb 8mqIHlnA98k3kgf8DDVgK5NZy2JfVEjAg68LNcktFujYAwzX+n9Bl4I+NZ/nPxNJwT PFByfFmXsJq2M2N/3AJfNJ0NgNREhLilKwmiH3JzOcYkvbe9biAuFQdqq8rgUdRMaS kq+lothdUCgHg== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)