Skip to contentSkip to conversation

mm/early_remap: Use %pa to print resource_size_t variables

PATCH Applied Andy Shevchenko 2 participants 2 messages Dec 9, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/early_remap: Use %pa to print resource_size_t variables

%pa takes into consideration the special types such as resource_size_t. Use this specifier %instead of explicit casting.

---
 mm/early_ioremap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/early_ioremap.c +4 -4
index 1826f191e72c..a0018ad1a1f6 100644
@@ -121,8 +121,8 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
 		}
 	}
 
-	if (WARN(slot < 0, "%s(%08llx, %08lx) not found slot\n",
-		 __func__, (u64)phys_addr, size))
+	if (WARN(slot < 0, "%s(%pa, %08lx) not found slot\n",
+		 __func__, &phys_addr, size))
 		return NULL;
 
 	/* Don't allow wraparound or zero size */
@@ -158,8 +158,8 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
 		--idx;
 		--nrpages;
 	}
-	WARN(early_ioremap_debug, "%s(%08llx, %08lx) [%d] => %08lx + %08lx\n",
-	     __func__, (u64)phys_addr, size, slot, offset, slot_virt[slot]);
+	WARN(early_ioremap_debug, "%s(%pa, %08lx) [%d] => %08lx + %08lx\n",
+	     __func__, &phys_addr, size, slot, offset, slot_virt[slot]);
 
 	prev_map[slot] = (void __iomem *)(offset + slot_virt[slot]);
 	return prev_map[slot];
Signature · 1 line
2.24.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Andy Shevchenko

%pa takes into consideration the special types such as resource_size_t. Use this specifier %instead of explicit casting.

---
 mm/early_ioremap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/early_ioremap.c +2 -2
index 1826f191e72c..a0018ad1a1f6 100644
@@ -121,8 +121,8 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
 		}
 	}
 
-	if (WARN(slot < 0, "%s(%08llx, %08lx) not found slot\n",
-		 __func__, (u64)phys_addr, size))
+	if (WARN(slot < 0, "%s(%pa, %08lx) not found slot\n",
+		 __func__, &phys_addr, size))
 		return NULL;
 
 	/* Don't allow wraparound or zero size */

mm/early_ioremap.c __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot) · line 165

Quoted 10 lines
mm/early_ioremap.c +2 -2
@@ -158,8 +158,8 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
 		--idx;
 		--nrpages;
 	}
-	WARN(early_ioremap_debug, "%s(%08llx, %08lx) [%d] => %08lx + %08lx\n",
-	     __func__, (u64)phys_addr, size, slot, offset, slot_virt[slot]);
+	WARN(early_ioremap_debug, "%s(%pa, %08lx) [%d] => %08lx + %08lx\n",
+	     __func__, &phys_addr, size, slot, offset, slot_virt[slot]);
 
 	prev_map[slot] = (void __iomem *)(offset + slot_virt[slot]);
 	return prev_map[slot];

Yes, that's what Documentation/core-api/printk-formats.rst wants us to do :)

Signature · 3 lines
Thanks,

David / dhildenb