Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Assemble the codes of related to eMMC4.5
@ 2011-10-24 10:31 Seungwon Jeon
  2011-10-24 11:09 ` Chris Ball
  0 siblings, 1 reply; 4+ messages in thread
From: Seungwon Jeon @ 2011-10-24 10:31 UTC (permalink / raw)
  To: linux-mmc; +Cc: cjb, linux-samsung-soc, kgene.kim, dh.han

Code cleanup. The codes of related to eMMC4.5 are scattered.
This patch removes a duplicate if-statement and assembles all.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/core/mmc.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index fb5bf01..3627044 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -467,29 +467,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
 		card->ext_csd.rst_n_function = ext_csd[EXT_CSD_RST_N_FUNCTION];
 	}

-	/* eMMC v4.5 or later */
-	if (card->ext_csd.rev >= 6)
-		card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
-
 	card->ext_csd.raw_erased_mem_count = ext_csd[EXT_CSD_ERASED_MEM_CONT];
 	if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
 		card->erased_byte = 0xFF;
 	else
 		card->erased_byte = 0x0;

+	/* eMMC v4.5 or later */
 	if (card->ext_csd.rev >= 6) {
+		card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
+
 		card->ext_csd.generic_cmd6_time = 10 *
 			ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
 		card->ext_csd.power_off_longtime = 10 *
 			ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
-	} else
-		card->ext_csd.generic_cmd6_time = 0;

-	card->ext_csd.cache_size =
-		ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
-		ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
-		ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
-		ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
+		card->ext_csd.cache_size =
+			ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
+			ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
+			ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
+			ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
+	}

 out:
 	return err;
--
1.7.0.4



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

* Re: [PATCH] mmc: core: Assemble the codes of related to eMMC4.5
  2011-10-24 10:31 [PATCH] mmc: core: Assemble the codes of related to eMMC4.5 Seungwon Jeon
@ 2011-10-24 11:09 ` Chris Ball
  2011-10-24 11:32   ` Girish K S
  2011-10-25  0:13   ` Seungwon Jeon
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Ball @ 2011-10-24 11:09 UTC (permalink / raw)
  To: Seungwon Jeon; +Cc: linux-mmc, linux-samsung-soc, kgene.kim, dh.han

Hi Seungwon,

On Mon, Oct 24 2011, Seungwon Jeon wrote:
> Code cleanup. The codes of related to eMMC4.5 are scattered.
> This patch removes a duplicate if-statement and assembles all.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> ---
>  drivers/mmc/core/mmc.c |   20 +++++++++-----------
>  1 files changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index fb5bf01..3627044 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -467,29 +467,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
>  		card->ext_csd.rst_n_function = ext_csd[EXT_CSD_RST_N_FUNCTION];
>  	}
>
> -	/* eMMC v4.5 or later */
> -	if (card->ext_csd.rev >= 6)
> -		card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
> -
>  	card->ext_csd.raw_erased_mem_count = ext_csd[EXT_CSD_ERASED_MEM_CONT];
>  	if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
>  		card->erased_byte = 0xFF;
>  	else
>  		card->erased_byte = 0x0;
>
> +	/* eMMC v4.5 or later */
>  	if (card->ext_csd.rev >= 6) {
> +		card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
> +
>  		card->ext_csd.generic_cmd6_time = 10 *
>  			ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
>  		card->ext_csd.power_off_longtime = 10 *
>  			ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
> -	} else
> -		card->ext_csd.generic_cmd6_time = 0;

Your patch removes this line completely.  Why is that?  You should
explain it in the commit message.

>
> -	card->ext_csd.cache_size =
> -		ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
> -		ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
> -		ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
> -		ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
> +		card->ext_csd.cache_size =
> +			ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
> +			ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
> +			ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
> +			ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
> +	}
>
>  out:
>  	return err;

The rest looks good, thanks,

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

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

