From patchwork Wed Dec 18 11:09:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 22623 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BF18F23FBE for ; Wed, 18 Dec 2013 11:09:29 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id e14sf26719515iej.0 for ; Wed, 18 Dec 2013 03:09:28 -0800 (PST) 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=i8W538jE1Z57wDxMGR9R6Ywsq7EJg3fyeEtjNmqWP3g=; b=O0cAZvvQYcibsyL3GITZerFYUQu1shuWKUkDPohMfEdVhsVB3APq/Fi0xisbdTj0Pw pbLR+254tceZXHqPSwDSGvdn/A7i+gxwJ/blZB5TjRgBy1NLOzuthzhfovJRR0UNxHYm m+RoyRoEmT1g5v5V5jiYtLsJ6MK/EPXV9oGwNM5iQn5vF3ly6kTM+sTusgaVCmy/FbGu J78Gt2/HL8Av2+Zrl+Ii6SNAiIVdVBWGTRqP6abk+AnCaY33+cSld5wGEaFm57ADmW+a 6iIX6wu7zg0wpEAV4EWL7x0q+B6UqIFsh7O+5tpe4inqSyIjwIs1keM2tGissjrVSeAV BFxQ== X-Gm-Message-State: ALoCoQmtlC9sqxd4ZElPwkoI72y/7hWzDJU2MN1k0Qe9yiYm8kQuFlBcKQLoicVURZqXbKYuTWXJ X-Received: by 10.43.142.196 with SMTP id jj4mr9385245icc.11.1387364968564; Wed, 18 Dec 2013 03:09:28 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.40.194 with SMTP id z2ls23197qek.23.gmail; Wed, 18 Dec 2013 03:09:28 -0800 (PST) X-Received: by 10.58.100.197 with SMTP id fa5mr4384672veb.24.1387364968305; Wed, 18 Dec 2013 03:09:28 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id in18si5577097vec.133.2013.12.18.03.09.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 03:09:28 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so5050464vcb.9 for ; Wed, 18 Dec 2013 03:09:28 -0800 (PST) X-Received: by 10.58.50.194 with SMTP id e2mr9555veo.54.1387364968209; Wed, 18 Dec 2013 03:09:28 -0800 (PST) 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.59.13.131 with SMTP id ey3csp233301ved; Wed, 18 Dec 2013 03:09:27 -0800 (PST) X-Received: by 10.152.203.129 with SMTP id kq1mr37821lac.77.1387364966758; Wed, 18 Dec 2013 03:09:26 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id 6si2196264lby.157.2013.12.18.03.09.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 03:09:26 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id el20so3736061lab.23 for ; Wed, 18 Dec 2013 03:09:26 -0800 (PST) X-Received: by 10.152.21.38 with SMTP id s6mr6552lae.80.1387364966009; Wed, 18 Dec 2013 03:09:26 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id ld10sm27868575lab.8.2013.12.18.03.09.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 03:09:25 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson Subject: [PATCH 1/2] mmc: core: Use mmc_flush_cache() during mmc suspend Date: Wed, 18 Dec 2013 12:09:20 +0100 Message-Id: <1387364961-15464-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 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: , Earlier we disabled the cache during suspend, which meant a flush was internally at the eMMC performed as well. To simplify code we can make use of the mmc_flush_cache(), during mmc suspend, which makes the mmc_cache_ctrl() redundant so then we can remove it. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 38 -------------------------------------- drivers/mmc/core/mmc.c | 2 +- include/linux/mmc/host.h | 2 -- 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 098374b..df591a9 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2602,44 +2602,6 @@ int mmc_flush_cache(struct mmc_card *card) } EXPORT_SYMBOL(mmc_flush_cache); -/* - * Turn the cache ON/OFF. - * Turning the cache OFF shall trigger flushing of the data - * to the non-volatile storage. - * This function should be called with host claimed - */ -int mmc_cache_ctrl(struct mmc_host *host, u8 enable) -{ - struct mmc_card *card = host->card; - unsigned int timeout; - int err = 0; - - if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) || - mmc_card_is_removable(host)) - return err; - - if (card && mmc_card_mmc(card) && - (card->ext_csd.cache_size > 0)) { - enable = !!enable; - - if (card->ext_csd.cache_ctrl ^ enable) { - timeout = enable ? card->ext_csd.generic_cmd6_time : 0; - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_CACHE_CTRL, enable, timeout); - if (err) - pr_err("%s: cache %s error %d\n", - mmc_hostname(card->host), - enable ? "on" : "off", - err); - else - card->ext_csd.cache_ctrl = enable; - } - } - - return err; -} -EXPORT_SYMBOL(mmc_cache_ctrl); - #ifdef CONFIG_PM /* Do the card removal on suspend if card is assumed removeable diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 98e9eb0..ef1cc73 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1484,7 +1484,7 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend) goto out; } - err = mmc_cache_ctrl(host, 0); + err = mmc_flush_cache(host->card); if (err) goto out; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 99f5709..f539bc7 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -388,8 +388,6 @@ int mmc_power_restore_host(struct mmc_host *host); void mmc_detect_change(struct mmc_host *, unsigned long delay); void mmc_request_done(struct mmc_host *, struct mmc_request *); -int mmc_cache_ctrl(struct mmc_host *, u8); - static inline void mmc_signal_sdio_irq(struct mmc_host *host) { host->ops->enable_sdio_irq(host, 0);