From patchwork Mon Feb 10 16:12:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3620351 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 34C7CC02E3 for ; Mon, 10 Feb 2014 16:18:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DF71201D5 for ; Mon, 10 Feb 2014 16:18:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2F81201DD for ; Mon, 10 Feb 2014 16:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752681AbaBJQSv (ORCPT ); Mon, 10 Feb 2014 11:18:51 -0500 Received: from qmta14.emeryville.ca.mail.comcast.net ([76.96.27.212]:56601 "EHLO qmta14.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752317AbaBJQSt (ORCPT ); Mon, 10 Feb 2014 11:18:49 -0500 Received: from omta10.emeryville.ca.mail.comcast.net ([76.96.30.28]) by qmta14.emeryville.ca.mail.comcast.net with comcast id QeTa1n0090cQ2SLAEgCjGU; Mon, 10 Feb 2014 16:12:43 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta10.emeryville.ca.mail.comcast.net with comcast id QgCi1n00V0MU7Qa8WgCica; Mon, 10 Feb 2014 16:12:43 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 199BD402AE; Mon, 10 Feb 2014 09:12:42 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, manuel.lauss@gmail.com, chris@printf.net Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, shuahkhan@gmail.com Subject: [RFT][PATCH 05/12] mmc: change au1xmmc platform power management to use dev_pm_ops Date: Mon, 10 Feb 2014 09:12:28 -0700 Message-Id: <73aacb87b305ccffbb75dadd9c89da73f6592d6d.1392040067.git.shuah.kh@samsung.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1392048763; bh=CJCQzS//ak/PAU4tYnkOX+pd6CBQeq3VXLRew7xEnBA=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=VDkZP6k/yKc61NW8pB97/OfU/7csRUEAkPjBMxSIaMshoLFMme/u5K9kWH1EDHWQR gmOltlM+TM5AEEsVH7T78AFu0iiNdHnO5walX9GhSCjaLAUlioJmEdGXOHlusWhPAk pGzW6rjcBk8bJS/paIG+BXyxHxEyZQqraWKNKs3/nqJTIoDywey94uuA/gTGwVJw0n XwyZkmIBpu6zgkpVbKTFD9uCFBmEFUWqumB9GrI6PZEatwf8gDIAa882Scju6j6HdB pCPWB9ZUHFIMsghUEvSsDtBtLA+iNI/piBnOzBRqVCZKsoJjYYCQSwzDbEhqnCvYsB G9hjczba8T/Xw== 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 au1xmmc 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 --- drivers/mmc/host/au1xmmc.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index f5443a6..1601f39 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -1154,7 +1154,7 @@ static int au1xmmc_remove(struct platform_device *pdev) } #ifdef CONFIG_PM -static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state) +static int __au1xmmc_suspend(struct platform_device *pdev, pm_message_t state) { struct au1xmmc_host *host = platform_get_drvdata(pdev); @@ -1167,7 +1167,22 @@ static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int au1xmmc_resume(struct platform_device *pdev) +static int au1xmmc_suspend(struct device *dev) +{ + return __au1xmmc_suspend(to_platform_device(dev), PMSG_SUSPEND); +} + +static int au1xmmc_freeze(struct device *dev) +{ + return __au1xmmc_suspend(to_platform_device(dev), PMSG_FREEZE); +} + +static int au1xmmc_poweroff(struct device *dev) +{ + return __au1xmmc_suspend(to_platform_device(dev), PMSG_HIBERNATE); +} + +static int __au1xmmc_resume(struct platform_device *pdev) { struct au1xmmc_host *host = platform_get_drvdata(pdev); @@ -1175,19 +1190,31 @@ static int au1xmmc_resume(struct platform_device *pdev) return 0; } -#else -#define au1xmmc_suspend NULL -#define au1xmmc_resume NULL -#endif +static int au1xmmc_resume(struct device *dev) +{ + return __au1xmmc_resume(to_platform_device(dev)); +} + +static const struct dev_pm_ops au1xmmc_dev_pm_ops = { + .suspend = au1xmmc_suspend, + .resume = au1xmmc_resume, + /* Hibernate hooks */ + .freeze = au1xmmc_freeze, + .thaw = au1xmmc_resume, + .poweroff = au1xmmc_poweroff, + .restore = au1xmmc_resume, +}; +#endif static struct platform_driver au1xmmc_driver = { .probe = au1xmmc_probe, .remove = au1xmmc_remove, - .suspend = au1xmmc_suspend, - .resume = au1xmmc_resume, .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &au1xmmc_dev_pm_ops, +#endif }, };