From patchwork Tue Feb 11 20:16:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3631291 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 184BB9F39E for ; Tue, 11 Feb 2014 20:17:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43642201CE for ; Tue, 11 Feb 2014 20:17:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 689B42020A for ; Tue, 11 Feb 2014 20:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756124AbaBKUQo (ORCPT ); Tue, 11 Feb 2014 15:16:44 -0500 Received: from qmta01.emeryville.ca.mail.comcast.net ([76.96.30.16]:53275 "EHLO qmta01.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755195AbaBKUQl (ORCPT ); Tue, 11 Feb 2014 15:16:41 -0500 Received: from omta15.emeryville.ca.mail.comcast.net ([76.96.30.71]) by qmta01.emeryville.ca.mail.comcast.net with comcast id R3Wp1n0041Y3wxoA18Gfy2; Tue, 11 Feb 2014 20:16:39 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta15.emeryville.ca.mail.comcast.net with comcast id R8Gd1n00w0MU7Qa8b8Gekw; Tue, 11 Feb 2014 20:16:39 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 22BC740229; Tue, 11 Feb 2014 13:16:37 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, mirq-linux@rere.qmqm.pl, 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 v2] mmc: change cb710-mmc platform power management to use dev_pm_ops Date: Tue, 11 Feb 2014 13:16:21 -0700 Message-Id: <1392149781-4991-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=1392149799; bh=TAJRGw+LK4PHSrGze05km7JDA3f2Ym4M5XwbjQCgVKQ=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=F2OsV9YpiVbuFdrjzPw3ZxUZyQreTHBvHSPU3U55bwXQMdgjxCO+Ejy+XEz10K+6O PGLOdJDaKArsmzxu92SJ08yV+9TXltvMucuQ9vVPwirvF4y6Hla/EX0zN/hZdEo88q ffD1sFx4XcN6Ce9GGC7sAULPRBLWMU5434WvPr85HWJUtY7lIMEj0pAdc8iIyZfap2 BDvag3OYCDRyEgMDRBTv3YU+Q1+nZAJWaCtYPLipxp+C5ZqDP6IHuppgvJ9lGmxijP Al9sz9r49BX0yIRthMyWYydaOmlK9Gfu5OgBHP2pj8QHJlgBG7AVy+hyZrcvGTx11C HtMf9040u2mSA== 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. Signed-off-by: Shuah Khan --- patch v2: Addresses review comments on patch v1 drivers/mmc/host/cb710-mmc.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c index 1087b4c..ccf7a75 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,13 +742,31 @@ static int cb710_mmc_exit(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +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; +} + +static const struct dev_pm_ops cb710_mmc_dev_pm_ops = { + .suspend = cb710_mmc_suspend_resume, + .resume = cb710_mmc_suspend_resume, + /* Hibernate hooks */ + .freeze = cb710_mmc_suspend_resume, + .thaw = cb710_mmc_suspend_resume, + .poweroff = cb710_mmc_suspend_resume, + .restore = cb710_mmc_suspend_resume, +}; +#endif 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, + .driver.pm = &cb710_mmc_dev_pm_ops, #endif };