2013-03-11 07:35:26

by Silviu-Mihai Popescu

[permalink] [raw]
Subject: [PATCH] kirkwood: fix coccicheck warnings

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 <[email protected]>
---
drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
drivers/thermal/kirkwood_thermal.c | 8 +++-----
3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
index 0e83e3c..6052476 100644
--- a/drivers/cpufreq/kirkwood-cpufreq.c
+++ b/drivers/cpufreq/kirkwood-cpufreq.c
@@ -175,11 +175,9 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Cannot get memory resource\n");
return -ENODEV;
}
- priv.base = devm_request_and_ioremap(&pdev->dev, res);
- if (!priv.base) {
- dev_err(&pdev->dev, "Cannot ioremap\n");
- return -EADDRNOTAVAIL;
- }
+ priv.base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(priv.base))
+ return PTR_ERR(priv.base);

np = of_find_node_by_path("/cpus/cpu@0");
if (!np)
diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
index 670aa1e..53aad73 100644
--- a/drivers/cpuidle/cpuidle-kirkwood.c
+++ b/drivers/cpuidle/cpuidle-kirkwood.c
@@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
if (res == NULL)
return -EINVAL;

- ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
- if (!ddr_operation_base)
- return -EADDRNOTAVAIL;
+ ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(ddr_operation_base))
+ return PTR_ERR(ddr_operation_base);

device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
device->state_count = KIRKWOOD_MAX_STATES;
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
index 65cb4f0..e5500ed 100644
--- a/drivers/thermal/kirkwood_thermal.c
+++ b/drivers/thermal/kirkwood_thermal.c
@@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;

- priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
- if (!priv->sensor) {
- dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
- return -EADDRNOTAVAIL;
- }
+ priv->sensor = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(priv->sensor))
+ return PTR_ERR(priv->sensor);

thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
priv, &ops, NULL, 0, 0);
--
1.7.9.5


2013-03-11 07:56:34

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Mon, Mar 11, 2013 at 09:35:19AM +0200, 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.
>
> Signed-off-by: Silviu-Mihai Popescu <[email protected]>
> ---

Acked-by: Andrew Lunn <[email protected]>

Thanks
Andrew


> drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
> drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
> drivers/thermal/kirkwood_thermal.c | 8 +++-----
> 3 files changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
> index 0e83e3c..6052476 100644
> --- a/drivers/cpufreq/kirkwood-cpufreq.c
> +++ b/drivers/cpufreq/kirkwood-cpufreq.c
> @@ -175,11 +175,9 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "Cannot get memory resource\n");
> return -ENODEV;
> }
> - priv.base = devm_request_and_ioremap(&pdev->dev, res);
> - if (!priv.base) {
> - dev_err(&pdev->dev, "Cannot ioremap\n");
> - return -EADDRNOTAVAIL;
> - }
> + priv.base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(priv.base))
> + return PTR_ERR(priv.base);
>
> np = of_find_node_by_path("/cpus/cpu@0");
> if (!np)
> diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> index 670aa1e..53aad73 100644
> --- a/drivers/cpuidle/cpuidle-kirkwood.c
> +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> if (res == NULL)
> return -EINVAL;
>
> - ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
> - if (!ddr_operation_base)
> - return -EADDRNOTAVAIL;
> + ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(ddr_operation_base))
> + return PTR_ERR(ddr_operation_base);
>
> device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> device->state_count = KIRKWOOD_MAX_STATES;
> diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> index 65cb4f0..e5500ed 100644
> --- a/drivers/thermal/kirkwood_thermal.c
> +++ b/drivers/thermal/kirkwood_thermal.c
> @@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
> if (!priv)
> return -ENOMEM;
>
> - priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> - if (!priv->sensor) {
> - dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
> - return -EADDRNOTAVAIL;
> - }
> + priv->sensor = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(priv->sensor))
> + return PTR_ERR(priv->sensor);
>
> thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
> priv, &ops, NULL, 0, 0);
> --
> 1.7.9.5
>

