Patchwork [01/15] sparc,leon: Convert to use devm_ioremap_resource

login
register
mail settings
Submitter Tushar Behera
Date June 10, 2013, 11:34 a.m.
Message ID <1370864113-17895-2-git-send-email-tushar.behera@linaro.org>
Download mbox | patch
Permalink /patch/250224/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Tushar Behera - June 10, 2013, 11:34 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: sparclinux@vger.kernel.org
CC: "David S. Miller" <davem@davemloft.net>
---
* Not compile tested.
 arch/sparc/kernel/leon_pci_grpci1.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Sachin Kamat - June 10, 2013, 12:03 p.m.
On 10 June 2013 17:04, 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: sparclinux@vger.kernel.org
> CC: "David S. Miller" <davem@davemloft.net>
> ---
> * Not compile tested.
>  arch/sparc/kernel/leon_pci_grpci1.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
> index 7739a54..23497f4 100644
> --- a/arch/sparc/kernel/leon_pci_grpci1.c
> +++ b/arch/sparc/kernel/leon_pci_grpci1.c
> @@ -536,10 +536,10 @@ static int grpci1_of_probe(struct platform_device *ofdev)
>
>         /* find device register base address */
>         res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
> -       regs = devm_request_and_ioremap(&ofdev->dev, res);
> -       if (!regs) {
> +       regs = devm_ioremap_resource(&ofdev->dev, res);
> +       if (IS_ERR(regs)) {
>                 dev_err(&ofdev->dev, "io-regs mapping failed\n");

You may remove the above error message as devm_ioremap_resource prints
its own error messages.

> -               return -EADDRNOTAVAIL;
> +               return PTR_ERR(regs);
>         }
>
>         /*
> --
> 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, 3:07 a.m.
On 06/10/2013 05:33 PM, Sachin Kamat wrote:
> On 10 June 2013 17:04, 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: sparclinux@vger.kernel.org
>> CC: "David S. Miller" <davem@davemloft.net>
>> ---
>> * Not compile tested.
>>  arch/sparc/kernel/leon_pci_grpci1.c |    6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
>> index 7739a54..23497f4 100644
>> --- a/arch/sparc/kernel/leon_pci_grpci1.c
>> +++ b/arch/sparc/kernel/leon_pci_grpci1.c
>> @@ -536,10 +536,10 @@ static int grpci1_of_probe(struct platform_device *ofdev)
>>
>>         /* find device register base address */
>>         res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
>> -       regs = devm_request_and_ioremap(&ofdev->dev, res);
>> -       if (!regs) {
>> +       regs = devm_ioremap_resource(&ofdev->dev, res);
>> +       if (IS_ERR(regs)) {
>>                 dev_err(&ofdev->dev, "io-regs mapping failed\n");
> 
> You may remove the above error message as devm_ioremap_resource prints
> its own error messages.
> 

Ok. I will remove the error message. I will do the same for other
instances too.

Thanks.

Patch

diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
index 7739a54..23497f4 100644
--- a/arch/sparc/kernel/leon_pci_grpci1.c
+++ b/arch/sparc/kernel/leon_pci_grpci1.c
@@ -536,10 +536,10 @@  static int grpci1_of_probe(struct platform_device *ofdev)
 
 	/* find device register base address */
 	res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-	regs = devm_request_and_ioremap(&ofdev->dev, res);
-	if (!regs) {
+	regs = devm_ioremap_resource(&ofdev->dev, res);
+	if (IS_ERR(regs)) {
 		dev_err(&ofdev->dev, "io-regs mapping failed\n");
-		return -EADDRNOTAVAIL;
+		return PTR_ERR(regs);
 	}
 
 	/*