From patchwork Mon Feb 10 16:12:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3620411 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 CA7B0BF418 for ; Mon, 10 Feb 2014 16:19:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B99D020148 for ; Mon, 10 Feb 2014 16:19:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9AE4F201DD for ; Mon, 10 Feb 2014 16:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbaBJQS4 (ORCPT ); Mon, 10 Feb 2014 11:18:56 -0500 Received: from qmta09.emeryville.ca.mail.comcast.net ([76.96.30.96]:38400 "EHLO qmta09.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752627AbaBJQSv (ORCPT ); Mon, 10 Feb 2014 11:18:51 -0500 X-Greylist: delayed 366 seconds by postgrey-1.27 at vger.kernel.org; Mon, 10 Feb 2014 11:18:49 EST Received: from omta10.emeryville.ca.mail.comcast.net ([76.96.30.28]) by qmta09.emeryville.ca.mail.comcast.net with comcast id Qfx21n0070cQ2SLA9gClFA; Mon, 10 Feb 2014 16:12:45 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta10.emeryville.ca.mail.comcast.net with comcast id QgCi1n00V0MU7Qa8WgCkcz; Mon, 10 Feb 2014 16:12:45 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id EAED04024C; Mon, 10 Feb 2014 09:12:43 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, davidb@codeaurora.org, dwalker@fifo99.com, bryanh@codeaurora.org, chris@printf.net Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mmc@vger.kernel.org, shuahkhan@gmail.com Subject: [RFT][PATCH 09/12] mmc: change msm_sdcc platform power management to use dev_pm_ops Date: Mon, 10 Feb 2014 09:12:32 -0700 Message-Id: <269a4afb048513de75cf39b228e94a4578bbacc7.1392040068.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=1392048765; bh=JvNKLi5CIqfbBc8QwDKoWNi8fv841A4/rFHovvSWXdo=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=WvaypQix/CC6UIXa+vFVmXKBzM6hlqZDSNCp93FuoODMXNS5VdRi1FTNRROPR6jlv lwfvgQNI/0ErdcFU/TryMnRVkifMwVX45yliRJLhc3BgZu5vjgfDJULJtx48EBgCMy ZXUtwAr/0my+lvN4RSqRaUu91f5nvxkTaK93sp7SGy3ZjGsccedD+SrayyHX8yD4y1 n6YJUwxzV/xEwvbBYwlmT4REjGOewvx2e0lQidEMwLIAim75dMI2X4yHUdTzYp0KZp TSHWEH33eQW8BNNzsS97IiwqRDhaQBBEB///llROhnIlZSt9x2ha0RUVSN9GjC2qbV 2KbXS22x/f+zQ== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, KHOP_BIG_TO_CC,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 msm_sdcc 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/msm_sdcc.c | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c index 9405ecd..311e32a 100644 --- a/drivers/mmc/host/msm_sdcc.c +++ b/drivers/mmc/host/msm_sdcc.c @@ -1417,7 +1417,7 @@ ioremap_free: #ifdef CONFIG_PM static int -msmsdcc_suspend(struct platform_device *dev, pm_message_t state) +__msmsdcc_suspend(struct platform_device *dev, pm_message_t state) { struct mmc_host *mmc = mmc_get_drvdata(dev); @@ -1434,8 +1434,23 @@ msmsdcc_suspend(struct platform_device *dev, pm_message_t state) return 0; } +static int msmsdcc_suspend(struct device *dev) +{ + return __msmsdcc_suspend(to_platform_device(dev), PMSG_SUSPEND); +} + +static int msmsdcc_freeze(struct device *dev) +{ + return __msmsdcc_suspend(to_platform_device(dev), PMSG_FREEZE); +} + +static int msmsdcc_poweroff(struct device *dev) +{ + return __msmsdcc_suspend(to_platform_device(dev), PMSG_HIBERNATE); +} + static int -msmsdcc_resume(struct platform_device *dev) +__msmsdcc_resume(struct platform_device *dev) { struct mmc_host *mmc = mmc_get_drvdata(dev); @@ -1454,17 +1469,30 @@ msmsdcc_resume(struct platform_device *dev) } return 0; } -#else -#define msmsdcc_suspend 0 -#define msmsdcc_resume 0 + +static int msmsdcc_resume(struct device *dev) +{ + return __msmsdcc_resume(to_platform_device(dev)); +} + +static const struct dev_pm_ops msmsdcc_dev_pm_ops = { + .suspend = msmsdcc_suspend, + .resume = msmsdcc_resume, + /* Hibernate hooks */ + .freeze = msmsdcc_freeze, + .thaw = msmsdcc_resume, + .poweroff = msmsdcc_poweroff, + .restore = msmsdcc_resume, +}; #endif static struct platform_driver msmsdcc_driver = { .probe = msmsdcc_probe, - .suspend = msmsdcc_suspend, - .resume = msmsdcc_resume, .driver = { .name = "msm_sdcc", +#ifdef CONFIG_PM + .pm = &msmsdcc_dev_pm_ops, +#endif }, };