2013-03-11 13:46:31

by Jason Cooper

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Mon, Mar 11, 2013 at 09:35:19AM +0200, 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.
>
> Signed-off-by: Silviu-Mihai Popescu <[email protected]>
> ---
> drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
> drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
> drivers/thermal/kirkwood_thermal.c | 8 +++-----
> 3 files changed, 9 insertions(+), 13 deletions(-)

Acked-by: Jason Cooper <[email protected]>

thx,

Jason.

2013-03-11 13:49:34

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Mon, Mar 11, 2013 at 3:35 PM, Silviu-Mihai Popescu
<[email protected]> 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.
>
> Signed-off-by: Silviu-Mihai Popescu <[email protected]>

Acked-by: Viresh Kumar <[email protected]>

2013-03-11 14:55:09

by Zhang, Rui

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Mon, 2013-03-11 at 09:35 +0200, 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.
>
> Signed-off-by: Silviu-Mihai Popescu <[email protected]>
> ---
> drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
> drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
> drivers/thermal/kirkwood_thermal.c | 8 +++-----
> 3 files changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
> index 0e83e3c..6052476 100644
> --- a/drivers/cpufreq/kirkwood-cpufreq.c
> +++ b/drivers/cpufreq/kirkwood-cpufreq.c
> @@ -175,11 +175,9 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "Cannot get memory resource\n");
> return -ENODEV;
> }
> - priv.base = devm_request_and_ioremap(&pdev->dev, res);
> - if (!priv.base) {
> - dev_err(&pdev->dev, "Cannot ioremap\n");
> - return -EADDRNOTAVAIL;
> - }
> + priv.base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(priv.base))
> + return PTR_ERR(priv.base);
>
> np = of_find_node_by_path("/cpus/cpu@0");
> if (!np)
> diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> index 670aa1e..53aad73 100644
> --- a/drivers/cpuidle/cpuidle-kirkwood.c
> +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> if (res == NULL)
> return -EINVAL;
>
> - ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
> - if (!ddr_operation_base)
> - return -EADDRNOTAVAIL;
> + ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(ddr_operation_base))
> + return PTR_ERR(ddr_operation_base);
>
> device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> device->state_count = KIRKWOOD_MAX_STATES;
> diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> index 65cb4f0..e5500ed 100644
> --- a/drivers/thermal/kirkwood_thermal.c
> +++ b/drivers/thermal/kirkwood_thermal.c
> @@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
> if (!priv)
> return -ENOMEM;
>
> - priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> - if (!priv->sensor) {
> - dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
> - return -EADDRNOTAVAIL;
> - }
> + priv->sensor = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(priv->sensor))
> + return PTR_ERR(priv->sensor);
>
> thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
> priv, &ops, NULL, 0, 0);

there is already a fix for kirkwood_thermal.c at
http://marc.info/?l=linux-pm&m=136238017027514&w=2
and it has been applied to thermal -next.

would you please refreshed the patch?

thanks,
rui

