From patchwork Mon Feb 10 16:12:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3620461 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 307E4BF418 for ; Mon, 10 Feb 2014 16:19:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C43E820148 for ; Mon, 10 Feb 2014 16:19:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94BEC201B6 for ; Mon, 10 Feb 2014 16:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752190AbaBJQS6 (ORCPT ); Mon, 10 Feb 2014 11:18:58 -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 S1751744AbaBJQSu (ORCPT ); Mon, 10 Feb 2014 11:18:50 -0500 X-Greylist: delayed 366 seconds by postgrey-1.27 at vger.kernel.org; Mon, 10 Feb 2014 11:18:49 EST Received: from omta06.emeryville.ca.mail.comcast.net ([76.96.30.51]) by qmta09.emeryville.ca.mail.comcast.net with comcast id Qf121n00416AWCUA9gClF5; Mon, 10 Feb 2014 16:12:45 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta06.emeryville.ca.mail.comcast.net with comcast id QgCj1n00V0MU7Qa8SgCkQj; Mon, 10 Feb 2014 16:12:44 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 7B02346F1C; Mon, 10 Feb 2014 09:12:43 -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 08/12] mmc: change cb710-mmc platform power management to use dev_pm_ops Date: Mon, 10 Feb 2014 09:12:31 -0700 Message-Id: <5393e4bd34e5667b7d00fa09c9d5bee0f68d659f.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=kBBhOUQJf0RJi27ArMO8IUE+mGmnqNLLCTZtmnYQ/v8=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=JcX4/m2zJMzni/ioZ4jVCGeWY2BYoDayvsBcxyZ5dOwY6hcB6nlbyJT1qK7JjqJbR sZtR0NAI6FSGzhtH1M1j85pl28dC2vhdbyFgvM+775OQTMpD/BWVMfdwbWWbZ/tYyR rEoByhNVy75p3boKnBZeL0DcGjYHjiw63liYsieUAH0ywSR8uBC/7sTovj7RxFGdzZ HpfWPiBz5Frog13T/Kxm+A7/K7h8G5S3O7hf/oTfXbYC1J5PXHZqiSZ6yPPMS7Pzj5 QwfN9rOm3Zopsj3FWo3lfP1U096/NgDahoZzna272agTKwANOg3G98HEvCTAxpQEJi Qxhl7k+jur9Pg== 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. .pm hooks call existing legacy suspend and resume interfaces by passing in the right pm state. Signed-off-by: Shuah Khan --- drivers/mmc/host/cb710-mmc.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c index 1087b4c..00fd93f 100644 --- a/drivers/mmc/host/cb710-mmc.c +++ b/drivers/mmc/host/cb710-mmc.c @@ -664,7 +664,7 @@ static const struct mmc_host_ops cb710_mmc_host = { #ifdef CONFIG_PM -static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state) +static int __cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state) { struct cb710_slot *slot = cb710_pdev_to_slot(pdev); @@ -672,7 +672,22 @@ static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int cb710_mmc_resume(struct platform_device *pdev) +static int cb710_mmc_suspend(struct device *dev) +{ + return __cb710_mmc_suspend(to_platform_device(dev), PMSG_SUSPEND); +} + +static int cb710_mmc_freeze(struct device *dev) +{ + return __cb710_mmc_suspend(to_platform_device(dev), PMSG_FREEZE); +} + +static int cb710_mmc_poweroff(struct device *dev) +{ + return __cb710_mmc_suspend(to_platform_device(dev), PMSG_HIBERNATE); +} + +static int __cb710_mmc_resume(struct platform_device *pdev) { struct cb710_slot *slot = cb710_pdev_to_slot(pdev); @@ -680,6 +695,10 @@ static int cb710_mmc_resume(struct platform_device *pdev) return 0; } +static int cb710_mmc_resume(struct device *dev) +{ + return __cb710_mmc_resume(to_platform_device(dev)); +} #endif /* CONFIG_PM */ static int cb710_mmc_init(struct platform_device *pdev) @@ -762,13 +781,23 @@ static int cb710_mmc_exit(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static const struct dev_pm_ops cb710_mmc_dev_pm_ops = { + .suspend = cb710_mmc_suspend, + .resume = cb710_mmc_resume, + /* Hibernate hooks */ + .freeze = cb710_mmc_freeze, + .thaw = cb710_mmc_resume, + .poweroff = cb710_mmc_poweroff, + .restore = cb710_mmc_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 };