mmc: core: Use mmc_flush_cache() during mmc suspend
authorUlf Hansson <ulf.hansson@linaro.org>
Mon, 16 Dec 2013 15:23:22 +0000 (16:23 +0100)
committerChris Ball <chris@printf.net>
Fri, 14 Feb 2014 03:58:41 +0000 (22:58 -0500)
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 <ulf.hansson@linaro.org>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/core/core.c
drivers/mmc/core/mmc.c
include/linux/mmc/host.h

index 22427c684b367299b4c877eee6d73886c9731105..8928f9f4cfe181b052c1784ed35fd49e22336031 100644 (file)
@@ -2582,44 +2582,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
index 5c4ee6ab212552479acaf679b55746db96e253b2..6d446e217f3654a10c7cdb649c60712630eea1f7 100644 (file)
@@ -1481,7 +1481,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;
 
index 4c0176a8e47484deb7c0bcb1fd8c52b78efd9069..f69bd70b1046a1fedc6d7e34b57d1c674b1df428 100644 (file)
@@ -385,8 +385,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);