[PATCH 03/11] pinctrl: single: fix debug messages formatting

Dario Binacchi dariobin at libero.it
Sat Jan 23 19:27:03 CET 2021


The printf '%pa' format specifier appends the '0x' prefix to the
displayed address. Furthermore, the offset variable is displayed with
the '%x' format specifier instead of '%pa'.

Signed-off-by: Dario Binacchi <dariobin at libero.it>
---

 drivers/pinctrl/pinctrl-single.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 49ed15211d..cec00e289c 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -77,15 +77,17 @@ static int single_configure_pins(struct udevice *dev,
 	struct single_pdata *pdata = dev_get_plat(dev);
 	int n, count = size / sizeof(struct single_fdt_pin_cfg);
 	phys_addr_t reg;
-	u32 val;
+	u32 offset, val;
 
 	for (n = 0; n < count; n++, pins++) {
-		reg = fdt32_to_cpu(pins->reg);
-		if ((reg < 0) || (reg > pdata->offset)) {
-			dev_dbg(dev, "  invalid register offset 0x%pa\n", &reg);
+		offset = fdt32_to_cpu(pins->reg);
+		if (offset < 0 || offset > pdata->offset) {
+			dev_dbg(dev, "  invalid register offset 0x%x\n",
+				offset);
 			continue;
 		}
-		reg += pdata->base;
+
+		reg = pdata->base + offset;
 		val = fdt32_to_cpu(pins->val) & pdata->mask;
 		switch (pdata->width) {
 		case 16:
@@ -99,7 +101,7 @@ static int single_configure_pins(struct udevice *dev,
 				 pdata->width);
 			continue;
 		}
-		dev_dbg(dev, "  reg/val 0x%pa/0x%08x\n", &reg, val);
+		dev_dbg(dev, "  reg/val %pa/0x%08x\n", &reg, val);
 	}
 	return 0;
 }
@@ -111,15 +113,17 @@ static int single_configure_bits(struct udevice *dev,
 	struct single_pdata *pdata = dev_get_plat(dev);
 	int n, count = size / sizeof(struct single_fdt_bits_cfg);
 	phys_addr_t reg;
-	u32 val, mask;
+	u32 offset, val, mask;
 
 	for (n = 0; n < count; n++, pins++) {
-		reg = fdt32_to_cpu(pins->reg);
-		if ((reg < 0) || (reg > pdata->offset)) {
-			dev_dbg(dev, "  invalid register offset 0x%pa\n", &reg);
+		offset = fdt32_to_cpu(pins->reg);
+		if (offset < 0 || offset > pdata->offset) {
+			dev_dbg(dev, "  invalid register offset 0x%x\n",
+				offset);
 			continue;
 		}
-		reg += pdata->base;
+
+		reg = pdata->base + offset;
 
 		mask = fdt32_to_cpu(pins->mask);
 		val = fdt32_to_cpu(pins->val) & mask;
@@ -136,7 +140,7 @@ static int single_configure_bits(struct udevice *dev,
 				 pdata->width);
 			continue;
 		}
-		dev_dbg(dev, "  reg/val 0x%pa/0x%08x\n", &reg, val);
+		dev_dbg(dev, "  reg/val %pa/0x%08x\n", &reg, val);
 	}
 	return 0;
 }
-- 
2.17.1



More information about the U-Boot mailing list