2013-03-11 16:56:25

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Monday, March 11, 2013 10:55:00 PM Zhang Rui wrote:
> On Mon, 2013-03-11 at 09:35 +0200, 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.
> >
> > Signed-off-by: Silviu-Mihai Popescu <[email protected]>
> > ---
> > drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
> > drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
> > drivers/thermal/kirkwood_thermal.c | 8 +++-----
> > 3 files changed, 9 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
> > index 0e83e3c..6052476 100644
> > --- a/drivers/cpufreq/kirkwood-cpufreq.c
> > +++ b/drivers/cpufreq/kirkwood-cpufreq.c
> > @@ -175,11 +175,9 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
> > dev_err(&pdev->dev, "Cannot get memory resource\n");
> > return -ENODEV;
> > }
> > - priv.base = devm_request_and_ioremap(&pdev->dev, res);
> > - if (!priv.base) {
> > - dev_err(&pdev->dev, "Cannot ioremap\n");
> > - return -EADDRNOTAVAIL;
> > - }
> > + priv.base = devm_ioremap_resource(&pdev->dev, res);
> > + if (IS_ERR(priv.base))
> > + return PTR_ERR(priv.base);
> >
> > np = of_find_node_by_path("/cpus/cpu@0");
> > if (!np)
> > diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> > index 670aa1e..53aad73 100644
> > --- a/drivers/cpuidle/cpuidle-kirkwood.c
> > +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> > @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> > if (res == NULL)
> > return -EINVAL;
> >
> > - ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
> > - if (!ddr_operation_base)
> > - return -EADDRNOTAVAIL;
> > + ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
> > + if (IS_ERR(ddr_operation_base))
> > + return PTR_ERR(ddr_operation_base);
> >
> > device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> > device->state_count = KIRKWOOD_MAX_STATES;
> > diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> > index 65cb4f0..e5500ed 100644
> > --- a/drivers/thermal/kirkwood_thermal.c
> > +++ b/drivers/thermal/kirkwood_thermal.c
> > @@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
> > if (!priv)
> > return -ENOMEM;
> >
> > - priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> > - if (!priv->sensor) {
> > - dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
> > - return -EADDRNOTAVAIL;
> > - }
> > + priv->sensor = devm_ioremap_resource(&pdev->dev, res);
> > + if (IS_ERR(priv->sensor))
> > + return PTR_ERR(priv->sensor);
> >
> > thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
> > priv, &ops, NULL, 0, 0);
>
> there is already a fix for kirkwood_thermal.c at
> http://marc.info/?l=linux-pm&m=136238017027514&w=2
> and it has been applied to thermal -next.
>
> would you please refreshed the patch?

Are you going to take that patch into your tree, then?

Rafael


--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

2013-03-11 17:02:28

by Silviu-Mihai Popescu

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Mon, Mar 11, 2013 at 7:03 PM, Rafael J. Wysocki <[email protected]> wrote:
> On Monday, March 11, 2013 10:55:00 PM Zhang Rui wrote:
>> On Mon, 2013-03-11 at 09:35 +0200, 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.
>> >
>> > Signed-off-by: Silviu-Mihai Popescu <[email protected]>
>> > ---
>> > drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
>> > drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
>> > drivers/thermal/kirkwood_thermal.c | 8 +++-----
>> > 3 files changed, 9 insertions(+), 13 deletions(-)
>> >
>> > diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
>> > index 0e83e3c..6052476 100644
>> > --- a/drivers/cpufreq/kirkwood-cpufreq.c
>> > +++ b/drivers/cpufreq/kirkwood-cpufreq.c
>> > @@ -175,11 +175,9 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
>> > dev_err(&pdev->dev, "Cannot get memory resource\n");
>> > return -ENODEV;
>> > }
>> > - priv.base = devm_request_and_ioremap(&pdev->dev, res);
>> > - if (!priv.base) {
>> > - dev_err(&pdev->dev, "Cannot ioremap\n");
>> > - return -EADDRNOTAVAIL;
>> > - }
>> > + priv.base = devm_ioremap_resource(&pdev->dev, res);
>> > + if (IS_ERR(priv.base))
>> > + return PTR_ERR(priv.base);
>> >
>> > np = of_find_node_by_path("/cpus/cpu@0");
>> > if (!np)
>> > diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
>> > index 670aa1e..53aad73 100644
>> > --- a/drivers/cpuidle/cpuidle-kirkwood.c
>> > +++ b/drivers/cpuidle/cpuidle-kirkwood.c
>> > @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
>> > if (res == NULL)
>> > return -EINVAL;
>> >
>> > - ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
>> > - if (!ddr_operation_base)
>> > - return -EADDRNOTAVAIL;
>> > + ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
>> > + if (IS_ERR(ddr_operation_base))
>> > + return PTR_ERR(ddr_operation_base);
>> >
>> > device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
>> > device->state_count = KIRKWOOD_MAX_STATES;
>> > diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
>> > index 65cb4f0..e5500ed 100644
>> > --- a/drivers/thermal/kirkwood_thermal.c
>> > +++ b/drivers/thermal/kirkwood_thermal.c
>> > @@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
>> > if (!priv)
>> > return -ENOMEM;
>> >
>> > - priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
>> > - if (!priv->sensor) {
>> > - dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
>> > - return -EADDRNOTAVAIL;
>> > - }
>> > + priv->sensor = devm_ioremap_resource(&pdev->dev, res);
>> > + if (IS_ERR(priv->sensor))
>> > + return PTR_ERR(priv->sensor);
>> >
>> > thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
>> > priv, &ops, NULL, 0, 0);
>>
>> there is already a fix for kirkwood_thermal.c at
>> http://marc.info/?l=linux-pm&m=136238017027514&w=2
>> and it has been applied to thermal -next.
>>
>> would you please refreshed the patch?
>
> Are you going to take that patch into your tree, then?

