]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
sandbox: Fix warnings due to 64-bit printf() strings
authorSimon Glass <sjg@chromium.org>
Tue, 11 Nov 2014 19:47:07 +0000 (12:47 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 27 Nov 2014 03:25:39 +0000 (20:25 -0700)
Now that we have inttypes.h, use it in a few more places to avoid compiler
warnings on sandbox when building on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/cmd_mem.c
common/fdt_support.c
disk/part_efi.c

index 0d50dcfe9c1b8083a35f3cc6df5796a12a0149a2..bcb3ee325ac9ceaf217bbbe7f86118b55aa1b116 100644 (file)
@@ -19,6 +19,7 @@
 #include <dataflash.h>
 #endif
 #include <hash.h>
+#include <inttypes.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <linux/compiler.h>
@@ -338,7 +339,8 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if (word1 != word2) {
                        ulong offset = buf1 - base;
 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
-                       printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
+                       printf("%s at 0x%p (%#0*"PRIx64") != %s at 0x%p (%#0*"
+                              PRIx64 ")\n",
                               type, (void *)(addr1 + offset), size, word1,
                               type, (void *)(addr2 + offset), size, word2);
 #else
@@ -1146,7 +1148,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
                        printf(" %08x", *((u32 *)ptr));
 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
                else if (size == 8)
-                       printf(" %016llx", *((u64 *)ptr));
+                       printf(" %016" PRIx64, *((u64 *)ptr));
 #endif
                else if (size == 2)
                        printf(" %04x", *((u16 *)ptr));
index ea42c63eaafd74300374dd5734726f6a64aaf8e3..127e17c114310fa0b5fbbd12a4968f510a3c1b9a 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <inttypes.h>
 #include <stdio_dev.h>
 #include <linux/ctype.h>
 #include <linux/types.h>
@@ -914,8 +915,6 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
        fdt_delprop(blob, off, alias);
 }
 
-#define PRu64  "%llx"
-
 /* Max address size we deal with */
 #define OF_MAX_ADDR_CELLS      4
 #define OF_BAD_ADDR    ((u64)-1)
@@ -973,8 +972,8 @@ static u64 of_bus_default_map(fdt32_t *addr, const fdt32_t *range,
        s  = of_read_number(range + na + pna, ns);
        da = of_read_number(addr, na);
 
-       debug("OF: default map, cp="PRu64", s="PRu64", da="PRu64"\n",
-           cp, s, da);
+       debug("OF: default map, cp=%" PRIu64 ", s=%" PRIu64
+             ", da=%" PRIu64 "\n", cp, s, da);
 
        if (da < cp || da >= (cp + s))
                return OF_BAD_ADDR;
@@ -1052,7 +1051,7 @@ static int of_translate_one(void * blob, int parent, struct of_bus *bus,
 
  finish:
        of_dump_addr("OF: parent translation for:", addr, pna);
-       debug("OF: with offset: "PRu64"\n", offset);
+       debug("OF: with offset: %" PRIu64 "\n", offset);
 
        /* Translate it into parent bus space */
        return pbus->translate(addr, offset, pna);
@@ -1381,9 +1380,9 @@ int fdt_verify_alias_address(void *fdt, int anode, const char *alias, u64 addr)
 
        dt_addr = fdt_translate_address(fdt, node, reg);
        if (addr != dt_addr) {
-               printf("Warning: U-Boot configured device %s at address %llx,\n"
-                      " but the device tree has it address %llx.\n",
-                      alias, addr, dt_addr);
+               printf("Warning: U-Boot configured device %s at address %"
+                      PRIx64 ",\n but the device tree has it address %"
+                      PRIx64 ".\n", alias, addr, dt_addr);
                return 0;
        }
 
index 612f0926b62bbceb8b35ef9fc6aa259145c35c95..efed58f81dac27ddcd1498a28ca8b80673138bda 100644 (file)
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <command.h>
 #include <ide.h>
+#include <inttypes.h>
 #include <malloc.h>
 #include <part_efi.h>
 #include <linux/ctype.h>
@@ -553,28 +554,28 @@ 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 != %llX\n",
-                       le64_to_cpu(pgpt_head->my_lba),
-                       lba);
+               printf("GPT: my_lba incorrect: %llX != %" PRIX64 "\n",
+                      le64_to_cpu(pgpt_head->my_lba),
+                      lba);
                return 0;
        }
 
        /* 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 > %llX\n",
-                       le64_to_cpu(pgpt_head->first_usable_lba), lastlba);
+               printf("GPT: first_usable_lba incorrect: %llX > %" 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 > %llX\n",
-                       le64_to_cpu(pgpt_head->last_usable_lba), lastlba);
+               printf("GPT: last_usable_lba incorrect: %llX > %" 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 %llX\n",
-               le64_to_cpu(pgpt_head->first_usable_lba),
-               le64_to_cpu(pgpt_head->last_usable_lba), lastlba);
+       debug("GPT: first_usable_lba: %llX last_usable_lba %llX last lba %"
+             PRIX64 "\n", le64_to_cpu(pgpt_head->first_usable_lba),
+             le64_to_cpu(pgpt_head->last_usable_lba), lastlba);
 
        /* Read and allocate Partition Table Entries */
        *pgpt_pte = alloc_read_gpt_entries(dev_desc, pgpt_head);