[U-Boot] [PATCH 2/2] mmc: rpmb: update size format for write_counter

Lothar Waßmann LW at KARO-electronics.de
Mon Jun 19 06:42:21 UTC 2017


Hi,

On Tue, 13 Jun 2017 10:11:17 +0800 Kever Yang wrote:
> Hi Simon,
> 
> 
> On 06/09/2017 08:28 PM, Simon Glass wrote:
> > On 7 June 2017 at 19:20, Kever Yang <kever.yang at rock-chips.com> wrote:
> >> According to MMC spec, the write_counter is 4-byte length,
> >> use 'int' instead of 'long' type for the 'long' is not 4-byte
> >> in 64 bit CPU.
> >>
> >> Signed-off-by: Jason Zhu <jason.zhu at rock-chips.com>
> >> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
> >> ---
> >>
> >>   drivers/mmc/rpmb.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > So should we use uint32_t?
> 
> Yes, we can use uint32_t, I use 'unsigned int' just for the same format 
> with other
> members in the structure which using unsigned char/short.
> 
> Is there a doc for which kind of data format prefer to use first in U-Boot?
> unsigned int, uint32_t, u32;
> 
uint32_t is guaranteed to be of size 32bit according to the C spec.
'[unsigned] int' is only guaranteed to be at least 32bit but can be
larger on some machine.
A good overview of the C data types and their properties can be found
at: https://en.wikipedia.org/wiki/C_data_types


Lothar Waßmann


More information about the U-Boot mailing list