Hello,

I have sent a second version of the patch which does not modify
kirkwood_thermal.c.
Therefore the existing patch and the one I resent can be applied independently.

--
Silviu Popescu

2013-03-11 23:58:43

by Zhang, Rui

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Mon, 2013-03-11 at 18:03 +0100, Rafael J. Wysocki wrote:
> On Monday, March 11, 2013 10:55:00 PM Zhang Rui wrote:
> > On Mon, 2013-03-11 at 09:35 +0200, 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.
> > >
> > > Signed-off-by: Silviu-Mihai Popescu <[email protected]>
> > > ---
> > > drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
> > > drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
> > > drivers/thermal/kirkwood_thermal.c | 8 +++-----
> > > 3 files changed, 9 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
> > > index 0e83e3c..6052476 100644
> > > --- a/drivers/cpufreq/kirkwood-cpufreq.c
> > > +++ b/drivers/cpufreq/kirkwood-cpufreq.c
> > > @@ -175,11 +175,9 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
> > > dev_err(&pdev->dev, "Cannot get memory resource\n");
> > > return -ENODEV;
> > > }
> > > - priv.base = devm_request_and_ioremap(&pdev->dev, res);
> > > - if (!priv.base) {
> > > - dev_err(&pdev->dev, "Cannot ioremap\n");
> > > - return -EADDRNOTAVAIL;
> > > - }
> > > + priv.base = devm_ioremap_resource(&pdev->dev, res);
> > > + if (IS_ERR(priv.base))
> > > + return PTR_ERR(priv.base);
> > >
> > > np = of_find_node_by_path("/cpus/cpu@0");
> > > if (!np)
> > > diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> > > index 670aa1e..53aad73 100644
> > > --- a/drivers/cpuidle/cpuidle-kirkwood.c
> > > +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> > > @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> > > if (res == NULL)
> > > return -EINVAL;
> > >
> > > - ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
> > > - if (!ddr_operation_base)
> > > - return -EADDRNOTAVAIL;
> > > + ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
> > > + if (IS_ERR(ddr_operation_base))
> > > + return PTR_ERR(ddr_operation_base);
> > >
> > > device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> > > device->state_count = KIRKWOOD_MAX_STATES;
> > > diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> > > index 65cb4f0..e5500ed 100644
> > > --- a/drivers/thermal/kirkwood_thermal.c
> > > +++ b/drivers/thermal/kirkwood_thermal.c
> > > @@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
> > > if (!priv)
> > > return -ENOMEM;
> > >
> > > - priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> > > - if (!priv->sensor) {
> > > - dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
> > > - return -EADDRNOTAVAIL;
> > > - }
> > > + priv->sensor = devm_ioremap_resource(&pdev->dev, res);
> > > + if (IS_ERR(priv->sensor))
> > > + return PTR_ERR(priv->sensor);
> > >
> > > thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
> > > priv, &ops, NULL, 0, 0);
> >
> > there is already a fix for kirkwood_thermal.c at
> > http://marc.info/?l=linux-pm&m=136238017027514&w=2
> > and it has been applied to thermal -next.
> >
> > would you please refreshed the patch?
>
> Are you going to take that patch into your tree, then?

