diff mbox

[11/15] regulator: ti-abb: Convert to use devm_ioremap_resource

Message ID 1370864113-17895-12-git-send-email-tushar.behera@linaro.org
State Superseded
Headers show

Commit Message

Tushar Behera June 10, 2013, 11:35 a.m. UTC
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: Mark Brown <broonie@kernel.org>
CC: Liam Girdwood <lgirdwood@gmail.com>
---
 drivers/regulator/ti-abb-regulator.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Sachin Kamat June 10, 2013, 12:01 p.m. UTC | #1
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: Mark Brown <broonie@kernel.org>
> CC: Liam Girdwood <lgirdwood@gmail.com>
> ---
>  drivers/regulator/ti-abb-regulator.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
> index 870d209..f494a11 100644
> --- a/drivers/regulator/ti-abb-regulator.c
> +++ b/drivers/regulator/ti-abb-regulator.c
> @@ -722,10 +722,10 @@ static int ti_abb_probe(struct platform_device *pdev)
>                 ret = -ENODEV;
>                 goto err;
>         }
> -       abb->base = devm_request_and_ioremap(dev, res);
> -       if (!abb->base) {
> +       abb->base = devm_ioremap_resource(dev, res);
> +       if (IS_ERR(abb->base)) {
>                 dev_err(dev, "Unable to map '%s'\n", pname);

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

> -               ret = -ENOMEM;
> +               ret = PTR_ERR(abb->base);
>                 goto err;
>         }
>
> @@ -776,10 +776,10 @@ static int ti_abb_probe(struct platform_device *pdev)
>                 ret = -ENODEV;
>                 goto skip_opt;
>         }
> -       abb->ldo_base = devm_request_and_ioremap(dev, res);
> -       if (!abb->ldo_base) {
> +       abb->ldo_base = devm_ioremap_resource(dev, res);
> +       if (IS_ERR(abb->ldo_base)) {
>                 dev_err(dev, "Unable to map '%s'\n", pname);

ditto

> -               ret = -ENOMEM;
> +               ret = PTR_ERR(abb->ldo_base);
>                 goto err;
>         }
>
> --
> 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:31 a.m. UTC | #2
On 06/10/2013 05:31 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: Mark Brown <broonie@kernel.org>
>> CC: Liam Girdwood <lgirdwood@gmail.com>
>> ---
>>  drivers/regulator/ti-abb-regulator.c |   12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
>> index 870d209..f494a11 100644
>> --- a/drivers/regulator/ti-abb-regulator.c
>> +++ b/drivers/regulator/ti-abb-regulator.c
>> @@ -722,10 +722,10 @@ static int ti_abb_probe(struct platform_device *pdev)
>>                 ret = -ENODEV;
>>                 goto err;
>>         }
>> -       abb->base = devm_request_and_ioremap(dev, res);
>> -       if (!abb->base) {
>> +       abb->base = devm_ioremap_resource(dev, res);
>> +       if (IS_ERR(abb->base)) {
>>                 dev_err(dev, "Unable to map '%s'\n", pname);
> 
> You may remove the above error message as devm_ioremap_resource prints
> its own error messages.
> 

There are a few other error messages in the driver (related to
devm_ioremap_nocache) in the same format. I would prefer to leave this
error message right now.

>> -               ret = -ENOMEM;
>> +               ret = PTR_ERR(abb->base);
>>                 goto err;
>>         }
>>
>> @@ -776,10 +776,10 @@ static int ti_abb_probe(struct platform_device *pdev)
>>                 ret = -ENODEV;
>>                 goto skip_opt;
>>         }
>> -       abb->ldo_base = devm_request_and_ioremap(dev, res);
>> -       if (!abb->ldo_base) {
>> +       abb->ldo_base = devm_ioremap_resource(dev, res);
>> +       if (IS_ERR(abb->ldo_base)) {
>>                 dev_err(dev, "Unable to map '%s'\n", pname);
> 
> ditto
> 

Same as above.

Thanks.
Tushar Behera June 17, 2013, 9:12 a.m. UTC | #3
On 06/10/2013 05:05 PM, Tushar Behera 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: Mark Brown <broonie@kernel.org>
> CC: Liam Girdwood <lgirdwood@gmail.com>
> ---
>  drivers/regulator/ti-abb-regulator.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
> index 870d209..f494a11 100644
> --- a/drivers/regulator/ti-abb-regulator.c
> +++ b/drivers/regulator/ti-abb-regulator.c
> @@ -722,10 +722,10 @@ static int ti_abb_probe(struct platform_device *pdev)
>  		ret = -ENODEV;
>  		goto err;
>  	}
> -	abb->base = devm_request_and_ioremap(dev, res);
> -	if (!abb->base) {
> +	abb->base = devm_ioremap_resource(dev, res);
> +	if (IS_ERR(abb->base)) {
>  		dev_err(dev, "Unable to map '%s'\n", pname);
> -		ret = -ENOMEM;
> +		ret = PTR_ERR(abb->base);
>  		goto err;
>  	}
>  
> @@ -776,10 +776,10 @@ static int ti_abb_probe(struct platform_device *pdev)
>  		ret = -ENODEV;
>  		goto skip_opt;
>  	}
> -	abb->ldo_base = devm_request_and_ioremap(dev, res);
> -	if (!abb->ldo_base) {
> +	abb->ldo_base = devm_ioremap_resource(dev, res);
> +	if (IS_ERR(abb->ldo_base)) {
>  		dev_err(dev, "Unable to map '%s'\n", pname);
> -		ret = -ENOMEM;
> +		ret = PTR_ERR(abb->ldo_base);
>  		goto err;
>  	}
>  
> 

Ping.
Mark Brown June 17, 2013, 10:05 a.m. UTC | #4
On Mon, Jun 17, 2013 at 02:42:25PM +0530, Tushar Behera wrote:
> On 06/10/2013 05:05 PM, Tushar Behera wrote:
> > Commit 75096579c3ac ("lib: devres: Introduce devm_ioremap_resource()")
> > introduced devm_ioremap_resource() and deprecated the use of
> > devm_request_and_ioremap().

> Ping.

Don't send contentless pings.  I seem to recall you already got some
review on this.
Tushar Behera June 17, 2013, 10:34 a.m. UTC | #5
On 06/17/2013 03:35 PM, Mark Brown wrote:
> On Mon, Jun 17, 2013 at 02:42:25PM +0530, Tushar Behera wrote:
>> On 06/10/2013 05:05 PM, Tushar Behera wrote:
>>> Commit 75096579c3ac ("lib: devres: Introduce devm_ioremap_resource()")
>>> introduced devm_ioremap_resource() and deprecated the use of
>>> devm_request_and_ioremap().
> 
>> Ping.
> 
> Don't send contentless pings.  I seem to recall you already got some
> review on this.
> 

The comment was on removal of the error message during
devm_ioremap_resource() error check . Since there are a few other error
messages in the driver (related to devm_ioremap_nocache) in the same
format, I prefer to leave this error message right now.

There were no other comments.
Mark Brown June 17, 2013, 4:08 p.m. UTC | #6
On Mon, Jun 17, 2013 at 04:04:52PM +0530, Tushar Behera wrote:
> On 06/17/2013 03:35 PM, Mark Brown wrote:
> > On Mon, Jun 17, 2013 at 02:42:25PM +0530, Tushar Behera wrote:

> >> Ping.
i
> > Don't send contentless pings.  I seem to recall you already got some
> > review on this.

> 
> The comment was on removal of the error message during
> devm_ioremap_resource() error check . Since there are a few other error
> messages in the driver (related to devm_ioremap_nocache) in the same
> format, I prefer to leave this error message right now.

So we should say the same thing repeatedly?  That seems silly.  That
seems silly.   It's like the contentless pings issue...
Thierry Reding June 17, 2013, 7:45 p.m. UTC | #7
On Mon, Jun 17, 2013 at 05:08:53PM +0100, Mark Brown wrote:
> On Mon, Jun 17, 2013 at 04:04:52PM +0530, Tushar Behera wrote:
> > On 06/17/2013 03:35 PM, Mark Brown wrote:
> > > On Mon, Jun 17, 2013 at 02:42:25PM +0530, Tushar Behera wrote:
> 
> > >> Ping.
> i
> > > Don't send contentless pings.  I seem to recall you already got some
> > > review on this.
> 
> > 
> > The comment was on removal of the error message during
> > devm_ioremap_resource() error check . Since there are a few other error
> > messages in the driver (related to devm_ioremap_nocache) in the same
> > format, I prefer to leave this error message right now.
> 
> So we should say the same thing repeatedly?  That seems silly.  That
> seems silly.   It's like the contentless pings issue...

The intention was to make resource usage more consistent with the new
devm_ioremap_resource(). Part of the consistency involved to move all
error messages into the function so that callers shouldn't have to
worry about them anymore.

So I agree with Mark that there's really no use in keeping a second copy
of the error message.

Thierry
diff mbox

Patch

diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
index 870d209..f494a11 100644
--- a/drivers/regulator/ti-abb-regulator.c
+++ b/drivers/regulator/ti-abb-regulator.c
@@ -722,10 +722,10 @@  static int ti_abb_probe(struct platform_device *pdev)
 		ret = -ENODEV;
 		goto err;
 	}
-	abb->base = devm_request_and_ioremap(dev, res);
-	if (!abb->base) {
+	abb->base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(abb->base)) {
 		dev_err(dev, "Unable to map '%s'\n", pname);
-		ret = -ENOMEM;
+		ret = PTR_ERR(abb->base);
 		goto err;
 	}
 
@@ -776,10 +776,10 @@  static int ti_abb_probe(struct platform_device *pdev)
 		ret = -ENODEV;
 		goto skip_opt;
 	}
-	abb->ldo_base = devm_request_and_ioremap(dev, res);
-	if (!abb->ldo_base) {
+	abb->ldo_base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(abb->ldo_base)) {
 		dev_err(dev, "Unable to map '%s'\n", pname);
-		ret = -ENOMEM;
+		ret = PTR_ERR(abb->ldo_base);
 		goto err;
 	}