From patchwork Tue Oct 14 11:45:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 38707 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 037A420549 for ; Tue, 14 Oct 2014 11:45:36 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id hi2sf3891765wib.1 for ; Tue, 14 Oct 2014 04:45:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=oRbw2OkyiXU4bcyeZpJtUnWowTxcSEHt+QW3s3ytUcY=; b=M1fdKmKtuUU6ajpBCEaFVK74uZ5yVgoKU6UadzCkwpYbFhCtX5VVoRqJmC7I6noAel TzQSIlt8VatyAj//h02/xoYyU5qE67zmV+bUBHdY9loxJ9fPdahEN13X+BXfZ/V8o/Nv nh+8VCK96R5G6f5jY2gSFTF6wbi3yR1yuw/cn344dHBX34vudJUSYMOoo5pIA8J7jxoW mvZXNUbpUNoyQl7Gvu3MESkUdb8i3miT2jsolwDvTyZBEjdfKaxec6Pg1hnSxFSYNHqC V1HJ3J1fN4S602u5X8iaER0trja3dw3+4JPrJWF+AcdTQSqX16vFP80DgiHvoFNLW4T5 14Mw== X-Gm-Message-State: ALoCoQlx4pXqy8uP4dFMBih5uiXk8VfHLEKtwUC5sEoPA79PNLdoFzsnn89eKm6JJ3DEVe9CXxJz X-Received: by 10.112.63.103 with SMTP id f7mr428527lbs.9.1413287135984; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.233 with SMTP id uh9ls570772lac.70.gmail; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) X-Received: by 10.152.87.7 with SMTP id t7mr4857303laz.74.1413287135849; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47]) by mx.google.com with ESMTPS id ba3si26032495lbc.92.2014.10.14.04.45.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 04:45:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id pv20so8416797lab.34 for ; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) X-Received: by 10.152.116.11 with SMTP id js11mr4678368lab.71.1413287135762; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp377701lbz; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) X-Received: by 10.112.146.5 with SMTP id sy5mr2413012lbb.97.1413287135355; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by mx.google.com with ESMTPS id ln6si1811650lac.123.2014.10.14.04.45.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 04:45:35 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id gi9so8319644lab.19 for ; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) X-Received: by 10.112.95.133 with SMTP id dk5mr4778662lbb.53.1413287135134; Tue, 14 Oct 2014 04:45:35 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id xh2sm5520440lbb.7.2014.10.14.04.45.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Oct 2014 04:45:34 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson Subject: [PATCH 3/7] mmc: core: Convert the mmc_driver to use the modern PM ops Date: Tue, 14 Oct 2014 13:45:16 +0200 Message-Id: <1413287120-10914-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413287120-10914-1-git-send-email-ulf.hansson@linaro.org> References: <1413287120-10914-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Instead of having specific mmc system PM callbacks for the mmc driver, let's convert to use the common ones. Signed-off-by: Ulf Hansson --- drivers/mmc/card/block.c | 16 ++++++++-------- drivers/mmc/core/bus.c | 14 ++++---------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 1fa4c80..67a37a7 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -2516,15 +2516,17 @@ static void mmc_blk_shutdown(struct mmc_card *card) _mmc_blk_suspend(card); } -#ifdef CONFIG_PM -static int mmc_blk_suspend(struct mmc_card *card) +#ifdef CONFIG_PM_SLEEP +static int mmc_blk_suspend(struct device *dev) { + struct mmc_card *card = mmc_dev_to_card(dev); return _mmc_blk_suspend(card); } -static int mmc_blk_resume(struct mmc_card *card) +static int mmc_blk_resume(struct device *dev) { struct mmc_blk_data *part_md; + struct mmc_card *card = mmc_dev_to_card(dev); struct mmc_blk_data *md = mmc_get_drvdata(card); if (md) { @@ -2540,19 +2542,17 @@ static int mmc_blk_resume(struct mmc_card *card) } return 0; } -#else -#define mmc_blk_suspend NULL -#define mmc_blk_resume NULL #endif +static SIMPLE_DEV_PM_OPS(mmc_blk_pm_ops, mmc_blk_suspend, mmc_blk_resume); + static struct mmc_driver mmc_driver = { .drv = { .name = "mmcblk", + .pm = &mmc_blk_pm_ops, }, .probe = mmc_blk_probe, .remove = mmc_blk_remove, - .suspend = mmc_blk_suspend, - .resume = mmc_blk_resume, .shutdown = mmc_blk_shutdown, }; diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 8a1f124..2f37528 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -145,16 +145,13 @@ static void mmc_bus_shutdown(struct device *dev) #ifdef CONFIG_PM_SLEEP static int mmc_bus_suspend(struct device *dev) { - struct mmc_driver *drv = to_mmc_driver(dev->driver); struct mmc_card *card = mmc_dev_to_card(dev); struct mmc_host *host = card->host; int ret; - if (dev->driver && drv->suspend) { - ret = drv->suspend(card); - if (ret) - return ret; - } + ret = pm_generic_suspend(dev); + if (ret) + return ret; ret = host->bus_ops->suspend(host); return ret; @@ -162,7 +159,6 @@ static int mmc_bus_suspend(struct device *dev) static int mmc_bus_resume(struct device *dev) { - struct mmc_driver *drv = to_mmc_driver(dev->driver); struct mmc_card *card = mmc_dev_to_card(dev); struct mmc_host *host = card->host; int ret; @@ -172,9 +168,7 @@ static int mmc_bus_resume(struct device *dev) pr_warn("%s: error %d during resume (card was removed?)\n", mmc_hostname(host), ret); - if (dev->driver && drv->resume) - ret = drv->resume(card); - + ret = pm_generic_resume(dev); return ret; } #endif