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

Lei Wen adrian.wenl at gmail.com
Mon Oct 10 16:44:42 CEST 2011


Hi Wolfgang,

On Fri, Oct 7, 2011 at 1:39 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Lei Wen,
>
> In message <CALZhoSRhbf2vMU5oLP3Hwh4yQ4xFip19aJD24Gn4sy-RM6B+Eg at mail.gmail.com> you wrote:
>>
>> The ext_csd current usage in mmc.c is not too much, here I mean only few of
>> the fields of the ext_csd is used, also fully definition of ext_csd
>> member would seems so huge a structure at its appearence...
>>
>> So macro may looks more concise and could parse from its meaning easily eno=
>> ugh.
>
> We do not accept (typeless) register offset definitions. Please use a
> struct, so the compiler has a chance to perform type checking.
>

I check the code again, and find there is a reason for previous
defined macro to use.
That is those register offset defined as macro may need later passing
as a function
parameter like:
        err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);

So if the ext_csd change to structure, maybe the function call here
don't looks like so
concise as before... What do you think for this?

Thanks,
Lei


More information about the U-Boot mailing list