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

Wolfgang Denk wd at denx.de
Thu Oct 13 22:09:03 CEST 2011


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);


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
That Microsoft, the Trabant of the operating  system  world,  may  be
glancing  over the Berlin Wall at the Audis and BMWs and Mercedes. In
their own universe Trabants and Ladas were mainstream too...
                                                   -- Evan Leibovitch


More information about the U-Boot mailing list