From patchwork Mon Feb 10 16:15:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3620471 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 7FB2F9F382 for ; Mon, 10 Feb 2014 16:19:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C13E201D3 for ; Mon, 10 Feb 2014 16:19:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BDF3120148 for ; Mon, 10 Feb 2014 16:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752547AbaBJQTN (ORCPT ); Mon, 10 Feb 2014 11:19:13 -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 S1752098AbaBJQTM (ORCPT ); Mon, 10 Feb 2014 11:19:12 -0500 X-Greylist: delayed 366 seconds by postgrey-1.27 at vger.kernel.org; Mon, 10 Feb 2014 11:18:49 EST Received: from omta13.emeryville.ca.mail.comcast.net ([76.96.30.52]) by qmta09.emeryville.ca.mail.comcast.net with comcast id Qfbc1n00317UAYkA9gF9ju; Mon, 10 Feb 2014 16:15:09 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta13.emeryville.ca.mail.comcast.net with comcast id QgF71n00Q0MU7Qa8ZgF8MJ; Mon, 10 Feb 2014 16:15:08 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 43AEF4024C; Mon, 10 Feb 2014 09:15:06 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, ian@mnementh.co.uk, 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 10/12] mmc: change tmio_mmc platform power management to use dev_pm_ops Date: Mon, 10 Feb 2014 09:15:04 -0700 Message-Id: X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1392048909; bh=1+MmQ7RmNO2inH4Xwo207R7Dx4OhBlPywChn7fbWBuw=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=dSs+scu1bi/pwkLnGhX5fk4Or3y2r7tD7pa3jB+36FV+faUIPnYOyCIYv7/P/50mz e99Q8L6GXUhF08BYEO0Q9REjbuG8xwJWIe8MuE+xCPX6gtc3FW2W1PVXCZi1CZ7JMS M6zEhqr8VEbkMdMxBZp7vdEMOXlkyMSNGfYZR8cUMc8uyJH723ybVK4O76gVXn8pSX wXVsiL1ayITgAsAE7CjZ0505XO01W/l7+VLZnfg0iaQ3eVuQRa/phFfvMGuY2nIREC H/F08uxD0cJyz9rWWCuoEIb2QgoxlIqP4iLMUmbAaIcnT2OHv27OZhrxIAdQY8wO3N qKKQG4kylVmcQ== 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 tmio_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/tmio_mmc.c | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index 1900abb..e9b0a06 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -24,7 +24,7 @@ #include "tmio_mmc.h" #ifdef CONFIG_PM -static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state) +static int __tmio_mmc_suspend(struct platform_device *dev, pm_message_t state) { const struct mfd_cell *cell = mfd_get_cell(dev); int ret; @@ -38,7 +38,22 @@ static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state) return ret; } -static int tmio_mmc_resume(struct platform_device *dev) +static int tmio_mmc_suspend(struct device *dev) +{ + return __tmio_mmc_suspend(to_platform_device(dev), PMSG_SUSPEND); +} + +static int tmio_mmc_freeze(struct device *dev) +{ + return __tmio_mmc_suspend(to_platform_device(dev), PMSG_FREEZE); +} + +static int tmio_mmc_poweroff(struct device *dev) +{ + return __tmio_mmc_suspend(to_platform_device(dev), PMSG_HIBERNATE); +} + +static int __tmio_mmc_resume(struct platform_device *dev) { const struct mfd_cell *cell = mfd_get_cell(dev); int ret = 0; @@ -52,9 +67,21 @@ static int tmio_mmc_resume(struct platform_device *dev) return ret; } -#else -#define tmio_mmc_suspend NULL -#define tmio_mmc_resume NULL + +static int tmio_mmc_resume(struct device *dev) +{ + return __tmio_mmc_resume(to_platform_device(dev)); +} + +static const struct dev_pm_ops tmio_mmc_dev_pm_ops = { + .suspend = tmio_mmc_suspend, + .resume = tmio_mmc_resume, + /* Hibernate hooks */ + .freeze = tmio_mmc_freeze, + .thaw = tmio_mmc_resume, + .poweroff = tmio_mmc_poweroff, + .restore = tmio_mmc_resume, +}; #endif static int tmio_mmc_probe(struct platform_device *pdev) @@ -138,11 +165,12 @@ static struct platform_driver tmio_mmc_driver = { .driver = { .name = "tmio-mmc", .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &tmio_mmc_dev_pm_ops, +#endif }, .probe = tmio_mmc_probe, .remove = tmio_mmc_remove, - .suspend = tmio_mmc_suspend, - .resume = tmio_mmc_resume, }; module_platform_driver(tmio_mmc_driver);