Skip to contentSkip to conversation

PCI: faraday: use %pap format string for printing resources

PATCH In review Arnd Bergmann 2 participants 2 messages Apr 19, 2017 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: faraday: use %pap format string for printing resources

resource_size_t may be either 32-bit or 64-bit wide, so we have to use the special %pap format string to avoid warnings like:

drivers/pci/host/pci-ftpci100.c: In function 'faraday_res_to_memcfg':
drivers/pci/host/pci-ftpci100.c:174:586: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=] drivers/pci/host/pci-ftpci100.c:174:586: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]

This relies on resource_size_t and phys_addr_t being the same width, as other code already does.

Fixes 5c18f2b240bd ("PCI: faraday: Add Faraday Technology FTPCI100 PCI Host Bridge driver")
---
 drivers/pci/host/pci-ftpci100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pci-ftpci100.c +2 -2
index 4ae5418a1aad..c0f29d1de341 100644
@@ -171,8 +171,8 @@ static int faraday_res_to_memcfg(resource_size_t mem_base,
 		pr_warn("truncated PCI memory base\n");
 	/* Translate to bridge side address space */
 	outval |= (mem_base & FARADAY_PCI_MEMBASE_MASK);
-	pr_debug("Translated pci base @%08x, size %08x to config %08x\n",
-		 mem_base, mem_size, outval);
+	pr_debug("Translated pci base @%pap, size %pap to config %08x\n",
+		 &mem_base, &mem_size, outval);
 
 	*val = outval;
 	return 0;
Signature · 1 line
2.9.0
maintainer
#1 lore raw
Quoted 7 lines · Arnd Bergmann

resource_size_t may be either 32-bit or 64-bit wide, so we have to use the special %pap format string to avoid warnings like:

drivers/pci/host/pci-ftpci100.c: In function 'faraday_res_to_memcfg':
drivers/pci/host/pci-ftpci100.c:174:586: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=] drivers/pci/host/pci-ftpci100.c:174:586: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]

Quoted 5 lines

This relies on resource_size_t and phys_addr_t being the same width, as other code already does.

Fixes 5c18f2b240bd ("PCI: faraday: Add Faraday Technology FTPCI100 PCI Host Bridge driver")

Thanks, folded into the initial commit.

Quoted 22 lines
---
 drivers/pci/host/pci-ftpci100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pci-ftpci100.c +2 -3
index 4ae5418a1aad..c0f29d1de341 100644
@@ -171,8 +171,8 @@ static int faraday_res_to_memcfg(resource_size_t mem_base,
                pr_warn("truncated PCI memory base\n");
        /* Translate to bridge side address space */
        outval |= (mem_base & FARADAY_PCI_MEMBASE_MASK);
-       pr_debug("Translated pci base @%08x, size %08x to config %08x\n",
-                mem_base, mem_size, outval);
+       pr_debug("Translated pci base @%pap, size %pap to config %08x\n",
+                &mem_base, &mem_size, outval);
 
        *val = outval;
        return 0;
--

2.9.0