public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: use defined macro for card status
@ 2011-08-10  9:46 Jaehoon Chung
  2011-08-11 21:42 ` Chris Ball
  0 siblings, 1 reply; 2+ messages in thread
From: Jaehoon Chung @ 2011-08-10  9:46 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org; +Cc: Chris Ball, Kyungmin Park

Sometime we need to check the card status.
So using R1_CURRENT_STATE(status)..and compare with R1_STATE_xxx.
But some code didn't use R1_STATE_xxx.

I think good that use defined macro for checking card status.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mmc/card/mmc_test.c |    2 +-
 drivers/mmc/core/core.c     |    2 +-
 drivers/mmc/core/mmc_ops.c  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 742dc98..2bf229a 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -224,7 +224,7 @@ static void mmc_test_prepare_mrq(struct mmc_test_card *test,
 static int mmc_test_busy(struct mmc_command *cmd)
 {
 	return !(cmd->resp[0] & R1_READY_FOR_DATA) ||
-		(R1_CURRENT_STATE(cmd->resp[0]) == 7);
+		(R1_CURRENT_STATE(cmd->resp[0]) == R1_STATE_PRG);
 }
 
 /*
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f091b43..bfb86a6 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1501,7 +1501,7 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from,
 			goto out;
 		}
 	} while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
-		 R1_CURRENT_STATE(cmd.resp[0]) == 7);
+		 R1_CURRENT_STATE(cmd.resp[0]) == R1_STATE_PRG);
 out:
 	return err;
 }
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 845ce7c..770c3d0 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -407,7 +407,7 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
 			break;
 		if (mmc_host_is_spi(card->host))
 			break;
-	} while (R1_CURRENT_STATE(status) == 7);
+	} while (R1_CURRENT_STATE(status) == R1_STATE_PRG);
 
 	if (mmc_host_is_spi(card->host)) {
 		if (status & R1_SPI_ILLEGAL_COMMAND)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc: use defined macro for card status
  2011-08-10  9:46 [PATCH] mmc: use defined macro for card status Jaehoon Chung
@ 2011-08-11 21:42 ` Chris Ball
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2011-08-11 21:42 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc@vger.kernel.org, Kyungmin Park

Hi Jaehoon,

On Wed, Aug 10 2011, Jaehoon Chung wrote:
> Sometime we need to check the card status.
> So using R1_CURRENT_STATE(status)..and compare with R1_STATE_xxx.
> But some code didn't use R1_STATE_xxx.
>
> I think good that use defined macro for checking card status.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mmc/card/mmc_test.c |    2 +-
>  drivers/mmc/core/core.c     |    2 +-
>  drivers/mmc/core/mmc_ops.c  |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
> index 742dc98..2bf229a 100644
> --- a/drivers/mmc/card/mmc_test.c
> +++ b/drivers/mmc/card/mmc_test.c
> @@ -224,7 +224,7 @@ static void mmc_test_prepare_mrq(struct mmc_test_card *test,
>  static int mmc_test_busy(struct mmc_command *cmd)
>  {
>  	return !(cmd->resp[0] & R1_READY_FOR_DATA) ||
> -		(R1_CURRENT_STATE(cmd->resp[0]) == 7);
> +		(R1_CURRENT_STATE(cmd->resp[0]) == R1_STATE_PRG);
>  }
>  
>  /*
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index f091b43..bfb86a6 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1501,7 +1501,7 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from,
>  			goto out;
>  		}
>  	} while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
> -		 R1_CURRENT_STATE(cmd.resp[0]) == 7);
> +		 R1_CURRENT_STATE(cmd.resp[0]) == R1_STATE_PRG);
>  out:
>  	return err;
>  }
> diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
> index 845ce7c..770c3d0 100644
> --- a/drivers/mmc/core/mmc_ops.c
> +++ b/drivers/mmc/core/mmc_ops.c
> @@ -407,7 +407,7 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
>  			break;
>  		if (mmc_host_is_spi(card->host))
>  			break;
> -	} while (R1_CURRENT_STATE(status) == 7);
> +	} while (R1_CURRENT_STATE(status) == R1_STATE_PRG);
>  
>  	if (mmc_host_is_spi(card->host)) {
>  		if (status & R1_SPI_ILLEGAL_COMMAND)

Thanks, pushed to mmc-next for 3.1.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-11 21:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-10  9:46 [PATCH] mmc: use defined macro for card status Jaehoon Chung
2011-08-11 21:42 ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox