All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc-uclass: correct the device number
@ 2016-07-18  9:52 Kever Yang
  2016-07-18 11:55 ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Kever Yang @ 2016-07-18  9:52 UTC (permalink / raw)
  To: u-boot

The devnum in is start from 0, so the device number should be
(devnum+1).

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 drivers/mmc/mmc-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 38ced41..7c40d24 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -111,7 +111,7 @@ struct mmc *find_mmc_device(int dev_num)
 
 int get_mmc_num(void)
 {
-	return max(blk_find_max_devnum(IF_TYPE_MMC), 0);
+	return max((blk_find_max_devnum(IF_TYPE_MMC)+1), 0);
 }
 
 int mmc_get_next_devnum(void)
-- 
1.9.1

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

* [U-Boot] [PATCH] mmc-uclass: correct the device number
  2016-07-18  9:52 [U-Boot] [PATCH] mmc-uclass: correct the device number Kever Yang
@ 2016-07-18 11:55 ` Simon Glass
  2016-07-19  9:19   ` Kever Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2016-07-18 11:55 UTC (permalink / raw)
  To: u-boot

Hi Kever,

On 18 July 2016 at 03:52, Kever Yang <kever.yang@rock-chips.com> wrote:
> The devnum in is start from 0, so the device number should be
> (devnum+1).
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
>  drivers/mmc/mmc-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 38ced41..7c40d24 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -111,7 +111,7 @@ struct mmc *find_mmc_device(int dev_num)
>
>  int get_mmc_num(void)
>  {
> -       return max(blk_find_max_devnum(IF_TYPE_MMC), 0);
> +       return max((blk_find_max_devnum(IF_TYPE_MMC)+1), 0);

Please add spaces around the +

Also can you add a comment to the function in mmc.h describing what it
should do? From what you are saying it should return the number of mmc
devices.

Also you will need to adjust mmc_get_next_devnum() which uses this function.

>  }
>
>  int mmc_get_next_devnum(void)
> --
> 1.9.1
>
>

Regards,
Simon

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

* [U-Boot] [PATCH] mmc-uclass: correct the device number
  2016-07-18 11:55 ` Simon Glass
@ 2016-07-19  9:19   ` Kever Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Kever Yang @ 2016-07-19  9:19 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 07/18/2016 07:55 PM, Simon Glass wrote:
> Hi Kever,
>
> On 18 July 2016 at 03:52, Kever Yang <kever.yang@rock-chips.com> wrote:
>> The devnum in is start from 0, so the device number should be
>> (devnum+1).
>>
>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> ---
>>
>>   drivers/mmc/mmc-uclass.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
>> index 38ced41..7c40d24 100644
>> --- a/drivers/mmc/mmc-uclass.c
>> +++ b/drivers/mmc/mmc-uclass.c
>> @@ -111,7 +111,7 @@ struct mmc *find_mmc_device(int dev_num)
>>
>>   int get_mmc_num(void)
>>   {
>> -       return max(blk_find_max_devnum(IF_TYPE_MMC), 0);
>> +       return max((blk_find_max_devnum(IF_TYPE_MMC)+1), 0);
> Please add spaces around the +
>
> Also can you add a comment to the function in mmc.h describing what it
> should do? From what you are saying it should return the number of mmc
> devices.
>
> Also you will need to adjust mmc_get_next_devnum() which uses this function.
>
Sure, checkpatch script did not give me an error report for the format :(

For mmc_get_next_devnum(), not like legacy mmc, no one use it in mmc-uclass,
are we still need this function? blk_find_max_devnum() is used in 
blk_create_device.

Thanks,
- Kever
>>   }
>>
>>   int mmc_get_next_devnum(void)
>> --
>> 1.9.1
>>
>>
> Regards,
> Simon
>
>
>

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

end of thread, other threads:[~2016-07-19  9:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18  9:52 [U-Boot] [PATCH] mmc-uclass: correct the device number Kever Yang
2016-07-18 11:55 ` Simon Glass
2016-07-19  9:19   ` Kever Yang

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.