From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] dm: mmc: Add the function for getting current device number
Date: Fri, 15 Jul 2016 10:28:50 +0900 [thread overview]
Message-ID: <57883C52.6050409@samsung.com> (raw)
In-Reply-To: <CAPnjgZ1QHOhCRVdBpfHc16AYXX5rv5h7t5bqJS-2ZN4+W_ooCQ@mail.gmail.com>
On 07/13/2016 06:57 AM, Simon Glass wrote:
> Hi Jaehoon,
>
> On 4 July 2016 at 01:40, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> get_mmc_num can be returned 0. Then if you use the "mmcinfo" command, it
>> can't print the mmc information.
>> If get_mmc_num is 0, it means that there is not mmc device.
>> So it added the get_mmc_curr_num() function for getting current device
>> number(index). And get_mmc_num() is returned the number of device.
>>
>> This patch is only tested with mmc block..so i didn't touch the
>> blk-uclass.c.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>> drivers/mmc/mmc-uclass.c | 12 +++++++++++-
>> 1 file changed, 11 insertions(+), 1 deletion(-)
>>
>
> Can you please add a function comment for get_mmc_num() in the header
> file? It's not really clear what is supposed to return.
>
> Also there are two implementations - one in the uclass and one in
> mmc_legacy.c. If the latter does not need changing, can you please add
> a comment in your commit as to why?
Ok, I will add the explanation in more detail.
>
> Can you repeat this problem with sandbox?
I will check this problem with sandbox. After that, i will share..
>
>> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
>> index 38ced41..a3f2463 100644
>> --- a/drivers/mmc/mmc-uclass.c
>> +++ b/drivers/mmc/mmc-uclass.c
>> @@ -111,6 +111,16 @@ struct mmc *find_mmc_device(int dev_num)
>>
>> int get_mmc_num(void)
>> {
>> + int devnum = blk_find_max_devnum(IF_TYPE_MMC);
>> +
>> + if (devnum < 0)
>> + return devnum;
>> +
>> + return devnum + 1;
>> +}
>> +
>> +static int get_mmc_curr_num(void)
>> +{
>> return max(blk_find_max_devnum(IF_TYPE_MMC), 0);
>> }
>>
>> @@ -118,7 +128,7 @@ int mmc_get_next_devnum(void)
>> {
>> int ret;
>>
>> - ret = get_mmc_num();
>> + ret = get_mmc_curr_num();
>> if (ret < 0)
>> return ret;
>
> But get_mmc_curr_num() cannot return < 0
You're right. It's my mistake.
Best Regards,
Jaehoon Chung
>
>>
>> --
>> 1.9.1
>>
>
> Regards,
> Simon
>
>
>
prev parent reply other threads:[~2016-07-15 1:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 7:40 [U-Boot] [PATCH] dm: mmc: Add the function for getting current device number Jaehoon Chung
2016-07-12 21:57 ` Simon Glass
2016-07-15 1:28 ` Jaehoon Chung [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57883C52.6050409@samsung.com \
--to=jh80.chung@samsung.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.