Skip to content

Commit 10e5d96

Browse files
Ulf Hanssoncjb
authored andcommitted
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. 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>
1 parent 469a00b commit 10e5d96

3 files changed

Lines changed: 1 addition & 41 deletions

File tree

‎drivers/mmc/core/core.c‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,44 +2582,6 @@ int mmc_flush_cache(struct mmc_card *card)
25822582
}
25832583
EXPORT_SYMBOL(mmc_flush_cache);
25842584

2585-
/*
2586-
* Turn the cache ON/OFF.
2587-
* Turning the cache OFF shall trigger flushing of the data
2588-
* to the non-volatile storage.
2589-
* This function should be called with host claimed
2590-
*/
2591-
int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
2592-
{
2593-
struct mmc_card *card = host->card;
2594-
unsigned int timeout;
2595-
int err = 0;
2596-
2597-
if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) ||
2598-
mmc_card_is_removable(host))
2599-
return err;
2600-
2601-
if (card && mmc_card_mmc(card) &&
2602-
(card->ext_csd.cache_size > 0)) {
2603-
enable = !!enable;
2604-
2605-
if (card->ext_csd.cache_ctrl ^ enable) {
2606-
timeout = enable ? card->ext_csd.generic_cmd6_time : 0;
2607-
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
2608-
EXT_CSD_CACHE_CTRL, enable, timeout);
2609-
if (err)
2610-
pr_err("%s: cache %s error %d\n",
2611-
mmc_hostname(card->host),
2612-
enable ? "on" : "off",
2613-
err);
2614-
else
2615-
card->ext_csd.cache_ctrl = enable;
2616-
}
2617-
}
2618-
2619-
return err;
2620-
}
2621-
EXPORT_SYMBOL(mmc_cache_ctrl);
2622-
26232585
#ifdef CONFIG_PM
26242586

26252587
/* Do the card removal on suspend if card is assumed removeable

‎drivers/mmc/core/mmc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
14811481
goto out;
14821482
}
14831483

1484-
err = mmc_cache_ctrl(host, 0);
1484+
err = mmc_flush_cache(host->card);
14851485
if (err)
14861486
goto out;
14871487

‎include/linux/mmc/host.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ int mmc_power_restore_host(struct mmc_host *host);
385385
void mmc_detect_change(struct mmc_host *, unsigned long delay);
386386
void mmc_request_done(struct mmc_host *, struct mmc_request *);
387387

388-
int mmc_cache_ctrl(struct mmc_host *, u8);
389-
390388
static inline void mmc_signal_sdio_irq(struct mmc_host *host)
391389
{
392390
host->ops->enable_sdio_irq(host, 0);

0 commit comments

Comments
 (0)