Skip to contentSkip to conversation

PCI: tegra: add missing __iomem annotation

PATCH Applied Jingoo Han 3 participants 6 messages Sep 23, 2013 – Oct 17, 2013

Subsystems (2)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH v3 1/3 PCI: tegra: add missing __iomem annotation

Added missing __iomem annotation in order to fix the following sparse warnings:

drivers/pci/host/pci-tegra.c:411:41: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-tegra.c:411:41: expected void [noderef] <asn:2>*
drivers/pci/host/pci-tegra.c:411:41: got void *addr
drivers/pci/host/pci-tegra.c:419:25: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-tegra.c:419:25: expected void [noderef] <asn:2>*
drivers/pci/host/pci-tegra.c:419:25: got void *addr

---
 drivers/pci/host/pci-tegra.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pci-tegra.c +2 -2
index 2e9888a..7c4f38d 100644
@@ -408,7 +408,7 @@ static void __iomem *tegra_pcie_bus_map(struct tegra_pcie *pcie,
 
 	list_for_each_entry(bus, &pcie->busses, list)
 		if (bus->nr == busnr)
-			return bus->area->addr;
+			return (void __iomem *)bus->area->addr;
 
 	bus = tegra_pcie_bus_alloc(pcie, busnr);
 	if (IS_ERR(bus))
@@ -416,7 +416,7 @@ static void __iomem *tegra_pcie_bus_map(struct tegra_pcie *pcie,
 
 	list_add_tail(&bus->list, &pcie->busses);
 
-	return bus->area->addr;
+	return (void __iomem *)bus->area->addr;
 }
 
 static void __iomem *tegra_pcie_conf_address(struct pci_bus *bus,
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH v3 2/3 PCI: mvebu: make local functions static

mvebu_pcie_add_bus(), mvebu_pcie_align_resource() are used only in this file. Thus, these local functions should be staticized in order to fix the following sparse warnings:

drivers/pci/host/pci-mvebu.c:684:6: warning: symbol 'mvebu_pcie_add_bus' was not declared. Should it be static? drivers/pci/host/pci-mvebu.c:690:17: warning: symbol 'mvebu_pcie_align_resource' was not declared. Should it be static?

---
 drivers/pci/host/pci-mvebu.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/host/pci-mvebu.c +6 -6
index 77f8a7c..0bd3ba8 100644
@@ -681,17 +681,17 @@ static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 	return bus;
 }
 
-void mvebu_pcie_add_bus(struct pci_bus *bus)
+static void mvebu_pcie_add_bus(struct pci_bus *bus)
 {
 	struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata);
 	bus->msi = pcie->msi;
 }
 
-resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
-					  const struct resource *res,
-					  resource_size_t start,
-					  resource_size_t size,
-					  resource_size_t align)
+static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
+						const struct resource *res,
+						resource_size_t start,
+						resource_size_t size,
+						resource_size_t align)
 {
 	if (dev->bus->number != 0)
 		return start;
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH v3 3/3 PCI: mvebu: return NULL instead of ERR_PTR(ret)

In reply to Jingoo Han

Return NULL instead of ERR_PTR(ret) in order to fix the following sparse warning:

drivers/pci/host/pci-mvebu.c:744:31: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-mvebu.c:744:31: expected void [noderef] <asn:2>*
drivers/pci/host/pci-mvebu.c:744:31: got void *

---
 drivers/pci/host/pci-mvebu.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/pci/host/pci-mvebu.c +2 -3
index 0bd3ba8..fb2474f 100644
@@ -741,7 +741,7 @@ static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
 
 	ret = of_address_to_resource(np, 0, &regs);
 	if (ret)
-		return ERR_PTR(ret);
+		return NULL;
 
 	return devm_ioremap_resource(&pdev->dev, &regs);
 }
@@ -940,10 +940,9 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 			continue;
 
 		port->base = mvebu_pcie_map_registers(pdev, child, port);
