[U-Boot] [PATCH v2 4/7] mmc: rescan fails on empty slot
Michael Jones
michael.jones at matrix-vision.de
Wed Aug 17 09:46:20 CEST 2011
Hi Andy,
On 08/17/2011 04:30 AM, Andy Fleming wrote:
>
> Ok, I feel dumb. I apparently applied this already. But I'm still
> interested in a response to my comments/questions. :)
OK, I'll humor you :)
>
> On Tue, Aug 16, 2011 at 9:15 PM, Andy Fleming <afleming at gmail.com> wrote:
>> On Mon, Jul 18, 2011 at 9:40 AM, Michael Jones
>> <michael.jones at matrix-vision.de> wrote:
>>> Fail in 'mmc rescan' if mmc_init() returns error
>>
>> I think, if we're going to do this, we should change them all.
I agree it would be logical to return failed from the other mmc commands
if mmc_init() fails. I can submit such a patch for that if you want
after we agree the best way to structure the 'return' (see below).
>>
>> Also, for the purpose you want, it seems like we should consider
>> adding or modifying a command to just report whether the slot has a
>> card.
Yes, that would be logical and tidier than the current solution.
However, the way it is now also meets my needs, although it's ugly
because it prints "Card did not respond to voltage select!".
>>
>>
>>>
>>> Signed-off-by: Michael Jones <michael.jones at matrix-vision.de>
>>> ---
>>> Changes for v2:
>>> - None. Resubmitting to include custodian in cc:
>>>
>>> common/cmd_mmc.c | 6 ++++--
>>> 1 files changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
>>> index 176646d..28918f6 100644
>>> --- a/common/cmd_mmc.c
>>> +++ b/common/cmd_mmc.c
>>> @@ -165,9 +165,11 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>> }
>>>
>>> mmc->has_init = 0;
>>> - mmc_init(mmc);
>>>
>>> - return 0;
>>> + if (mmc_init(mmc))
>>> + return 1;
>>> + else
>>> + return 0;
>>
>>
>> Is there a reason to return 1 instead of returning whatever error
>> mmc_init() returns?
>>
>> ie:
>>
>> return mmc_init(mmc);
It looked to me like do_mmcops should only return either a 1 for fail or
0 for success. mmc_init() returns UNUSABLE_ERR (interesting that it's
not NO_CARD_ERR) when there is no card.
This is the command I wanted to enable with the patch:
if mmc rescan; then echo "rescan true"; else echo "rescan false"; fi;
As it is, when the slot is empty this prints:
Card did not respond to voltage select!
rescan false
If UNUSABLE_ERR is returned directly from do_mmcops, I get:
Card did not respond to voltage select!
exit not allowed from main input shell.
Do you want something more compact like 'return !!mmc_init(mmc)' or
return mmc_init(mmc) ? 1 : 0; ?
>>
>>
>> Andy
>>
-Michael
MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier
More information about the U-Boot
mailing list