Skip to contentSkip to conversation

pci: pci-mvebu: Use '%pa' for printing 'phys_addr_t' type

PATCH In review Fabio Estevam 3 participants 4 messages Apr 29, 2014 PCI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pci: pci-mvebu: Use '%pa' for printing 'phys_addr_t' type

From: Fabio Estevam <[email protected]>

Fix the following build warning that happens when building multi_v7_defconfig with CONFIG_ARM_LPAE=y:

drivers/pci/host/pci-mvebu.c:334:5: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]

Fix the warning by using '%pa' to printing 'phys_addr_t' type. While at it, also use the more standard notation [mem 0x - 0x] for memory region.

---
Changes since v1:
- use the [mem 0x - 0x] notation

 drivers/pci/host/pci-mvebu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pci-mvebu.c +2 -2
index e384e25..df57a6a 100644
@@ -330,8 +330,8 @@ static void mvebu_pcie_add_windows(struct mvebu_pcie_port *port,
 							sz, remap);
 		if (ret) {
 			dev_err(&port->pcie->pdev->dev,
-				"Could not create MBus window at 0x%x, size 0x%x: %d\n",
-				base, sz, ret);
+				"Could not create MBus window at [mem %pa - %pa] :%d\n",
+				&base, &base + sz, ret);
 			mvebu_pcie_del_windows(port, base - size_mapped,
 					       size_mapped);
 			return;
Signature · 1 line
1.8.3.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Fix the following build warning that happens when building multi_v7_defconfig with CONFIG_ARM_LPAE=y:

Quoted 7 lines

drivers/pci/host/pci-mvebu.c:334:5: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]

Fix the warning by using '%pa' to printing 'phys_addr_t' type. While at it, also use the more standard notation [mem 0x - 0x] for memory region.

Best regards,
Jingoo Han

Quoted 24 lines

---
Changes since v1:
- use the [mem 0x - 0x] notation

 drivers/pci/host/pci-mvebu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pci-mvebu.c +2 -3
index e384e25..df57a6a 100644
@@ -330,8 +330,8 @@ static void mvebu_pcie_add_windows(struct mvebu_pcie_port *port,
 							sz, remap);
 		if (ret) {
 			dev_err(&port->pcie->pdev->dev,
-				"Could not create MBus window at 0x%x, size 0x%x: %d\n",
-				base, sz, ret);
+				"Could not create MBus window at [mem %pa - %pa] :%d\n",
+				&base, &base + sz, ret);
 			mvebu_pcie_del_windows(port, base - size_mapped,
 					       size_mapped);
 			return;
--

1.8.3.2

#2 lore raw
In reply to Fabio Estevam

Dear Fabio Estevam,

drivers/pci/host/pci-mvebu.c static void mvebu_pcie_add_windows(struct mvebu_pcie_port *port, · line 334

Quoted 6 lines · Fabio Estevam
drivers/pci/host/pci-mvebu.c +2 -2
 		if (ret) {
 			dev_err(&port->pcie->pdev->dev,
-				"Could not create MBus window at 0x%x, size 0x%x: %d\n",
-				base, sz, ret);
+				"Could not create MBus window at [mem %pa - %pa] :%d\n",
+				&base, &base + sz, ret);

Are you sure '&base + sz' works here? %pa needs a reference as argument, so &base looks good. But '&base + sz' means you will print the value which is at the address of base, to which 'sz' is added, which is not what we want here. Probably you need something like:

	phys_addr_t end = base + sz;

and then use '&end'.

Or I am missing something?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw
Quoted 14 lines · Thomas Petazzoni

drivers/pci/host/pci-mvebu.c static void mvebu_pcie_add_windows(struct mvebu_pcie_port *port, · line 334

Quoted 6 lines · Fabio Estevam
drivers/pci/host/pci-mvebu.c +2 -2
 		if (ret) {
 			dev_err(&port->pcie->pdev->dev,
-				"Could not create MBus window at 0x%x, size 0x%x: %d\n",
-				base, sz, ret);
+				"Could not create MBus window at [mem %pa - %pa] :%d\n",
+				&base, &base + sz, ret);

Are you sure '&base + sz' works here? %pa needs a reference as argument, so &base looks good. But '&base + sz' means you will print the value which is at the address of base, to which 'sz' is added, which is not what we want here. Probably you need something like:

Quoted 5 lines
	phys_addr_t end = base + sz;

and then use '&end'.

Or I am missing something?

I agree with your suggestion.
Thanks.

Best regards,
Jingoo Han

Quoted 6 lines

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com