Patchwork [3/3] PCI: mvebu: add missing __iomem annotation

login
register
mail settings
Submitter Jingoo Han
Date Sept. 17, 2013, 12:52 a.m.
Message ID <000201ceb340$21d48de0$657da9a0$%han@samsung.com>
Download mbox | patch
Permalink /patch/275345/
State Superseded
Headers show

Comments

Jingoo Han - Sept. 17, 2013, 12:52 a.m.
On Tuesday, September 17, 2013 12:57 AM, Thomas Petazzoni wrote:
> On Thu, 12 Sep 2013 18:37:18 +0900, Jingoo Han wrote:
> 
> >  	ret = of_address_to_resource(np, 0, &regs);
> >  	if (ret)
> > -		return ERR_PTR(ret);
> > +		return (void __iomem *)ERR_PTR(ret);
> 
> This doesn't look very pretty to tell the truth, but I don't quite see
> any other option. Just return NULL when of_address_to_resource() fails
> instead of trying to propagate the error? Make this entire function
> return an 'int' and have the iomem address returned through a pointer
> passed by address as argument to the function? Any other suggestion?
> 

Hi Thomas Petazzoni,
I appreciated your feedback. :-)

'Just returning NULL when of_address_to_resource() fails
instead of trying to propagate the error' looks better.

Then, how about the following?


Best regards,
Jingoo Han

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thomas Petazzoni - Sept. 17, 2013, 4:47 a.m.
Dear Jingoo Han,

On Tue, 17 Sep 2013 09:52:06 +0900, Jingoo Han wrote:

> 'Just returning NULL when of_address_to_resource() fails
> instead of trying to propagate the error' looks better.
> 
> Then, how about the following?
> 
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -728,7 +728,7 @@ 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);
>  }
> @@ -874,7 +874,7 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
> 		}
> 
> 		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;

Yes, I believe it makes more sense since we were anyway to using the
error code returned by of_address_to_ressource().

However, you can get rid of the port->base = NULL assignment in the if
() { ... } code now.

With that fixed, you can add my:

Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Thomas

Patch

--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -728,7 +728,7 @@  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);
 }
@@ -874,7 +874,7 @@  static int __init mvebu_pcie_probe(struct platform_device *pdev)
		}

		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;