All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: block: Remove use of mmc_blk_set_blksize
@ 2012-03-22 10:47 Ulf Hansson
  2012-03-23  7:19 ` Subhash Jadavani
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ulf Hansson @ 2012-03-22 10:47 UTC (permalink / raw)
  To: linux-mmc, Chris Ball
  Cc: Subhash Jadavani, Per Forlin, Ulf Hansson, Johan Rudholm,
	Lee Jones

According to the specifications for SD and (e)MMC default
blocksize (named BLOCKLEN in Spec.) must always be 512
bytes. Since we hardcoded to always use 512 bytes, we do
not explicitly have to set it. Future improvements should
potentially make it possible to use a greater blocksize
than 512 bytes, but until then let's skip this.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
---
 drivers/mmc/card/block.c |   27 +--------------------------
 1 files changed, 1 insertions(+), 26 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index a7c75d8..ce171c6 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1624,24 +1624,6 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md)
 	return ret;
 }
 
-static int
-mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
-{
-	int err;
-
-	mmc_claim_host(card->host);
-	err = mmc_set_blocklen(card, 512);
-	mmc_release_host(card->host);
-
-	if (err) {
-		pr_err("%s: unable to set block size to 512: %d\n",
-			md->disk->disk_name, err);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 static void mmc_blk_remove_req(struct mmc_blk_data *md)
 {
 	struct mmc_card *card;
@@ -1769,7 +1751,6 @@ static const struct mmc_fixup blk_fixups[] =
 static int mmc_blk_probe(struct mmc_card *card)
 {
 	struct mmc_blk_data *md, *part_md;
-	int err;
 	char cap_str[10];
 
 	/*
@@ -1782,10 +1763,6 @@ static int mmc_blk_probe(struct mmc_card *card)
 	if (IS_ERR(md))
 		return PTR_ERR(md);
 
-	err = mmc_blk_set_blksize(md, card);
-	if (err)
-		goto out;
-
 	string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2,
 			cap_str, sizeof(cap_str));
 	pr_info("%s: %s %s %s %s\n",
@@ -1810,7 +1787,7 @@ static int mmc_blk_probe(struct mmc_card *card)
  out:
 	mmc_blk_remove_parts(card, md);
 	mmc_blk_remove_req(md);
-	return err;
+	return 0;
 }
 
 static void mmc_blk_remove(struct mmc_card *card)
@@ -1846,8 +1823,6 @@ static int mmc_blk_resume(struct mmc_card *card)
 	struct mmc_blk_data *md = mmc_get_drvdata(card);
 
 	if (md) {
-		mmc_blk_set_blksize(md, card);
-
 		/*
 		 * Resume involves the card going into idle state,
 		 * so current partition is always the main one.
-- 
1.7.9


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

* RE: [PATCH] mmc: block: Remove use of mmc_blk_set_blksize
  2012-03-22 10:47 [PATCH] mmc: block: Remove use of mmc_blk_set_blksize Ulf Hansson
@ 2012-03-23  7:19 ` Subhash Jadavani
  2012-03-23  7:38 ` Jaehoon Chung
  2012-04-01  3:52 ` Chris Ball
  2 siblings, 0 replies; 6+ messages in thread
From: Subhash Jadavani @ 2012-03-23  7:19 UTC (permalink / raw)
  To: 'Ulf Hansson', linux-mmc, 'Chris Ball'
  Cc: 'Per Forlin', 'Johan Rudholm',
	'Lee Jones'


Reviewed-by: Subhash Jadavani <subhashj@codeauora.org>

> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> owner@vger.kernel.org] On Behalf Of Ulf Hansson
> Sent: Thursday, March 22, 2012 4:17 PM
> To: linux-mmc@vger.kernel.org; Chris Ball
> Cc: Subhash Jadavani; Per Forlin; Ulf Hansson; Johan Rudholm; Lee Jones
> Subject: [PATCH] mmc: block: Remove use of mmc_blk_set_blksize
> 
> According to the specifications for SD and (e)MMC default blocksize (named
> BLOCKLEN in Spec.) must always be 512 bytes. Since we hardcoded to always
> use 512 bytes, we do not explicitly have to set it. Future improvements
> should potentially make it possible to use a greater blocksize than 512
bytes,
> but until then let's skip this.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
> ---
>  drivers/mmc/card/block.c |   27 +--------------------------
>  1 files changed, 1 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index
> a7c75d8..ce171c6 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1624,24 +1624,6 @@ static int mmc_blk_alloc_parts(struct mmc_card
> *card, struct mmc_blk_data *md)
>  	return ret;
>  }
> 
> -static int
> -mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card) -{
> -	int err;
> -
> -	mmc_claim_host(card->host);
> -	err = mmc_set_blocklen(card, 512);
> -	mmc_release_host(card->host);
> -
> -	if (err) {
> -		pr_err("%s: unable to set block size to 512: %d\n",
> -			md->disk->disk_name, err);
> -		return -EINVAL;
> -	}
> -
> -	return 0;
> -}
> -
>  static void mmc_blk_remove_req(struct mmc_blk_data *md)  {
>  	struct mmc_card *card;
> @@ -1769,7 +1751,6 @@ static const struct mmc_fixup blk_fixups[] =  static
> int mmc_blk_probe(struct mmc_card *card)  {
>  	struct mmc_blk_data *md, *part_md;
> -	int err;
>  	char cap_str[10];
> 
>  	/*
> @@ -1782,10 +1763,6 @@ static int mmc_blk_probe(struct mmc_card *card)
>  	if (IS_ERR(md))
>  		return PTR_ERR(md);
> 
> -	err = mmc_blk_set_blksize(md, card);
> -	if (err)
> -		goto out;
> -
>  	string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2,
>  			cap_str, sizeof(cap_str));
>  	pr_info("%s: %s %s %s %s\n",
> @@ -1810,7 +1787,7 @@ static int mmc_blk_probe(struct mmc_card *card)
>   out:
>  	mmc_blk_remove_parts(card, md);
>  	mmc_blk_remove_req(md);
> -	return err;
> +	return 0;
>  }
> 
>  static void mmc_blk_remove(struct mmc_card *card) @@ -1846,8 +1823,6
> @@ static int mmc_blk_resume(struct mmc_card *card)
>  	struct mmc_blk_data *md = mmc_get_drvdata(card);
> 
>  	if (md) {
> -		mmc_blk_set_blksize(md, card);
> -
>  		/*
>  		 * Resume involves the card going into idle state,
>  		 * so current partition is always the main one.
> --
> 1.7.9
> 
> --
> 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] 6+ messages in thread

* Re: [PATCH] mmc: block: Remove use of mmc_blk_set_blksize
  2012-03-22 10:47 [PATCH] mmc: block: Remove use of mmc_blk_set_blksize Ulf Hansson
  2012-03-23  7:19 ` Subhash Jadavani
@ 2012-03-23  7:38 ` Jaehoon Chung
  2012-03-23 10:38   ` Ulf Hansson
  2012-04-01  3:52 ` Chris Ball
  2 siblings, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2012-03-23  7:38 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Chris Ball, Subhash Jadavani, Per Forlin,
	Johan Rudholm, Lee Jones

Hi Ulf.

Just one question.
mmc_blk_probe() is always returned 0?

Best Regards,
Jaehoon Chung

On 03/22/2012 07:47 PM, Ulf Hansson wrote:

> According to the specifications for SD and (e)MMC default
> blocksize (named BLOCKLEN in Spec.) must always be 512
> bytes. Since we hardcoded to always use 512 bytes, we do
> not explicitly have to set it. Future improvements should
> potentially make it possible to use a greater blocksize
> than 512 bytes, but until then let's skip this.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
> ---
>  drivers/mmc/card/block.c |   27 +--------------------------
>  1 files changed, 1 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index a7c75d8..ce171c6 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1624,24 +1624,6 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md)
>  	return ret;
>  }
>  
> -static int
> -mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
> -{
> -	int err;
> -
> -	mmc_claim_host(card->host);
> -	err = mmc_set_blocklen(card, 512);
> -	mmc_release_host(card->host);
> -
> -	if (err) {
> -		pr_err("%s: unable to set block size to 512: %d\n",
> -			md->disk->disk_name, err);
> -		return -EINVAL;
> -	}
> -
> -	return 0;
> -}
> -
>  static void mmc_blk_remove_req(struct mmc_blk_data *md)
>  {
>  	struct mmc_card *card;
> @@ -1769,7 +1751,6 @@ static const struct mmc_fixup blk_fixups[] =
>  static int mmc_blk_probe(struct mmc_card *card)
>  {
>  	struct mmc_blk_data *md, *part_md;
> -	int err;
>  	char cap_str[10];
>  
>  	/*
> @@ -1782,10 +1763,6 @@ static int mmc_blk_probe(struct mmc_card *card)
>  	if (IS_ERR(md))
>  		return PTR_ERR(md);
>  
> -	err = mmc_blk_set_blksize(md, card);
> -	if (err)
> -		goto out;
> -
>  	string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2,
>  			cap_str, sizeof(cap_str));
>  	pr_info("%s: %s %s %s %s\n",
> @@ -1810,7 +1787,7 @@ static int mmc_blk_probe(struct mmc_card *card)
>   out:
>  	mmc_blk_remove_parts(card, md);
>  	mmc_blk_remove_req(md);
> -	return err;
> +	return 0;
>  }
>  
>  static void mmc_blk_remove(struct mmc_card *card)
> @@ -1846,8 +1823,6 @@ static int mmc_blk_resume(struct mmc_card *card)
>  	struct mmc_blk_data *md = mmc_get_drvdata(card);
>  
>  	if (md) {
> -		mmc_blk_set_blksize(md, card);
> -
>  		/*
>  		 * Resume involves the card going into idle state,
>  		 * so current partition is always the main one.



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

* Re: [PATCH] mmc: block: Remove use of mmc_blk_set_blksize
  2012-03-23  7:38 ` Jaehoon Chung
@ 2012-03-23 10:38   ` Ulf Hansson
  2012-03-23 10:47     ` Jaehoon Chung
  0 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2012-03-23 10:38 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc@vger.kernel.org, Chris Ball, Subhash Jadavani,
	Per FORLIN, Johan RUDHOLM, Lee Jones

On 03/23/2012 08:38 AM, Jaehoon Chung wrote:
> Hi Ulf.
>
> Just one question.
> mmc_blk_probe() is always returned 0?

The idea was to not change behavior. Previously "err" was _only_ set to 
the return value of the mmc_blk_set_blksize.

Still mmc_blk_alloc_parts and mmc_add_disk, may fail but err is never 
updated, as before. Maybe we should look into that, but if a change is 
needed I suggest a separate patch for that.

Kind regards
Ulf Hansson

>
> Best Regards,
> Jaehoon Chung
>
> On 03/22/2012 07:47 PM, Ulf Hansson wrote:
>
>> According to the specifications for SD and (e)MMC default
>> blocksize (named BLOCKLEN in Spec.) must always be 512
>> bytes. Since we hardcoded to always use 512 bytes, we do
>> not explicitly have to set it. Future improvements should
>> potentially make it possible to use a greater blocksize
>> than 512 bytes, but until then let's skip this.
>>
>> Signed-off-by: Ulf Hansson<ulf.hansson@stericsson.com>
>> ---
>>   drivers/mmc/card/block.c |   27 +--------------------------
>>   1 files changed, 1 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>> index a7c75d8..ce171c6 100644
>> --- a/drivers/mmc/card/block.c
>> +++ b/drivers/mmc/card/block.c
>> @@ -1624,24 +1624,6 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md)
>>   	return ret;
>>   }
>>
>> -static int
>> -mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
>> -{
>> -	int err;
>> -
>> -	mmc_claim_host(card->host);
>> -	err = mmc_set_blocklen(card, 512);
>> -	mmc_release_host(card->host);
>> -
>> -	if (err) {
>> -		pr_err("%s: unable to set block size to 512: %d\n",
>> -			md->disk->disk_name, err);
>> -		return -EINVAL;
>> -	}
>> -
>> -	return 0;
>> -}
>> -
>>   static void mmc_blk_remove_req(struct mmc_blk_data *md)
>>   {
>>   	struct mmc_card *card;
>> @@ -1769,7 +1751,6 @@ static const struct mmc_fixup blk_fixups[] =
>>   static int mmc_blk_probe(struct mmc_card *card)
>>   {
>>   	struct mmc_blk_data *md, *part_md;
>> -	int err;
>>   	char cap_str[10];
>>
>>   	/*
>> @@ -1782,10 +1763,6 @@ static int mmc_blk_probe(struct mmc_card *card)
>>   	if (IS_ERR(md))
>>   		return PTR_ERR(md);
>>
>> -	err = mmc_blk_set_blksize(md, card);
>> -	if (err)
>> -		goto out;
>> -
>>   	string_get_size((u64)get_capacity(md->disk)<<  9, STRING_UNITS_2,
>>   			cap_str, sizeof(cap_str));
>>   	pr_info("%s: %s %s %s %s\n",
>> @@ -1810,7 +1787,7 @@ static int mmc_blk_probe(struct mmc_card *card)
>>    out:
>>   	mmc_blk_remove_parts(card, md);
>>   	mmc_blk_remove_req(md);
>> -	return err;
>> +	return 0;
>>   }
>>
>>   static void mmc_blk_remove(struct mmc_card *card)
>> @@ -1846,8 +1823,6 @@ static int mmc_blk_resume(struct mmc_card *card)
>>   	struct mmc_blk_data *md = mmc_get_drvdata(card);
>>
>>   	if (md) {
>> -		mmc_blk_set_blksize(md, card);
>> -
>>   		/*
>>   		 * Resume involves the card going into idle state,
>>   		 * so current partition is always the main one.
>
>
>


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

* Re: [PATCH] mmc: block: Remove use of mmc_blk_set_blksize
  2012-03-23 10:38   ` Ulf Hansson
@ 2012-03-23 10:47     ` Jaehoon Chung
  0 siblings, 0 replies; 6+ messages in thread
From: Jaehoon Chung @ 2012-03-23 10:47 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Jaehoon Chung, linux-mmc@vger.kernel.org, Chris Ball,
	Subhash Jadavani, Per FORLIN, Johan RUDHOLM, Lee Jones

Hi.

I think that your patch is not problem.
In original code, when mmc_blk_alloc_parts/mmc_add_disk is failed, also return 0.
That's wondering..

Thanks for your reply.

Best Regards,
Jaehoon Chung

On 03/23/2012 07:38 PM, Ulf Hansson wrote:

> On 03/23/2012 08:38 AM, Jaehoon Chung wrote:
>> Hi Ulf.
>>
>> Just one question.
>> mmc_blk_probe() is always returned 0?
> 
> The idea was to not change behavior. Previously "err" was _only_ set to the return value of the mmc_blk_set_blksize.

> 
> Still mmc_blk_alloc_parts and mmc_add_disk, may fail but err is never updated, as before. Maybe we should look into that, but if a change is needed I suggest a separate patch for that.
> 
> Kind regards
> Ulf Hansson
> 
>>
>> Best Regards,
>> Jaehoon Chung
>>
>> On 03/22/2012 07:47 PM, Ulf Hansson wrote:
>>
>>> According to the specifications for SD and (e)MMC default
>>> blocksize (named BLOCKLEN in Spec.) must always be 512
>>> bytes. Since we hardcoded to always use 512 bytes, we do
>>> not explicitly have to set it. Future improvements should
>>> potentially make it possible to use a greater blocksize
>>> than 512 bytes, but until then let's skip this.
>>>
>>> Signed-off-by: Ulf Hansson<ulf.hansson@stericsson.com>
>>> ---
>>>   drivers/mmc/card/block.c |   27 +--------------------------
>>>   1 files changed, 1 insertions(+), 26 deletions(-)
>>>
>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>>> index a7c75d8..ce171c6 100644
>>> --- a/drivers/mmc/card/block.c
>>> +++ b/drivers/mmc/card/block.c
>>> @@ -1624,24 +1624,6 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md)
>>>       return ret;
>>>   }
>>>
>>> -static int
>>> -mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
>>> -{
>>> -    int err;
>>> -
>>> -    mmc_claim_host(card->host);
>>> -    err = mmc_set_blocklen(card, 512);
>>> -    mmc_release_host(card->host);
>>> -
>>> -    if (err) {
>>> -        pr_err("%s: unable to set block size to 512: %d\n",
>>> -            md->disk->disk_name, err);
>>> -        return -EINVAL;
>>> -    }
>>> -
>>> -    return 0;
>>> -}
>>> -
>>>   static void mmc_blk_remove_req(struct mmc_blk_data *md)
>>>   {
>>>       struct mmc_card *card;
>>> @@ -1769,7 +1751,6 @@ static const struct mmc_fixup blk_fixups[] =
>>>   static int mmc_blk_probe(struct mmc_card *card)
>>>   {
>>>       struct mmc_blk_data *md, *part_md;
>>> -    int err;
>>>       char cap_str[10];
>>>
>>>       /*
>>> @@ -1782,10 +1763,6 @@ static int mmc_blk_probe(struct mmc_card *card)
>>>       if (IS_ERR(md))
>>>           return PTR_ERR(md);
>>>
>>> -    err = mmc_blk_set_blksize(md, card);
>>> -    if (err)
>>> -        goto out;
>>> -
>>>       string_get_size((u64)get_capacity(md->disk)<<  9, STRING_UNITS_2,
>>>               cap_str, sizeof(cap_str));
>>>       pr_info("%s: %s %s %s %s\n",
>>> @@ -1810,7 +1787,7 @@ static int mmc_blk_probe(struct mmc_card *card)
>>>    out:
>>>       mmc_blk_remove_parts(card, md);
>>>       mmc_blk_remove_req(md);
>>> -    return err;
>>> +    return 0;
>>>   }
>>>
>>>   static void mmc_blk_remove(struct mmc_card *card)
>>> @@ -1846,8 +1823,6 @@ static int mmc_blk_resume(struct mmc_card *card)
>>>       struct mmc_blk_data *md = mmc_get_drvdata(card);
>>>
>>>       if (md) {
>>> -        mmc_blk_set_blksize(md, card);
>>> -
>>>           /*
>>>            * Resume involves the card going into idle state,
>>>            * so current partition is always the main one.
>>
>>
>>
> 
> -- 
> 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] 6+ messages in thread

* Re: [PATCH] mmc: block: Remove use of mmc_blk_set_blksize
  2012-03-22 10:47 [PATCH] mmc: block: Remove use of mmc_blk_set_blksize Ulf Hansson
  2012-03-23  7:19 ` Subhash Jadavani
  2012-03-23  7:38 ` Jaehoon Chung
@ 2012-04-01  3:52 ` Chris Ball
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2012-04-01  3:52 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Subhash Jadavani, Per Forlin, Johan Rudholm, Lee Jones

Hi,

On Thu, Mar 22 2012, Ulf Hansson wrote:
> According to the specifications for SD and (e)MMC default
> blocksize (named BLOCKLEN in Spec.) must always be 512
> bytes. Since we hardcoded to always use 512 bytes, we do
> not explicitly have to set it. Future improvements should
> potentially make it possible to use a greater blocksize
> than 512 bytes, but until then let's skip this.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>

Thanks, pushed to mmc-next for 3.5 with Subhash's Reviewed-by.

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

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

end of thread, other threads:[~2012-04-01  3:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 10:47 [PATCH] mmc: block: Remove use of mmc_blk_set_blksize Ulf Hansson
2012-03-23  7:19 ` Subhash Jadavani
2012-03-23  7:38 ` Jaehoon Chung
2012-03-23 10:38   ` Ulf Hansson
2012-03-23 10:47     ` Jaehoon Chung
2012-04-01  3:52 ` Chris Ball

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.