I'll take the one that fixes kirkwood_thermal.c. :)

thanks,
rui

2013-03-12 00:03:48

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Tuesday, March 12, 2013 07:58:16 AM Zhang Rui wrote:
> On Mon, 2013-03-11 at 18:03 +0100, Rafael J. Wysocki wrote:
> > On Monday, March 11, 2013 10:55:00 PM Zhang Rui wrote:
> > > On Mon, 2013-03-11 at 09:35 +0200, 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.
> > > >
> > > > Signed-off-by: Silviu-Mihai Popescu <[email protected]>
> > > > ---
> > > > drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
> > > > drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
> > > > drivers/thermal/kirkwood_thermal.c | 8 +++-----
> > > > 3 files changed, 9 insertions(+), 13 deletions(-)
> > > >
> > > > diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
> > > > index 0e83e3c..6052476 100644
> > > > --- a/drivers/cpufreq/kirkwood-cpufreq.c
> > > > +++ b/drivers/cpufreq/kirkwood-cpufreq.c
> > > > @@ -175,11 +175,9 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
> > > > dev_err(&pdev->dev, "Cannot get memory resource\n");
> > > > return -ENODEV;
> > > > }
> > > > - priv.base = devm_request_and_ioremap(&pdev->dev, res);
> > > > - if (!priv.base) {
> > > > - dev_err(&pdev->dev, "Cannot ioremap\n");
> > > > - return -EADDRNOTAVAIL;
> > > > - }
> > > > + priv.base = devm_ioremap_resource(&pdev->dev, res);
> > > > + if (IS_ERR(priv.base))
> > > > + return PTR_ERR(priv.base);
> > > >
> > > > np = of_find_node_by_path("/cpus/cpu@0");
> > > > if (!np)
> > > > diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> > > > index 670aa1e..53aad73 100644
> > > > --- a/drivers/cpuidle/cpuidle-kirkwood.c
> > > > +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> > > > @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> > > > if (res == NULL)
> > > > return -EINVAL;
> > > >
> > > > - ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
> > > > - if (!ddr_operation_base)
> > > > - return -EADDRNOTAVAIL;
> > > > + ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
> > > > + if (IS_ERR(ddr_operation_base))
> > > > + return PTR_ERR(ddr_operation_base);
> > > >
> > > > device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> > > > device->state_count = KIRKWOOD_MAX_STATES;
> > > > diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> > > > index 65cb4f0..e5500ed 100644
> > > > --- a/drivers/thermal/kirkwood_thermal.c
> > > > +++ b/drivers/thermal/kirkwood_thermal.c
> > > > @@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
> > > > if (!priv)
> > > > return -ENOMEM;
> > > >
> > > > - priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> > > > - if (!priv->sensor) {
> > > > - dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
> > > > - return -EADDRNOTAVAIL;
> > > > - }
> > > > + priv->sensor = devm_ioremap_resource(&pdev->dev, res);
> > > > + if (IS_ERR(priv->sensor))
> > > > + return PTR_ERR(priv->sensor);
> > > >
> > > > thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
> > > > priv, &ops, NULL, 0, 0);
> > >
> > > there is already a fix for kirkwood_thermal.c at
> > > http://marc.info/?l=linux-pm&m=136238017027514&w=2
> > > and it has been applied to thermal -next.
> > >
> > > would you please refreshed the patch?
> >
> > Are you going to take that patch into your tree, then?
>
> I'll take the one that fixes kirkwood_thermal.c. :)

OK

Thanks,
Rafael


--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

