From 107cd6cb6cc046ea6a523a3d8154337993b0cc4b Mon Sep 17 00:00:00 2001 From: Ulf Hansson Date: Mon, 16 Dec 2013 16:23:22 +0100 Subject: [PATCH] mmc: core: Use mmc_flush_cache() during mmc suspend 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. Change-Id: I80c6cbf9ad3e81943aee4b844c267c8e4f360257 Signed-off-by: Ulf Hansson Acked-by: Seungwon Jeon Signed-off-by: Chris Ball Git-commit: 1a6fd1533dfa409e48f377db1d92ef1cc6b0c4ce Git-repo: https://android.googlesource.com/kernel/common.git [kaushalk@codeaurora.org: Resolved context conflicts] Signed-off-by: Kaushal Kumar --- drivers/mmc/core/core.c | 54 ---------------------------------------- drivers/mmc/core/mmc.c | 2 +- include/linux/mmc/host.h | 2 -- 3 files changed, 1 insertion(+), 57 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 631cd3ebfc7b..922fe84400e4 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -4014,60 +4014,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, rc; - - BUG_ON(!card); - timeout = card->ext_csd.generic_cmd6_time; - - if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) || - mmc_card_is_removable(host) || - (card->quirks & MMC_QUIRK_CACHE_DISABLE)) - return err; - - if (card && mmc_card_mmc(card) && - (card->ext_csd.cache_size > 0)) { - enable = !!enable; - - if (card->ext_csd.cache_ctrl ^ enable) { - if (!enable) - timeout = MMC_FLUSH_REQ_TIMEOUT_MS; - - err = mmc_switch_ignore_timeout(card, - EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_CACHE_CTRL, enable, timeout); - - if (err == -ETIMEDOUT && !enable) { - pr_err("%s:cache disable operation timeout\n", - mmc_hostname(card->host)); - rc = mmc_interrupt_hpi(card); - if (rc) - pr_err("%s: mmc_interrupt_hpi() failed (%d)\n", - mmc_hostname(host), rc); - } else 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 /** diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 1249b1b53983..88bc9b6db537 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1927,7 +1927,7 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend) */ mmc_disable_clk_scaling(host); - 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 66b80bcb2c60..c2c57c9950af 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -591,8 +591,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) { if (!host->sdio_irqs) {