diff mbox

mmc: blk: add emmc cache flush in shutdown callback

Message ID 1405330459-2335-1-git-send-email-yunpeng.gao@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gao, Yunpeng July 14, 2014, 9:34 a.m. UTC
If eMMC Cache feature enabled, we'd better flush
eMMC cache in the shutdown callback. Otherwise
data corruption issue may be observed.

Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
---
 drivers/mmc/card/block.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Jaehoon Chung July 14, 2014, 9:51 a.m. UTC | #1
Hi,

On 07/14/2014 06:34 PM, Yunpeng Gao wrote:
> If eMMC Cache feature enabled, we'd better flush
> eMMC cache in the shutdown callback. Otherwise
> data corruption issue may be observed.

I knew mmc_flush_cache() is called into mmc_shutdown() (driver/mmc/core/mmc.c)
Which data corruption is occurred? Could you explain more?

Best Regards,
Jaehoon Chung 

> 
> Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
> ---
>  drivers/mmc/card/block.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 452782b..8a4010e 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -2509,6 +2509,10 @@ static int _mmc_blk_suspend(struct mmc_card *card)
>  static void mmc_blk_shutdown(struct mmc_card *card)
>  {
>  	_mmc_blk_suspend(card);
> +
> +	mmc_claim_host(card->host);
> +	mmc_flush_cache(card);
> +	mmc_release_host(card->host);
>  }
>  
>  #ifdef CONFIG_PM
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gao, Yunpeng July 14, 2014, 11:09 a.m. UTC | #2
Thanks a lot for the review and comments.

This patch was derived from our old mmc driver code base, which was based on kernel 3.10 and did not implemented the mmc_shutdown() callback in mmc.c yet.
So it added shutdown callback in drivers/mmc/card/block.c to fix data corruption issue observed at that time.

Since flush eMMC cache in mmc_shutdown() callback is better than in mmc_blk_shutdown(), I think my patch is not needed for current upstream mmc driver any more.
Please ignore it :-)

Thanks.

Regards,
Yunpeng

-----Original Message-----
From: Jaehoon Chung [mailto:jh80.chung@samsung.com] 
Sent: Monday, July 14, 2014 5:51 PM
To: Gao, Yunpeng; linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: blk: add emmc cache flush in shutdown callback

Hi,

On 07/14/2014 06:34 PM, Yunpeng Gao wrote:
> If eMMC Cache feature enabled, we'd better flush eMMC cache in the 
> shutdown callback. Otherwise data corruption issue may be observed.

I knew mmc_flush_cache() is called into mmc_shutdown() (driver/mmc/core/mmc.c) Which data corruption is occurred? Could you explain more?

Best Regards,
Jaehoon Chung 

> 
> Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
> ---
>  drivers/mmc/card/block.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 
> 452782b..8a4010e 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -2509,6 +2509,10 @@ static int _mmc_blk_suspend(struct mmc_card 
> *card)  static void mmc_blk_shutdown(struct mmc_card *card)  {
>  	_mmc_blk_suspend(card);
> +
> +	mmc_claim_host(card->host);
> +	mmc_flush_cache(card);
> +	mmc_release_host(card->host);
>  }
>  
>  #ifdef CONFIG_PM
> 

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

Patch

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 452782b..8a4010e 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2509,6 +2509,10 @@  static int _mmc_blk_suspend(struct mmc_card *card)
 static void mmc_blk_shutdown(struct mmc_card *card)
 {
 	_mmc_blk_suspend(card);
+
+	mmc_claim_host(card->host);
+	mmc_flush_cache(card);
+	mmc_release_host(card->host);
 }
 
 #ifdef CONFIG_PM