2013-03-21 23:41:09

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Monday, March 11, 2013 09:35:19 AM 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.
>
> Signed-off-by: Silviu-Mihai Popescu <[email protected]>

If I'm supposed to take these changes, please split them into separate patches
for cpufreq, cpuidle and thermal (which would be for Rui BTW).

Thanks,
Rafael


> ---
> drivers/cpufreq/kirkwood-cpufreq.c | 8 +++-----
> drivers/cpuidle/cpuidle-kirkwood.c | 6 +++---
> drivers/thermal/kirkwood_thermal.c | 8 +++-----
> 3 files changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
> index 0e83e3c..6052476 100644
> --- a/drivers/cpufreq/kirkwood-cpufreq.c
> +++ b/drivers/cpufreq/kirkwood-cpufreq.c
> @@ -175,11 +175,9 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "Cannot get memory resource\n");
> return -ENODEV;
> }
> - priv.base = devm_request_and_ioremap(&pdev->dev, res);
> - if (!priv.base) {
> - dev_err(&pdev->dev, "Cannot ioremap\n");
> - return -EADDRNOTAVAIL;
> - }
> + priv.base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(priv.base))
> + return PTR_ERR(priv.base);
>
> np = of_find_node_by_path("/cpus/cpu@0");
> if (!np)
> diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> index 670aa1e..53aad73 100644
> --- a/drivers/cpuidle/cpuidle-kirkwood.c
> +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> if (res == NULL)
> return -EINVAL;
>
> - ddr_operation_base = devm_request_and_ioremap(&pdev->dev, res);
> - if (!ddr_operation_base)
> - return -EADDRNOTAVAIL;
> + ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(ddr_operation_base))
> + return PTR_ERR(ddr_operation_base);
>
> device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> device->state_count = KIRKWOOD_MAX_STATES;
> diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> index 65cb4f0..e5500ed 100644
> --- a/drivers/thermal/kirkwood_thermal.c
> +++ b/drivers/thermal/kirkwood_thermal.c
> @@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
> if (!priv)
> return -ENOMEM;
>
> - priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> - if (!priv->sensor) {
> - dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
> - return -EADDRNOTAVAIL;
> - }
> + priv->sensor = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(priv->sensor))
> + return PTR_ERR(priv->sensor);
>
> thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
> priv, &ops, NULL, 0, 0);
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

2013-03-22 00:18:40

by Silviu-Mihai Popescu

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Fri, Mar 22, 2013 at 1:48 AM, Rafael J. Wysocki <[email protected]> wrote:
> On Monday, March 11, 2013 09:35:19 AM 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.
>>
>> Signed-off-by: Silviu-Mihai Popescu <[email protected]>
>
> If I'm supposed to take these changes, please split them into separate patches
> for cpufreq, cpuidle and thermal (which would be for Rui BTW).

There seems to be an existing patch for thermal[1], as Rui pointed out himself.
I have split the changes in two patches, as you have requested, and resent them.

[1] http://marc.info/?l=linux-pm&m=136238017027514&w=2

Thanks,
Silviu Popescu

2013-03-22 00:36:21

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] kirkwood: fix coccicheck warnings

On Friday, March 22, 2013 02:18:38 AM Silviu Popescu wrote:
> On Fri, Mar 22, 2013 at 1:48 AM, Rafael J. Wysocki <[email protected]> wrote:
> > On Monday, March 11, 2013 09:35:19 AM 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.
> >>
> >> Signed-off-by: Silviu-Mihai Popescu <[email protected]>
> >
> > If I'm supposed to take these changes, please split them into separate patches
> > for cpufreq, cpuidle and thermal (which would be for Rui BTW).
>
> There seems to be an existing patch for thermal[1], as Rui pointed out himself.
> I have split the changes in two patches, as you have requested, and resent them.
>
> [1] http://marc.info/?l=linux-pm&m=136238017027514&w=2

Thanks a lot!

Rafael


--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.