From patchwork Thu Dec 19 20:04: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: 22653 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-fa0-f72.google.com (mail-fa0-f72.google.com [209.85.161.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 96A7E23FC4 for ; Thu, 19 Dec 2013 20:04:59 +0000 (UTC) Received: by mail-fa0-f72.google.com with SMTP id k1sf2381858fak.7 for ; Thu, 19 Dec 2013 12:04:57 -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=OY9oIbddLiD/uF4ze4M9UMDVw61oTDLoyqNcDUcZQkQ=; b=b1N6aa31dVwO6F0KJoRpAXyJ8jQXnCILuZSRrdH9ln46UWuZ7UUOeBzHtzwutneQPs zHd4wPYnfMfyy+pTOt0sDit1LDQJJgAeMUoMs/ndsaKenDCQK2iHlvoOZr1AFroXJTn0 iWPmfVLnmvS7ROLJw4oFoaG22mEa8JYS0q446d4naXRTD/x3K3KpfE0F2IKflZsH3ZgZ eUIeXZ7e2OkAtseDlPnpiYVcoudhYrmxnS2aYkbSITCbp4dPS6JQjGAh3VHF+iSYOJBI t30HssPGKZ31jId7axo7PMAGg0b4YaiKvfIt+xpxXqBzsD/LmxOhnvVSXNrje478WTvN n37g== X-Gm-Message-State: ALoCoQk/AnULqfmmnGhRx16L6K+lpUL7L3JkThG/LSgc0V6WTq02bp6UfGWbnCVXjmcJdE/Srt7i X-Received: by 10.14.179.134 with SMTP id h6mr111756eem.7.1387483497322; Thu, 19 Dec 2013 12:04:57 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.196 with SMTP id e4ls455482qeo.3.gmail; Thu, 19 Dec 2013 12:04:57 -0800 (PST) X-Received: by 10.220.174.200 with SMTP id u8mr2281083vcz.6.1387483497189; Thu, 19 Dec 2013 12:04:57 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id gx6si903925vdc.154.2013.12.19.12.04.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 12:04:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.47; Received: by mail-vb0-f47.google.com with SMTP id q12so938606vbe.34 for ; Thu, 19 Dec 2013 12:04:57 -0800 (PST) X-Received: by 10.52.237.228 with SMTP id vf4mr1885143vdc.3.1387483497063; Thu, 19 Dec 2013 12:04:57 -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 ey3csp10869ved; Thu, 19 Dec 2013 12:04:56 -0800 (PST) X-Received: by 10.152.1.5 with SMTP id 5mr1783577lai.20.1387483495728; Thu, 19 Dec 2013 12:04:55 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53]) by mx.google.com with ESMTPS id x7si2267266lag.156.2013.12.19.12.04.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 12:04:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.53 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id mc6so702952lab.12 for ; Thu, 19 Dec 2013 12:04:54 -0800 (PST) X-Received: by 10.112.14.34 with SMTP id m2mr1645031lbc.13.1387483494626; Thu, 19 Dec 2013 12:04:54 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id tc8sm3091113lbb.9.2013.12.19.12.04.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 12:04:53 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson Subject: [PATCH V2 1/2] mmc: core: Use mmc_flush_cache() during mmc suspend Date: Thu, 19 Dec 2013 21:04:20 +0100 Message-Id: <1387483461-6317-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.212.47 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 Acked-by: Seungwon Jeon --- 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);