-		if (IS_ERR(port->base)) {
+		if (!port->base) {
 			dev_err(&pdev->dev, "PCIe%d.%d: cannot map registers\n",
 				port->port, port->lane);
-			port->base = NULL;
 			clk_disable_unprepare(port->clk);
 			continue;
 		}
Signature · 1 line
1.7.10.4
author
#3 lore raw

Re: [PATCH V3 3/3] PCI: mvebu: return NULL instead of ERR_PTR(ret)

Quoted 11 lines · Jingoo Han

Return NULL instead of ERR_PTR(ret) in order to fix the following sparse warning:

drivers/pci/host/pci-mvebu.c:744:31: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-mvebu.c:744:31: expected void [noderef] <asn:2>*
drivers/pci/host/pci-mvebu.c:744:31: got void *

(+cc Andrew Lunn, Gregory Clement)

Hi Jason Cooper,

Would you apply this patch into your 'linux-mvebu.git' tree? It was already Acked by Thomas Petazzoni.
Also, it is a trivial change to fix sparse warning. Thank you.

Best regards,
Jingoo Han

Quoted 31 lines
---
 drivers/pci/host/pci-mvebu.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/pci/host/pci-mvebu.c +2 -4
index 0bd3ba8..fb2474f 100644
@@ -741,7 +741,7 @@ static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
 
 	ret = of_address_to_resource(np, 0, &regs);
 	if (ret)
-		return ERR_PTR(ret);
+		return NULL;
 
 	return devm_ioremap_resource(&pdev->dev, &regs);
 }
@@ -940,10 +940,9 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 			continue;
 
 		port->base = mvebu_pcie_map_registers(pdev, child, port);
-		if (IS_ERR(port->base)) {
+		if (!port->base) {
 			dev_err(&pdev->dev, "PCIe%d.%d: cannot map registers\n",
 				port->port, port->lane);
-			port->base = NULL;
 			clk_disable_unprepare(port->clk);
 			continue;
 		}
--

1.7.10.4

Applied
#4 lore raw

Re: [PATCH V3 3/3] PCI: mvebu: return NULL instead of ERR_PTR(ret)

Quoted 13 lines · Jingoo Han
Quoted 11 lines · Jingoo Han

Return NULL instead of ERR_PTR(ret) in order to fix the following sparse warning:

drivers/pci/host/pci-mvebu.c:744:31: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-mvebu.c:744:31: expected void [noderef] <asn:2>*
drivers/pci/host/pci-mvebu.c:744:31: got void *

Quoted 8 lines

(+cc Andrew Lunn, Gregory Clement)

Hi Jason Cooper,

Would you apply this patch into your 'linux-mvebu.git' tree? It was already Acked by Thomas Petazzoni.
Also, it is a trivial change to fix sparse warning. Thank you.

Applied to mvebu/drivers

thx,

Jason.

maintainer Applied
#5 lore raw
In reply to Jingoo Han
Quoted 10 lines · Jingoo Han

Added missing __iomem annotation in order to fix the following sparse warnings:

drivers/pci/host/pci-tegra.c:411:41: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-tegra.c:411:41: expected void [noderef] <asn:2>*
drivers/pci/host/pci-tegra.c:411:41: got void *addr
drivers/pci/host/pci-tegra.c:419:25: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-tegra.c:419:25: expected void [noderef] <asn:2>*
drivers/pci/host/pci-tegra.c:419:25: got void *addr

Quoted 2 lines

Applied to my pci/host-tegra branch for v3.13. Thanks!

Bjorn

Quoted 30 lines
---
 drivers/pci/host/pci-tegra.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pci-tegra.c +2 -3
index 2e9888a..7c4f38d 100644
@@ -408,7 +408,7 @@ static void __iomem *tegra_pcie_bus_map(struct tegra_pcie *pcie,
 
        list_for_each_entry(bus, &pcie->busses, list)
                if (bus->nr == busnr)
-                       return bus->area->addr;
+                       return (void __iomem *)bus->area->addr;
 
        bus = tegra_pcie_bus_alloc(pcie, busnr);
        if (IS_ERR(bus))
@@ -416,7 +416,7 @@ static void __iomem *tegra_pcie_bus_map(struct tegra_pcie *pcie,
 
        list_add_tail(&bus->list, &pcie->busses);
 
-       return bus->area->addr;
+       return (void __iomem *)bus->area->addr;
 }
 
 static void __iomem *tegra_pcie_conf_address(struct pci_bus *bus,
--

1.7.10.4