From patchwork Thu May 30 12:53:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 17295 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E915025C6D for ; Thu, 30 May 2013 12:54:14 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf238640qec.0 for ; Thu, 30 May 2013 05:54:14 -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=QjhDJ4ibLISBXd0gvbe2kmIC3DxOp2QD0tFJRxp4y1A=; b=BMe3B2NNT6MgIRcInvEyT/O09Dx5opyiYlndH21C6vv5OmeX1P29Zkdnng1wNiRVXM vpCVT66tN+rjzsoBUBtJ9tL5CihAZZl3PKwGRmqOyThhvRO6aRI6y/c+5rmIr17SiogT 0+XXEMw0fnuQv1K/8KkoxSAIphZeYXq5xaENYarIVOYw/Aw+cKSeFm3NQ5rXFg3HiJ2g yWsbhahaSa5G1cOhs0ggzJUa0y+dj8vtGNilIB7et1RrC6F6+j47mG03bwQUmnm/aKaP JDAnBJJQBK9OWnqAdFxFato8kq/O/fGWMWGwk1j9ckXlV1/WQR8ySeh3STPfCgJKmA0Q R0EA== X-Received: by 10.224.36.66 with SMTP id s2mr4169784qad.6.1369918454763; Thu, 30 May 2013 05:54:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.101.34 with SMTP id fd2ls335935qeb.7.gmail; Thu, 30 May 2013 05:54:14 -0700 (PDT) X-Received: by 10.220.112.205 with SMTP id x13mr5215267vcp.71.1369918454629; Thu, 30 May 2013 05:54:14 -0700 (PDT) Received: from mail-vb0-x233.google.com (mail-vb0-x233.google.com [2607:f8b0:400c:c02::233]) by mx.google.com with ESMTPS id sy4si24738616vdc.43.2013.05.30.05.54.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 May 2013 05:54:14 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::233; Received: by mail-vb0-f51.google.com with SMTP id x16so120762vbf.24 for ; Thu, 30 May 2013 05:54:14 -0700 (PDT) X-Received: by 10.52.163.207 with SMTP id yk15mr4480459vdb.42.1369918454502; Thu, 30 May 2013 05:54:14 -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.220.229.199 with SMTP id jj7csp6744vcb; Thu, 30 May 2013 05:54:13 -0700 (PDT) X-Received: by 10.15.111.75 with SMTP id ci51mr9776644eeb.7.1369918453370; Thu, 30 May 2013 05:54:13 -0700 (PDT) Received: from eu1sys200aog114.obsmtp.com (eu1sys200aog114.obsmtp.com [207.126.144.137]) by mx.google.com with SMTP id w42si2280982eeo.215.2013.05.30.05.53.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 05:54:13 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.137 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.137; Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob114.postini.com ([207.126.147.11]) with SMTP ID DSNKUadL1JdA4iyKKktOMFgnqJeswB2UWDjn@postini.com; Thu, 30 May 2013 12:54:12 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 459E563; Thu, 30 May 2013 12:52:21 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 30B80121; Thu, 30 May 2013 12:53:22 +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 83786A8065; Thu, 30 May 2013 14:53:16 +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; Thu, 30 May 2013 14:53:21 +0200 From: Ulf Hansson To: , Chris Ball Cc: Ulf Hansson Subject: [PATCH 4/4] mmc: core: Initiate suspend|resume from mmc bus instead of mmc host Date: Thu, 30 May 2013 14:53:11 +0200 Message-ID: <1369918391-15277-5-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1369918391-15277-1-git-send-email-ulf.hansson@stericsson.com> References: <1369918391-15277-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnKy3ZOZJ975Dh6sxrx0ZiIRHMtNIjC9I2Fq+mFmJFrx8tBCsDpbkhDt4sVnBzs1cXFWyH8 X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::233 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 --- drivers/mmc/core/bus.c | 15 ++++++++++++++- drivers/mmc/core/core.c | 26 +++----------------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index d9e8c2b..2842684 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); + struct mmc_host *host = card->host; int ret = 0; - 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); + struct mmc_host *host = card->host; int ret = 0; + 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);