Patchwork [13/15] pci: mvebu: Convert to use devm_ioremap_resource

login
register
mail settings
Submitter Tushar Behera
Date June 10, 2013, 11:35 a.m.
Message ID <1370864113-17895-14-git-send-email-tushar.behera@linaro.org>
Download mbox | patch
Permalink /patch/250220/
State Not Applicable
Headers show

Comments

Tushar Behera - June 10, 2013, 11:35 a.m.
Commit 75096579c3ac ("lib: devres: Introduce devm_ioremap_resource()")
introduced devm_ioremap_resource() and deprecated the use of
devm_request_and_ioremap().

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
CC: linux-pci@vger.kernel.org
CC: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pci-mvebu.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Sachin Kamat - June 10, 2013, 2:29 p.m.
On 10 June 2013 17:05, Tushar Behera <tushar.behera@linaro.org> wrote:
> Commit 75096579c3ac ("lib: devres: Introduce devm_ioremap_resource()")
> introduced devm_ioremap_resource() and deprecated the use of
> devm_request_and_ioremap().
>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> CC: linux-pci@vger.kernel.org
> CC: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pci/host/pci-mvebu.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index 13a633b..e714876 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -752,7 +752,7 @@ mvebu_pcie_map_registers(struct platform_device *pdev,
>         if (ret)
>                 return NULL;
>
> -       return devm_request_and_ioremap(&pdev->dev, &regs);
> +       return devm_ioremap_resource(&pdev->dev, &regs);
>  }
>
>  static int __init mvebu_pcie_probe(struct platform_device *pdev)
> @@ -842,9 +842,10 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
>                         continue;
>
>                 port->base = mvebu_pcie_map_registers(pdev, child, port);
> -               if (!port->base) {
> +               if (IS_ERR(port->base)) {
>                         dev_err(&pdev->dev, "PCIe%d.%d: cannot map registers\n",
>                                 port->port, port->lane);

This error message is redundant.

> +                       port->base = NULL;
Probably this is also not needed.

>                         continue;
>                 }
>
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
Tushar Behera - June 11, 2013, 4:51 a.m.
On 06/10/2013 07:59 PM, Sachin Kamat wrote:
> On 10 June 2013 17:05, Tushar Behera <tushar.behera@linaro.org> wrote:
>> Commit 75096579c3ac ("lib: devres: Introduce devm_ioremap_resource()")
>> introduced devm_ioremap_resource() and deprecated the use of
>> devm_request_and_ioremap().
>>
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> CC: linux-pci@vger.kernel.org
>> CC: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>>  drivers/pci/host/pci-mvebu.c |    5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
>> index 13a633b..e714876 100644
>> --- a/drivers/pci/host/pci-mvebu.c
>> +++ b/drivers/pci/host/pci-mvebu.c
>> @@ -752,7 +752,7 @@ mvebu_pcie_map_registers(struct platform_device *pdev,
>>         if (ret)
>>                 return NULL;
>>
>> -       return devm_request_and_ioremap(&pdev->dev, &regs);
>> +       return devm_ioremap_resource(&pdev->dev, &regs);
>>  }
>>
>>  static int __init mvebu_pcie_probe(struct platform_device *pdev)
>> @@ -842,9 +842,10 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
>>                         continue;
>>
>>                 port->base = mvebu_pcie_map_registers(pdev, child, port);
>> -               if (!port->base) {
>> +               if (IS_ERR(port->base)) {
>>                         dev_err(&pdev->dev, "PCIe%d.%d: cannot map registers\n",
>>                                 port->port, port->lane);
> 
> This error message is redundant.
> 

It provides a little more information regarding the port and lane number
which might be useful in debugging.

>> +                       port->base = NULL;
> Probably this is also not needed.
> 

I was not sure about the default error value for port->base, hence I
replicated the old behaviour.

Thanks.

Patch

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 13a633b..e714876 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -752,7 +752,7 @@  mvebu_pcie_map_registers(struct platform_device *pdev,
 	if (ret)
 		return NULL;
 
-	return devm_request_and_ioremap(&pdev->dev, &regs);
+	return devm_ioremap_resource(&pdev->dev, &regs);
 }
 
 static int __init mvebu_pcie_probe(struct platform_device *pdev)
@@ -842,9 +842,10 @@  static int __init mvebu_pcie_probe(struct platform_device *pdev)
 			continue;
 
 		port->base = mvebu_pcie_map_registers(pdev, child, port);
-		if (!port->base) {
+		if (IS_ERR(port->base)) {
 			dev_err(&pdev->dev, "PCIe%d.%d: cannot map registers\n",
 				port->port, port->lane);
+			port->base = NULL;
 			continue;
 		}