[U-Boot] [PATCH V2 1/2] mmc: change magic number to macro define

Lei Wen adrian.wenl at gmail.com
Fri Oct 14 05:18:35 CEST 2011


Hi Wolfgang,

On Fri, Oct 14, 2011 at 4:09 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Lei Wen,
>
> In message <CALButC+bZZwYhE0VT99Yjh_=p0LVJqNMM1yVZSEX3inuTn7PcQ at mail.gmail.com> Graeme Russ wrote:
>>
>> > So do you means I should keep the EXT_CSD_HS_TIMING? Or I change like below?
>> >
>> > from
>> > err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
>> > to:
>> > err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, &ext_csd.hs_timing - &ext_csd, 1);
>>
>> I imagine the compiler will complain that the types for &ext_csd.hs_timing
>> and &ext_csd are different.
>>
>> Try:
>>       struct ext_csd *ext_csd_ptr = 0;
>>
>>       err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, &ext_csd_ptr->hs_timing, 1);
>
> Umm... no.
>
> The signature of mmc_switch() [as used here - there is also a two
> argument version; what a mess!] is:
>
>        int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value)
>
> The "set" argument is bous, as the function never uses it anywhere.
>
> And both the "index" and "value" arguments are never used in I/O
> context, i. e. they are actual plain integer parameters.  So just keep
> it as
>
>        err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
>
>

Should I also keep the EXT_CSD_HS_TIMING like macro for previous
ext_csd parsing?
Or just add another ext_csd structure definition to the parse the
ext_csd, while keep macros
to be called by mmc_switch?

Thanks,
Lei


More information about the U-Boot mailing list