diff mbox series

powerpc/prom: fix early DEBUG messages

Message ID 531e7e818b5c4867148412c7902a9cbeee5745ee.1544709040.git.christophe.leroy@c-s.fr (mailing list archive)
State Superseded
Headers show
Series powerpc/prom: fix early DEBUG messages | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success next/apply_patch Successfully applied
snowpatch_ozlabs/build-ppc64le success build succeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-ppc64be success build succeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-ppc64e success build succeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-pmac32 success build succeded & removed 0 sparse warning(s)
snowpatch_ozlabs/checkpatch warning total: 0 errors, 3 warnings, 0 checks, 27 lines checked

Commit Message

Christophe Leroy Dec. 13, 2018, 1:54 p.m. UTC
This patch fixes early DEBUG messages in prom.c:
- Use %px instead of %p to see the addresses
- Use %x instead of %llx when phys_addr_t is not 64 bits.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/kernel/prom.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Michael Ellerman Dec. 14, 2018, 6:22 a.m. UTC | #1
Christophe Leroy <christophe.leroy@c-s.fr> writes:

> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index fe758cedb93f..d8e56e03c9c6 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -749,7 +749,11 @@ void __init early_init_devtree(void *params)
>  	memblock_allow_resize();
>  	memblock_dump_all();
>  
> +#ifdef CONFIG_PHYS_64BIT
>  	DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
> +#else
> +	DBG("Phys. mem: %x\n", memblock_phys_mem_size());
> +#endif

Can we just do:

  	DBG("Phys. mem: %llx\n", (unsigned long long)memblock_phys_mem_size());

?

cheers
Christophe Leroy Dec. 14, 2018, 10:37 a.m. UTC | #2
Le 14/12/2018 à 07:22, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@c-s.fr> writes:
> 
>> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
>> index fe758cedb93f..d8e56e03c9c6 100644
>> --- a/arch/powerpc/kernel/prom.c
>> +++ b/arch/powerpc/kernel/prom.c
>> @@ -749,7 +749,11 @@ void __init early_init_devtree(void *params)
>>   	memblock_allow_resize();
>>   	memblock_dump_all();
>>   
>> +#ifdef CONFIG_PHYS_64BIT
>>   	DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
>> +#else
>> +	DBG("Phys. mem: %x\n", memblock_phys_mem_size());
>> +#endif
> 
> Can we just do:
> 
>    	DBG("Phys. mem: %llx\n", (unsigned long long)memblock_phys_mem_size());
> 
> ?
> 

Yes that's obviously better, especially as we don't fix the length of 
the displayed value.
Christophe
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index fe758cedb93f..d8e56e03c9c6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -129,7 +129,7 @@  static void __init move_device_tree(void)
 		p = __va(memblock_phys_alloc(size, PAGE_SIZE));
 		memcpy(p, initial_boot_params, size);
 		initial_boot_params = p;
-		DBG("Moved device tree to 0x%p\n", p);
+		DBG("Moved device tree to 0x%px\n", p);
 	}
 
 	DBG("<- move_device_tree\n");
@@ -689,7 +689,7 @@  void __init early_init_devtree(void *params)
 {
 	phys_addr_t limit;
 
-	DBG(" -> early_init_devtree(%p)\n", params);
+	DBG(" -> early_init_devtree(%px)\n", params);
 
 	/* Too early to BUG_ON(), do it by hand */
 	if (!early_init_dt_verify(params))
@@ -749,7 +749,11 @@  void __init early_init_devtree(void *params)
 	memblock_allow_resize();
 	memblock_dump_all();
 
+#ifdef CONFIG_PHYS_64BIT
 	DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
+#else
+	DBG("Phys. mem: %x\n", memblock_phys_mem_size());
+#endif
 
 	/* We may need to relocate the flat tree, do it now.
 	 * FIXME .. and the initrd too? */