[U-Boot] [PATCH V2 2/2] MMC: add erase function to both mmc and sd

Lei Wen adrian.wenl at gmail.com
Thu Jun 23 05:05:15 CEST 2011


Hi Mike,

On Thu, Jun 23, 2011 at 12:57 AM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Monday, June 20, 2011 10:10:16 Lei Wen wrote:
>> +             if (state == MMC_ERASE) {
>> +                     blk = simple_strtoul(argv[2], NULL, 16);
>> +                     cnt = simple_strtoul(argv[3], NULL, 16);
>> +             } else {
>> +                     addr = (void *)simple_strtoul(argv[2], NULL, 16);
>> +                     blk = simple_strtoul(argv[3], NULL, 16);
>> +                     cnt = simple_strtoul(argv[4], NULL, 16);
>> +             }
>
> you could do:
>        char **args = &argv[2];
>        if (state != MMC_ERASE) {
>                addr = (void *)simple_strtoul(args[0], NULL, 16);
>                ++args;
>        } else
>                addr = 0;
>        blk = simple_strtoul(args[0], NULL, 16);
>        simple_strtoul(args[1], NULL, 16);
>
>> +     "mmc erase addr blk# cnt\n"
>
> i dont think the "erase" cmd takes an addr
>
>> +err_out:
>> +     printf("mmc erase failed\n\r");
>
> dont use \r in strings, and use puts()

Thanks for comments, new version pushed with your suggestion involved.

Best regards,
Lei


More information about the U-Boot mailing list