linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] pci: convert to devm_ioremap_resource()
@ 2013-03-12  7:28 Silviu-Mihai Popescu
  2013-03-12 11:17 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Silviu-Mihai Popescu @ 2013-03-12  7:28 UTC (permalink / raw)
  To: linux-mips
  Cc: ralf, juhosg, blogic, kaloz, xsecute, linux-kernel, Silviu-Mihai Popescu

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Silviu-Mihai Popescu <silviupopescu1990@gmail.com>
---
 arch/mips/pci/pci-ar71xx.c |    6 +++---
 arch/mips/pci/pci-ar724x.c |   18 +++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c
index 412ec02..18517dd 100644
--- a/arch/mips/pci/pci-ar71xx.c
+++ b/arch/mips/pci/pci-ar71xx.c
@@ -366,9 +366,9 @@ static int ar71xx_pci_probe(struct platform_device *pdev)
 	if (!res)
 		return -EINVAL;
 
-	apc->cfg_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!apc->cfg_base)
-		return -ENOMEM;
+	apc->cfg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(apc->cfg_base))
+		return PTR_ERR(apc->cfg_base);
 
 	apc->irq = platform_get_irq(pdev, 0);
 	if (apc->irq < 0)
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c
index 8a0700d..65ec032 100644
--- a/arch/mips/pci/pci-ar724x.c
+++ b/arch/mips/pci/pci-ar724x.c
@@ -365,25 +365,25 @@ static int ar724x_pci_probe(struct platform_device *pdev)
 	if (!res)
 		return -EINVAL;
 
-	apc->ctrl_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (apc->ctrl_base == NULL)
-		return -EBUSY;
+	apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(apc->ctrl_base))
+		return PTR_ERR(apc->ctrl_base);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
 	if (!res)
 		return -EINVAL;
 
-	apc->devcfg_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!apc->devcfg_base)
-		return -EBUSY;
+	apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(apc->devcfg_base))
+		return PTR_ERR(apc->devcfg_base);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base");
 	if (!res)
 		return -EINVAL;
 
-	apc->crp_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (apc->crp_base == NULL)
-		return -EBUSY;
+	apc->crp_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(apc->crp_base))
+		return PTR_ERR(apc->crp_base);
 
 	apc->irq = platform_get_irq(pdev, 0);
 	if (apc->irq < 0)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] pci: convert to devm_ioremap_resource()
  2013-03-12  7:28 [PATCH v2] pci: convert to devm_ioremap_resource() Silviu-Mihai Popescu
@ 2013-03-12 11:17 ` Sergei Shtylyov
  2013-03-12 11:31   ` Silviu Popescu
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2013-03-12 11:17 UTC (permalink / raw)
  To: Silviu-Mihai Popescu
  Cc: linux-mips, ralf, juhosg, blogic, kaloz, xsecute, linux-kernel

Hello.

On 12-03-2013 11:28, Silviu-Mihai Popescu wrote:

> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.

> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.

    There were no error messages as far as I could see, so this passage seems 
superfluous...

> Signed-off-by: Silviu-Mihai Popescu <silviupopescu1990@gmail.com>
> ---
>   arch/mips/pci/pci-ar71xx.c |    6 +++---
>   arch/mips/pci/pci-ar724x.c |   18 +++++++++---------
>   2 files changed, 12 insertions(+), 12 deletions(-)

> diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c
> index 412ec02..18517dd 100644
> --- a/arch/mips/pci/pci-ar71xx.c
> +++ b/arch/mips/pci/pci-ar71xx.c
> @@ -366,9 +366,9 @@ static int ar71xx_pci_probe(struct platform_device *pdev)
>   	if (!res)
>   		return -EINVAL;
>
> -	apc->cfg_base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!apc->cfg_base)
> -		return -ENOMEM;
> +	apc->cfg_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(apc->cfg_base))
> +		return PTR_ERR(apc->cfg_base);
>
>   	apc->irq = platform_get_irq(pdev, 0);
>   	if (apc->irq < 0)
> diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c
> index 8a0700d..65ec032 100644
> --- a/arch/mips/pci/pci-ar724x.c
> +++ b/arch/mips/pci/pci-ar724x.c
> @@ -365,25 +365,25 @@ static int ar724x_pci_probe(struct platform_device *pdev)
>   	if (!res)
>   		return -EINVAL;
>
> -	apc->ctrl_base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (apc->ctrl_base == NULL)
> -		return -EBUSY;
> +	apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(apc->ctrl_base))
> +		return PTR_ERR(apc->ctrl_base);
>
>   	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
>   	if (!res)
>   		return -EINVAL;
>
> -	apc->devcfg_base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!apc->devcfg_base)
> -		return -EBUSY;
> +	apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(apc->devcfg_base))
> +		return PTR_ERR(apc->devcfg_base);
>
>   	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base");
>   	if (!res)
>   		return -EINVAL;
>
> -	apc->crp_base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (apc->crp_base == NULL)
> -		return -EBUSY;
> +	apc->crp_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(apc->crp_base))
> +		return PTR_ERR(apc->crp_base);
>
>   	apc->irq = platform_get_irq(pdev, 0);
>   	if (apc->irq < 0)

WBR, Sergei



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] pci: convert to devm_ioremap_resource()
  2013-03-12 11:17 ` Sergei Shtylyov
@ 2013-03-12 11:31   ` Silviu Popescu
  0 siblings, 0 replies; 3+ messages in thread
From: Silviu Popescu @ 2013-03-12 11:31 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: linux-mips, ralf, juhosg, blogic, kaloz, xsecute, linux-kernel

On Tue, Mar 12, 2013 at 1:17 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
>
> On 12-03-2013 11:28, Silviu-Mihai Popescu wrote:
>
>> Convert all uses of devm_request_and_ioremap() to the newly introduced
>> devm_ioremap_resource() which provides more consistent error handling.
>
>
>> devm_ioremap_resource() provides its own error messages so all explicit
>> error messages can be removed from the failure code paths.
>
>
>    There were no error messages as far as I could see, so this passage seems
> superfluous...

Sorry for that, I sent a refreshed version of the patch.

Thanks,
Silviu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-12 11:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-12  7:28 [PATCH v2] pci: convert to devm_ioremap_resource() Silviu-Mihai Popescu
2013-03-12 11:17 ` Sergei Shtylyov
2013-03-12 11:31   ` Silviu Popescu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).