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

Simon Glass sjg at chromium.org
Sat Jun 17 03:40:36 UTC 2017


On 12 June 2017 at 20:11, Kever Yang <kever.yang at rock-chips.com> 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;

Reviewed-by: Simon Glass <sjg at chromium.org>

Well I am mostly wondering about what happens on a 64-bit machine
where this would be 64-bits long. There is also u32 which is shorter.

>
> Thanks,
> - Kever
>
>>> diff --git a/drivers/mmc/rpmb.c b/drivers/mmc/rpmb.c
>>> index 1c6888f..0b6b622 100644
>>> --- a/drivers/mmc/rpmb.c
>>> +++ b/drivers/mmc/rpmb.c
>>> @@ -67,7 +67,7 @@ struct s_rpmb {
>>>          unsigned char mac[RPMB_SZ_MAC];
>>>          unsigned char data[RPMB_SZ_DATA];
>>>          unsigned char nonce[RPMB_SZ_NONCE];
>>> -       unsigned long write_counter;
>>> +       unsigned int write_counter;
>>>          unsigned short address;
>>>          unsigned short block_count;
>>>          unsigned short result;
>>> --
>>> 1.9.1
>>>
>
>


More information about the U-Boot mailing list