diff mbox series

[U-Boot] common: fdt_support: print hexadecimal numbers in debug

Message ID 20181205094555.24630-1-nsekhar@ti.com
State Superseded
Delegated to: Simon Glass
Headers show
Series [U-Boot] common: fdt_support: print hexadecimal numbers in debug | expand

Commit Message

Sekhar Nori Dec. 5, 2018, 9:45 a.m. UTC
We usually deal with hexadecimal addresses and sizes in
device-tree. Its much easier if debug logs print hexadecimal
values too.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 common/fdt_support.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Glass Dec. 6, 2018, 1:31 a.m. UTC | #1
On Wed, 5 Dec 2018 at 02:46, Sekhar Nori <nsekhar@ti.com> wrote:
>
> We usually deal with hexadecimal addresses and sizes in
> device-tree. Its much easier if debug logs print hexadecimal
> values too.
>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
>  common/fdt_support.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

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


> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 3440e42a257b..194bb41d1414 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -1025,7 +1025,7 @@ static u64 of_bus_default_map(fdt32_t *addr, const fdt32_t *range,
>         s  = fdt_read_number(range + na + pna, ns);
>         da = fdt_read_number(addr, na);
>
> -       debug("OF: default map, cp=%llu, s=%llu, da=%llu\n", cp, s, da);
> +       debug("OF: default map, cp=0x%llx, s=0x%llx, da=0x%llx\n", cp, s, da);

Note you probably don't need the 0x, since U-Boot uses hex by default.
But if you do want it, you can use %#x.

>
>         if (da < cp || da >= (cp + s))
>                 return OF_BAD_ADDR;
> @@ -1080,7 +1080,7 @@ static u64 of_bus_isa_map(fdt32_t *addr, const fdt32_t *range,
>         s  = fdt_read_number(range + na + pna, ns);
>         da = fdt_read_number(addr + 1, na - 1);
>
> -       debug("OF: ISA map, cp=%llu, s=%llu, da=%llu\n", cp, s, da);
> +       debug("OF: ISA map, cp=0x%llx, s=0x%llx, da=0x%llx\n", cp, s, da);
>
>         if (da < cp || da >= (cp + s))
>                 return OF_BAD_ADDR;
> --
> 2.16.2
>
Sekhar Nori Dec. 6, 2018, 9:51 a.m. UTC | #2
On 06/12/18 7:01 AM, Simon Glass wrote:
> On Wed, 5 Dec 2018 at 02:46, Sekhar Nori <nsekhar@ti.com> wrote:
>>
>> We usually deal with hexadecimal addresses and sizes in
>> device-tree. Its much easier if debug logs print hexadecimal
>> values too.
>>
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>> ---
>>  common/fdt_support.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> 
>> diff --git a/common/fdt_support.c b/common/fdt_support.c
>> index 3440e42a257b..194bb41d1414 100644
>> --- a/common/fdt_support.c
>> +++ b/common/fdt_support.c
>> @@ -1025,7 +1025,7 @@ static u64 of_bus_default_map(fdt32_t *addr, const fdt32_t *range,
>>         s  = fdt_read_number(range + na + pna, ns);
>>         da = fdt_read_number(addr, na);
>>
>> -       debug("OF: default map, cp=%llu, s=%llu, da=%llu\n", cp, s, da);
>> +       debug("OF: default map, cp=0x%llx, s=0x%llx, da=0x%llx\n", cp, s, da);
> 
> Note you probably don't need the 0x, since U-Boot uses hex by default.
> But if you do want it, you can use %#x.

Thanks for the tip! I chose to drop the 0x instead to remain consistent
with rest of U-Boot. v2 posted.

Thanks,
Sekhar
diff mbox series

Patch

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 3440e42a257b..194bb41d1414 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1025,7 +1025,7 @@  static u64 of_bus_default_map(fdt32_t *addr, const fdt32_t *range,
 	s  = fdt_read_number(range + na + pna, ns);
 	da = fdt_read_number(addr, na);
 
-	debug("OF: default map, cp=%llu, s=%llu, da=%llu\n", cp, s, da);
+	debug("OF: default map, cp=0x%llx, s=0x%llx, da=0x%llx\n", cp, s, da);
 
 	if (da < cp || da >= (cp + s))
 		return OF_BAD_ADDR;
@@ -1080,7 +1080,7 @@  static u64 of_bus_isa_map(fdt32_t *addr, const fdt32_t *range,
 	s  = fdt_read_number(range + na + pna, ns);
 	da = fdt_read_number(addr + 1, na - 1);
 
-	debug("OF: ISA map, cp=%llu, s=%llu, da=%llu\n", cp, s, da);
+	debug("OF: ISA map, cp=0x%llx, s=0x%llx, da=0x%llx\n", cp, s, da);
 
 	if (da < cp || da >= (cp + s))
 		return OF_BAD_ADDR;