* Re: [PATCH] mmc: core: Assemble the codes of related to eMMC4.5
  2011-10-24 11:09 ` Chris Ball
@ 2011-10-24 11:32   ` Girish K S
  2011-10-25  0:13   ` Seungwon Jeon
  1 sibling, 0 replies; 4+ messages in thread
From: Girish K S @ 2011-10-24 11:32 UTC (permalink / raw)
  To: Chris Ball; +Cc: Seungwon Jeon, linux-mmc, linux-samsung-soc, kgene.kim, dh.han

On 24 October 2011 16:39, Chris Ball <cjb@laptop.org> wrote:
> Hi Seungwon,
>
> On Mon, Oct 24 2011, Seungwon Jeon wrote:
>> Code cleanup. The codes of related to eMMC4.5 are scattered.
>> This patch removes a duplicate if-statement and assembles all.
>>
>> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
>> ---
>>  drivers/mmc/core/mmc.c |   20 +++++++++-----------
>>  1 files changed, 9 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>> index fb5bf01..3627044 100644
>> --- a/drivers/mmc/core/mmc.c
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -467,29 +467,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
>>               card->ext_csd.rst_n_function = ext_csd[EXT_CSD_RST_N_FUNCTION];
>>       }
>>
>> -     /* eMMC v4.5 or later */
>> -     if (card->ext_csd.rev >= 6)
>> -             card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
>> -
>>       card->ext_csd.raw_erased_mem_count = ext_csd[EXT_CSD_ERASED_MEM_CONT];
>>       if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
>>               card->erased_byte = 0xFF;
>>       else
>>               card->erased_byte = 0x0;
>>
>> +     /* eMMC v4.5 or later */
>>       if (card->ext_csd.rev >= 6) {
>> +             card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
>> +
>>               card->ext_csd.generic_cmd6_time = 10 *
>>                       ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
>>               card->ext_csd.power_off_longtime = 10 *
>>                       ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
>> -     } else
>> -             card->ext_csd.generic_cmd6_time = 0;
>
> Your patch removes this line completely.  Why is that?  You should
> explain it in the commit message.
By tracing the code what i understand is  mmc_read_ext_csd is called
from mmc_card_init. In the init function the card instance is created.
When the card instance is created kzalloc is used. This will
initialize all the card structure members to 0.
So the deleted line is implicit.
>
>>
>> -     card->ext_csd.cache_size =
>> -             ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
>> -             ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
>> -             ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
>> -             ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
>> +             card->ext_csd.cache_size =
>> +                     ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
>> +                     ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
>> +                     ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
>> +                     ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
>> +     }
>>
>>  out:
>>       return err;
>
> The rest looks good, thanks,
>
> - Chris.
> --
> Chris Ball   <cjb@laptop.org>   <http://printf.net/>
> One Laptop Per Child
> --
> 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
>

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

* RE: [PATCH] mmc: core: Assemble the codes of related to eMMC4.5
  2011-10-24 11:09 ` Chris Ball
  2011-10-24 11:32   ` Girish K S
@ 2011-10-25  0:13   ` Seungwon Jeon
  1 sibling, 0 replies; 4+ messages in thread
From: Seungwon Jeon @ 2011-10-25  0:13 UTC (permalink / raw)
  To: 'Chris Ball'; +Cc: linux-mmc, linux-samsung-soc, kgene.kim, dh.han

Chris Ball wrote:
> Hi Seungwon,
> 
> On Mon, Oct 24 2011, Seungwon Jeon wrote:
> > Code cleanup. The codes of related to eMMC4.5 are scattered.
> > This patch removes a duplicate if-statement and assembles all.
> >
> > Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> > ---
> >  drivers/mmc/core/mmc.c |   20 +++++++++-----------
> >  1 files changed, 9 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> > index fb5bf01..3627044 100644
> > --- a/drivers/mmc/core/mmc.c
> > +++ b/drivers/mmc/core/mmc.c
> > @@ -467,29 +467,27 @@ static int mmc_read_ext_csd(struct mmc_card *card,
> u8 *ext_csd)
> >  		card->ext_csd.rst_n_function =
> ext_csd[EXT_CSD_RST_N_FUNCTION];
> >  	}
> >
> > -	/* eMMC v4.5 or later */
> > -	if (card->ext_csd.rev >= 6)
> > -		card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
> > -
> >  	card->ext_csd.raw_erased_mem_count =
> ext_csd[EXT_CSD_ERASED_MEM_CONT];
> >  	if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
> >  		card->erased_byte = 0xFF;
> >  	else
> >  		card->erased_byte = 0x0;
> >
> > +	/* eMMC v4.5 or later */
> >  	if (card->ext_csd.rev >= 6) {
> > +		card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
> > +
> >  		card->ext_csd.generic_cmd6_time = 10 *
> >  			ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
> >  		card->ext_csd.power_off_longtime = 10 *
> >  			ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
> > -	} else
> > -		card->ext_csd.generic_cmd6_time = 0;
> 
> Your patch removes this line completely.  Why is that?  You should
> explain it in the commit message.
Sure, I will.
Removed line is just for explicit initialization considering previous
version
even though generic_cmd6_time is zeroed at card init-time.
So it seems be unnecessary.

Best regards,
Seungwon Jeon.

> 
> >
> > -	card->ext_csd.cache_size =
> > -		ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
> > -		ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
> > -		ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
> > -		ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
> > +		card->ext_csd.cache_size =
> > +			ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
> > +			ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
> > +			ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
> > +			ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
> > +	}
> >
> >  out:
> >  	return err;
> 
> The rest looks good, thanks,
> 
> - Chris.
> --
> Chris Ball   <cjb@laptop.org>   <http://printf.net/>
> One Laptop Per Child

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

end of thread, other threads:[~2011-10-25  0:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 10:31 [PATCH] mmc: core: Assemble the codes of related to eMMC4.5 Seungwon Jeon
2011-10-24 11:09 ` Chris Ball
2011-10-24 11:32   ` Girish K S
2011-10-25  0:13   ` Seungwon Jeon

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