From patchwork Wed Feb 12 21:21:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3641131 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 31D6EBF13A for ; Wed, 12 Feb 2014 21:21:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A18F9201D5 for ; Wed, 12 Feb 2014 21:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DEFF20149 for ; Wed, 12 Feb 2014 21:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754462AbaBLVVi (ORCPT ); Wed, 12 Feb 2014 16:21:38 -0500 Received: from qmta11.emeryville.ca.mail.comcast.net ([76.96.27.211]:55540 "EHLO qmta11.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753892AbaBLVVi (ORCPT ); Wed, 12 Feb 2014 16:21:38 -0500 Received: from omta24.emeryville.ca.mail.comcast.net ([76.96.30.92]) by qmta11.emeryville.ca.mail.comcast.net with comcast id RTjP1n0031zF43QABZMdVR; Wed, 12 Feb 2014 21:21:37 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta24.emeryville.ca.mail.comcast.net with comcast id RZMa1n00X0MU7Qa8kZMb6C; Wed, 12 Feb 2014 21:21:37 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 49BFD40229; Wed, 12 Feb 2014 14:21:34 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, mirq-linux@rere.qmqm.pl, ulf.hansson@linaro.org, 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 v3] mmc: change cb710-mmc platform power management to use dev_pm_ops Date: Wed, 12 Feb 2014 14:21:29 -0700 Message-Id: <1392240089-19489-1-git-send-email-shuah.kh@samsung.com> X-Mailer: git-send-email 1.8.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1392240097; bh=JxgbTqUu1m9GIYIMkFJzS+9Xz/BVE9wiF6eWyJF32OY=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=RL1Ht/mVeFFk44fAa56N/pQi7tNAuZe0d8kL3/EO+SFmPixKV3bGhjrfmgs8BNbeb 8HBxlkYSndb196aeSHlEqUlYWmiYYoyIVsgTgUYAvCU0p+n6NFuO8Yzkh0eON707pZ HoK/xyPPrUQ6VpMxxXR/9PmtbVF50/pP3Mrh8WBW8GwQoRahld9wvxGZlqxgN9JFbr MXRUBGoDf4sUU2NLeGErfQpS29HTwhnmEObsQ0lU37kJ7kKcKi7DAfgbBdLWp7vbj+ 9y+Z5q9tpNuTFEhnGnudpPsWNFGSVA1i7WS+pFSx08//+A7EhHPjfXvyYSGljnkycp 4u0qaEM7Z0eUQ== 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 cb710-mmc platform driver to register pm ops using dev_pm_ops instead of legacy pm_ops. The existing legacy suspend/resume routines are identical and simply clear IRQ mask in the device in case it got undefined during sleep state. Changed code to collapse suspend and resume into one .pm interface for suspend and resume which gets installed for suspend, freeze, poweroff, thaw, restore, and resume states using SIMPLE_DEV_PM_OPS(). Signed-off-by: Shuah Khan --- patch v3: Addresses review comments on patch v2 drivers/mmc/host/cb710-mmc.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c index 1087b4c..2dc7b2dc 100644 --- a/drivers/mmc/host/cb710-mmc.c +++ b/drivers/mmc/host/cb710-mmc.c @@ -662,26 +662,6 @@ static const struct mmc_host_ops cb710_mmc_host = { .get_cd = cb710_mmc_get_cd, }; -#ifdef CONFIG_PM - -static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state) -{ - struct cb710_slot *slot = cb710_pdev_to_slot(pdev); - - cb710_mmc_enable_irq(slot, 0, ~0); - return 0; -} - -static int cb710_mmc_resume(struct platform_device *pdev) -{ - struct cb710_slot *slot = cb710_pdev_to_slot(pdev); - - cb710_mmc_enable_irq(slot, 0, ~0); - return 0; -} - -#endif /* CONFIG_PM */ - static int cb710_mmc_init(struct platform_device *pdev) { struct cb710_slot *slot = cb710_pdev_to_slot(pdev); @@ -762,14 +742,26 @@ static int cb710_mmc_exit(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int cb710_mmc_suspend_resume(struct device *dev) +{ + struct cb710_slot *slot = cb710_pdev_to_slot(to_platform_device(dev)); + + cb710_mmc_enable_irq(slot, 0, ~0); + return 0; +} +#else +#define cb710_mmc_suspend_resume NULL +#endif + +static SIMPLE_DEV_PM_OPS(cb710_mmc_dev_pm_ops, cb710_mmc_suspend_resume, + cb710_mmc_suspend_resume); + static struct platform_driver cb710_mmc_driver = { .driver.name = "cb710-mmc", .probe = cb710_mmc_init, .remove = cb710_mmc_exit, -#ifdef CONFIG_PM - .suspend = cb710_mmc_suspend, - .resume = cb710_mmc_resume, -#endif + .driver.pm = &cb710_mmc_dev_pm_ops, }; module_platform_driver(cb710_mmc_driver);