[U-Boot] [PATCH 5/7] Replace "llx" with PRIx64 to fix warnings on sandbox (MAD)

Masahiro Yamada yamada.m at jp.panasonic.com
Mon Dec 22 11:16:01 CET 2014


These must be fixed to fix sandbox at least.
(Horrible things are happening on the other boards, of course.)

If we include <stdint.h>, we do not know 64bit-types are defined
as "unsigned long long" or "unsigned long".
(As for my 64bit GCC, __UINT64_TYPE__ is "long unsigned int")

We cannot hard-code "%llx" in printf() or friends anymore.
We must always use PRIx64 etc.

(As Documentation/printk-formats.txt clearly says, Linux Kernel
always uses "%llx" to print 64bit variables, and U-Boot used to do that.
But we lost the convenience by commit 0d296cc and commit 4166ecb24)

Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
Cc: Gabe Black <gabeblack at chromium.org>
Cc: Simon Glass <sjg at chromium.org>
Cc: Bill Richardson <wfrichar at google.com>
Cc: Tom Rini <trini at ti.com>
---

 common/fdt_support.c |  2 +-
 disk/part_efi.c      | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 8266bca..6211a82 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1533,7 +1533,7 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width,
 	if (ret < 0)
 		return ret;
 
-	snprintf(name, sizeof(name), "framebuffer@%llx", base_address);
+	snprintf(name, sizeof(name), "framebuffer@%" PRIx64, base_address);
 	ret = fdt_set_name(fdt, node, name);
 	if (ret < 0)
 		return ret;
diff --git a/disk/part_efi.c b/disk/part_efi.c
index efed58f..3fe280d 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -113,7 +113,7 @@ void print_part_efi(block_dev_desc_t * dev_desc)
 		if (!is_pte_valid(&gpt_pte[i]))
 			break;
 
-		printf("%3d\t0x%08llx\t0x%08llx\t\"%s\"\n", (i + 1),
+		printf("%3d\t0x%08" PRIx64 "\t0x%08" PRIx64 "\t\"%s\"\n", (i + 1),
 			le64_to_cpu(gpt_pte[i].starting_lba),
 			le64_to_cpu(gpt_pte[i].ending_lba),
 			print_efiname(&gpt_pte[i]));
@@ -530,7 +530,7 @@ static int is_gpt_valid(block_dev_desc_t *dev_desc, u64 lba,
 	/* Check the GPT header signature */
 	if (le64_to_cpu(pgpt_head->signature) != GPT_HEADER_SIGNATURE) {
 		printf("GUID Partition Table Header signature is wrong:"
-			"0x%llX != 0x%llX\n",
+			"0x%" PRIX64 " != 0x%llX\n",
 			le64_to_cpu(pgpt_head->signature),
 			GPT_HEADER_SIGNATURE);
 		return 0;
@@ -554,7 +554,7 @@ static int is_gpt_valid(block_dev_desc_t *dev_desc, u64 lba,
 
 	/* Check that the my_lba entry points to the LBA that contains the GPT */
 	if (le64_to_cpu(pgpt_head->my_lba) != lba) {
-		printf("GPT: my_lba incorrect: %llX != %" PRIX64 "\n",
+		printf("GPT: my_lba incorrect: %" PRIX64 " != %" PRIX64 "\n",
 		       le64_to_cpu(pgpt_head->my_lba),
 		       lba);
 		return 0;
@@ -563,17 +563,17 @@ static int is_gpt_valid(block_dev_desc_t *dev_desc, u64 lba,
 	/* Check the first_usable_lba and last_usable_lba are within the disk. */
 	lastlba = (u64)dev_desc->lba;
 	if (le64_to_cpu(pgpt_head->first_usable_lba) > lastlba) {
-		printf("GPT: first_usable_lba incorrect: %llX > %" PRIX64 "\n",
+		printf("GPT: first_usable_lba incorrect: %" PRIX64 " > %" PRIX64 "\n",
 		       le64_to_cpu(pgpt_head->first_usable_lba), lastlba);
 		return 0;
 	}
 	if (le64_to_cpu(pgpt_head->last_usable_lba) > lastlba) {
-		printf("GPT: last_usable_lba incorrect: %llX > %" PRIX64 "\n",
+		printf("GPT: last_usable_lba incorrect: %" PRIx64 "  > %" PRIX64 "\n",
 		       le64_to_cpu(pgpt_head->last_usable_lba), lastlba);
 		return 0;
 	}
 
-	debug("GPT: first_usable_lba: %llX last_usable_lba %llX last lba %"
+	debug("GPT: first_usable_lba: %" PRIx64 "last_usable_lba %" PRIX64 " last lba %"
 	      PRIX64 "\n", le64_to_cpu(pgpt_head->first_usable_lba),
 	      le64_to_cpu(pgpt_head->last_usable_lba), lastlba);
 
-- 
1.9.1



More information about the U-Boot mailing list