2013-03-04 09:20:08

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 1/1] gpio/vt8500: Convert to devm_ioremap_resource()

Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() 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: Sachin Kamat <[email protected]>
---
drivers/gpio/gpio-vt8500.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-vt8500.c b/drivers/gpio/gpio-vt8500.c
index 81683ca..b2d8d6f 100644
--- a/drivers/gpio/gpio-vt8500.c
+++ b/drivers/gpio/gpio-vt8500.c
@@ -309,11 +309,9 @@ static int vt8500_gpio_probe(struct platform_device *pdev)
return -ENODEV;
}

- gpio_base = devm_request_and_ioremap(&pdev->dev, res);
- if (!gpio_base) {
- dev_err(&pdev->dev, "Unable to map GPIO registers\n");
- return -ENOMEM;
- }
+ gpio_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(gpio_base))
+ return PTR_ERR(gpio_base);

ret = vt8500_add_chips(pdev, gpio_base, of_id->data);

--
1.7.4.1


2013-03-04 10:24:55

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH 1/1] gpio/vt8500: Convert to devm_ioremap_resource()

On Mon, Mar 04, 2013 at 02:39:39PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() 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: Sachin Kamat <[email protected]>
> ---
> drivers/gpio/gpio-vt8500.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)

Reviewed-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (566.00 B)
(No filename) (836.00 B)
Download all attachments

2013-03-04 17:08:10

by Tony Prisk

[permalink] [raw]
Subject: Re: [PATCH 1/1] gpio/vt8500: Convert to devm_ioremap_resource()

On Mon, 2013-03-04 at 14:39 +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() 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: Sachin Kamat <[email protected]>
> ---
> drivers/gpio/gpio-vt8500.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-vt8500.c b/drivers/gpio/gpio-vt8500.c
> index 81683ca..b2d8d6f 100644
> --- a/drivers/gpio/gpio-vt8500.c
> +++ b/drivers/gpio/gpio-vt8500.c
> @@ -309,11 +309,9 @@ static int vt8500_gpio_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> - gpio_base = devm_request_and_ioremap(&pdev->dev, res);
> - if (!gpio_base) {
> - dev_err(&pdev->dev, "Unable to map GPIO registers\n");
> - return -ENOMEM;
> - }
> + gpio_base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(gpio_base))
> + return PTR_ERR(gpio_base);
>
> ret = vt8500_add_chips(pdev, gpio_base, of_id->data);
>

Acked-by: Tony Prisk <[email protected]>

2013-03-14 06:45:37

by Sachin Kamat

[permalink] [raw]
Subject: Re: [PATCH 1/1] gpio/vt8500: Convert to devm_ioremap_resource()

Hi Linus,

On 4 March 2013 22:38, Tony Prisk <[email protected]> wrote:
> On Mon, 2013-03-04 at 14:39 +0530, Sachin Kamat wrote:
>> Use the newly introduced devm_ioremap_resource() instead of
>> devm_request_and_ioremap() 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: Sachin Kamat <[email protected]>

> Acked-by: Tony Prisk <[email protected]>

Would you be picking this patch up or Grant is gonna handle it?


--
With warm regards,
Sachin

2013-03-27 08:32:58

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 1/1] gpio/vt8500: Convert to devm_ioremap_resource()

On Mon, Mar 4, 2013 at 10:09 AM, Sachin Kamat <[email protected]> wrote:

> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() 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: Sachin Kamat <[email protected]>

Patch applied with Tony's and Thierry's ACKs/Reviewed-by.

Yours,
Linus Walleij