[U-Boot] [PATCH v4 4/7] gpt: The leXX_to_int() calls replaced with ones defined at <compiler.h>

Stephen Warren swarren at wwwdotorg.org
Mon Nov 19 20:39:43 CET 2012


On 11/09/2012 03:48 AM, Piotr Wilczek wrote:
> Custom definitions of le_XX_to_int functions have been replaced with
> standard ones, defined at <compiler.h>
> 
> Replacement of several GPT related structures members with ones
> indicating its endianness and proper size.

> diff --git a/disk/part_efi.c b/disk/part_efi.c

>  		printf("%3d\t0x%08llx\t0x%08llx\t\"%s\"\n", (i + 1),
> -			le64_to_int(gpt_pte[i].starting_lba),
> -			le64_to_int(gpt_pte[i].ending_lba),
> +			(u64) le64_to_cpu(gpt_pte[i].starting_lba),
> +			(u64) le64_to_cpu(gpt_pte[i].ending_lba),

I don't think there should be a space after the cast. Why doesn't
le64_to_cpu() return a u64? The same comments apply to many diffs in
this patch.

> -	if (calc_crc32 != le32_to_int(crc32_backup)) {
> +	if (calc_crc32 != le32_to_cpu(crc32_backup)) {
>  		printf("GUID Partition Table Header CRC is wrong:"
> -			"0x%08lX != 0x%08lX\n",
> -			le32_to_int(crc32_backup), calc_crc32);
> +			"0x%x != 0x%x\n",
> +		       (u32) le32_to_cpu(crc32_backup), calc_crc32);

Indentation looks wrong (some lines use spaces, some TABs).

> -	if (calc_crc32 != le32_to_int(pgpt_head->partition_entry_array_crc32)) {
> +	if (calc_crc32 != le32_to_cpu(pgpt_head->partition_entry_array_crc32)) {
>  		printf("GUID Partition Table Entry Array CRC is wrong:"
> -			"0x%08lX != 0x%08lX\n",
> -			le32_to_int(pgpt_head->partition_entry_array_crc32),
> +			"0x%x != 0x%x\n",
> +		       (u32)le32_to_cpu(pgpt_head->partition_entry_array_crc32),

Same here.

Aside from that, briefly,
Reviewed-by: Stephen Warren <swarren at nvidia.com>


More information about the U-Boot mailing list