From patchwork Mon Jun 10 15:03:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 17737 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f200.google.com (mail-gg0-f200.google.com [209.85.161.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2FF642397B for ; Mon, 10 Jun 2013 15:04:19 +0000 (UTC) Received: by mail-gg0-f200.google.com with SMTP id k5sf6297238ggd.3 for ; Mon, 10 Jun 2013 08:04:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=zmXR5rwBDJcI75iW/PBHxVApiUQgPbFltftq4/kjq5M=; b=DDHPCDuQS2BMf+TrVer0IVTUTv5QIJNOqKeg52kfkMn5pvJzoNgP+tqBgORJ41O7+e RzDU/OXN9kYlw8MjfIKKjnLgtowYRwvphYxFWGnsN3gWps520AO9y83NQQD1beAAOgKy zOXtBngaVN+EhERmMnJCIJU3dRrclccTde67GMy2GFEyAtR6DSJvRLsx02T25VGxj8Q/ l8sWvNnkij6X4I+KB3qkrDZZ3clttrL+iNkC+1QH7DlgJVxHvqTN3PUZPE08/LCE//U6 ZiD39xzk3sLNH00df+9eGa3nr//SixJSiJ0oA3SWJA9d5yjCXRaRhsfRXBp8sXeApZQb mMMQ== X-Received: by 10.224.59.205 with SMTP id m13mr8641485qah.7.1370876658905; Mon, 10 Jun 2013 08:04:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.117.231 with SMTP id kh7ls301557qeb.26.gmail; Mon, 10 Jun 2013 08:04:18 -0700 (PDT) X-Received: by 10.52.115.1 with SMTP id jk1mr4979399vdb.95.1370876658689; Mon, 10 Jun 2013 08:04:18 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id sz6si5069489vdc.36.2013.06.10.08.04.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 08:04:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id gf11so2492202vcb.11 for ; Mon, 10 Jun 2013 08:04:18 -0700 (PDT) X-Received: by 10.52.36.115 with SMTP id p19mr4969690vdj.8.1370876658534; Mon, 10 Jun 2013 08:04:18 -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.221.10.206 with SMTP id pb14csp71483vcb; Mon, 10 Jun 2013 08:04:17 -0700 (PDT) X-Received: by 10.14.211.69 with SMTP id v45mr11827444eeo.45.1370876657481; Mon, 10 Jun 2013 08:04:17 -0700 (PDT) Received: from eu1sys200aog122.obsmtp.com (eu1sys200aog122.obsmtp.com [207.126.144.153]) by mx.google.com with SMTP id z43si8484793een.343.2013.06.10.08.04.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Jun 2013 08:04:17 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.153 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.153; Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob122.postini.com ([207.126.147.11]) with SMTP ID DSNKUbXq69VK5lxp3KNkOvG/BIfAXU5TO8Bb@postini.com; Mon, 10 Jun 2013 15:04:16 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 1387097; Mon, 10 Jun 2013 15:04:09 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C158D9C0; Mon, 10 Jun 2013 15:04:08 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 00A17A8065; Mon, 10 Jun 2013 17:04:02 +0200 (CEST) Received: from steludxu1397.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.279.5; Mon, 10 Jun 2013 17:04:07 +0200 From: Ulf Hansson To: , Chris Ball Cc: Ulf Hansson Subject: [PATCH 04/12] mmc: core: Initiate suspend|resume from mmc bus instead of mmc host Date: Mon, 10 Jun 2013 17:03:39 +0200 Message-ID: <1370876627-13439-5-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1370876627-13439-1-git-send-email-ulf.hansson@stericsson.com> References: <1370876627-13439-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkw2oxKecPQtcDmI3T+im8RLbRsKKIqo63QaF2M3aL/ba5PgdQu1V5WllPPXGRakEdve/K/ X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , From: Ulf Hansson The host should be responsible to suspend|resume the host and not the card. This patch changes this behaviour, by moving the responsiblity to the mmc bus instead which already holds the card device. The exported functions mmc_suspend|resume_host are now to be considered as depcrecated. Once all host drivers moves away from using them, we can remove them. As of now, a successful error code is always returned. Signed-off-by: Ulf Hansson Tested-by: Jaehoon Chung --- drivers/mmc/core/bus.c | 19 ++++++++++++++++--- drivers/mmc/core/core.c | 26 +++----------------------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index d9e8c2b..3b7ca8a 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -127,10 +127,16 @@ 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); - int ret = 0; + struct mmc_host *host = card->host; + int ret; - if (dev->driver && drv->suspend) + if (dev->driver && drv->suspend) { ret = drv->suspend(card); + if (ret) + return ret; + } + + ret = host->bus_ops->suspend(host); return ret; } @@ -138,10 +144,17 @@ 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); - int ret = 0; + struct mmc_host *host = card->host; + int ret; + + ret = host->bus_ops->resume(host); + if (ret) + pr_warn("%s: error %d during resume (card was removed?)\n", + mmc_hostname(host), ret); if (dev->driver && drv->resume) ret = drv->resume(card); + return ret; } #endif diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index da3b907..49a5bca 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2619,16 +2619,8 @@ EXPORT_SYMBOL(mmc_cache_ctrl); */ int mmc_suspend_host(struct mmc_host *host) { - int err = 0; - - mmc_bus_get(host); - if (host->bus_ops && !host->bus_dead) { - if (host->bus_ops->suspend) - err = host->bus_ops->suspend(host); - } - mmc_bus_put(host); - - return err; + /* This function is deprecated */ + return 0; } EXPORT_SYMBOL(mmc_suspend_host); @@ -2638,19 +2630,7 @@ EXPORT_SYMBOL(mmc_suspend_host); */ int mmc_resume_host(struct mmc_host *host) { - int err; - - mmc_bus_get(host); - if (host->bus_ops && !host->bus_dead) { - BUG_ON(!host->bus_ops->resume); - err = host->bus_ops->resume(host); - if (err) - pr_warning("%s: error %d during resume " - "(card was removed?)\n", - mmc_hostname(host), err); - } - mmc_bus_put(host); - + /* This function is deprecated */ return 0; } EXPORT_SYMBOL(mmc_resume_host);