Skip to contentSkip to conversation

mmc: core: Substitute mmc_flush_cash for mmc_cache_ctrl in suspend

PATCH In review Seungwon Jeon 2 participants 3 messages Feb 10, 2012 – Mar 7, 2012 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: core: Substitute mmc_flush_cash for mmc_cache_ctrl in suspend

After the cache is disabled in suspend, enabling cache can be done by mmc_init_card in resume. Currently this call path has been changed. In case of sleep mode mmc_init_card isn't called. So mmc_cache_ctrl need to be replaced with mmc_flush_cache in suspend.

---
 drivers/mmc/core/core.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +7 -2
index 8a19143..70e25d8 100644
@@ -2329,9 +2329,14 @@ EXPORT_SYMBOL(mmc_card_can_sleep);
  */
 int mmc_flush_cache(struct mmc_card *card)
 {
-	struct mmc_host *host = card->host;
+	struct mmc_host *host;
 	int err = 0;
 
+	if (!card)
+		return err;
+
+	host = card->host;
+
 	if (!(host->caps2 & MMC_CAP2_CACHE_CTRL))
 		return err;
 
@@ -2401,7 +2406,7 @@ int mmc_suspend_host(struct mmc_host *host)
 	cancel_delayed_work(&host->detect);
 	mmc_flush_scheduled_work();
 	if (mmc_try_claim_host(host)) {
-		err = mmc_cache_ctrl(host, 0);
+		err = mmc_flush_cache(host->card);
 		mmc_do_release_host(host);
 	} else {
 		err = -EBUSY;
Signature · 1 line
1.7.0.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 40 lines · Seungwon Jeon

After the cache is disabled in suspend, enabling cache can be done by mmc_init_card in resume. Currently this call path has been changed. In case of sleep mode mmc_init_card isn't called. So mmc_cache_ctrl need to be replaced with mmc_flush_cache in suspend.

---
 drivers/mmc/core/core.c |    9 +++++++--

 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +7 -3
index 8a19143..70e25d8 100644
@@ -2329,9 +2329,14 @@ EXPORT_SYMBOL(mmc_card_can_sleep);
  */
  int mmc_flush_cache(struct mmc_card *card)
  {
-       struct mmc_host *host = card->host;
+       struct mmc_host *host;
        int err = 0;
 
+       if (!card)
+               return err;
+
+       host = card->host;
+
        if (!(host->caps2 & MMC_CAP2_CACHE_CTRL))
                return err;
 
@@ -2401,7 +2406,7 @@ int mmc_suspend_host(struct mmc_host *host)
        cancel_delayed_work(&host->detect);
        mmc_flush_scheduled_work();
        if (mmc_try_claim_host(host)) {
-               err = mmc_cache_ctrl(host, 0);
+               err = mmc_flush_cache(host->card);
                mmc_do_release_host(host);
        } else {
                err = -EBUSY;
--
Quoted 1 line

1.7.0.4

Thanks for the changes.

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#2 lore raw

Saugata Das <[email protected]>:

Quoted 44 lines · Seungwon Jeon
Quoted 40 lines

After the cache is disabled in suspend, enabling cache can be done by mmc_init_card in resume. Currently this call path has been changed. In case of sleep mode mmc_init_card isn't called. So mmc_cache_ctrl need to be replaced with mmc_flush_cache in suspend.

---
 drivers/mmc/core/core.c |    9 +++++++--

 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +7 -3
index 8a19143..70e25d8 100644
@@ -2329,9 +2329,14 @@ EXPORT_SYMBOL(mmc_card_can_sleep);
  */
  int mmc_flush_cache(struct mmc_card *card)
  {
-       struct mmc_host *host = card->host;
+       struct mmc_host *host;
        int err = 0;
 
+       if (!card)
+               return err;
+
+       host = card->host;
+
        if (!(host->caps2 & MMC_CAP2_CACHE_CTRL))
                return err;
 
@@ -2401,7 +2406,7 @@ int mmc_suspend_host(struct mmc_host *host)
        cancel_delayed_work(&host->detect);
        mmc_flush_scheduled_work();
        if (mmc_try_claim_host(host)) {
-               err = mmc_cache_ctrl(host, 0);
+               err = mmc_flush_cache(host->card);
                mmc_do_release_host(host);
        } else {
                err = -EBUSY;
--
Quoted 1 line

1.7.0.4

Thanks for the changes.

Quoted 2 lines

Is there more opinions?

Thanks,
Seungwon Jeon.

Quoted 10 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html