diff mbox

[09/15] net: can: Convert to use devm_ioremap_resource

Message ID 1370864113-17895-10-git-send-email-tushar.behera@linaro.org
State Accepted
Commit 32766fff24a761079636bb96c389411d24a334c6
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: netdev@vger.kernel.org
CC: linux-can@vger.kernel.org
CC: Marc Kleine-Budde <mkl@pengutronix.de>
CC: Wolfgang Grandegger <wg@grandegger.com>
---
 drivers/net/can/c_can/c_can_platform.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marc Kleine-Budde June 10, 2013, 1:09 p.m. UTC | #1
On 06/10/2013 01:35 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().

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>

Are the patches going over the individual subsystem maintainers?

Marc
Tushar Behera June 11, 2013, 3:15 a.m. UTC | #2
+CC: 'Greg Kroah-Hartman' <gregkh@linuxfoundation.org>

On 06/10/2013 06:39 PM, Marc Kleine-Budde wrote:
> On 06/10/2013 01:35 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().
> 
> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
> 
> Are the patches going over the individual subsystem maintainers?
> 
> Marc
> 

I am not sure. Looping in Greg for clarity.
Greg KH June 12, 2013, 3:09 a.m. UTC | #3
On Tue, Jun 11, 2013 at 08:45:47AM +0530, Tushar Behera wrote:
> +CC: 'Greg Kroah-Hartman' <gregkh@linuxfoundation.org>
> 
> On 06/10/2013 06:39 PM, Marc Kleine-Budde wrote:
> > On 06/10/2013 01:35 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().
> > 
> > Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > 
> > Are the patches going over the individual subsystem maintainers?
> > 
> > Marc
> > 
> 
> I am not sure. Looping in Greg for clarity.

I'm taking the ones for my subsystem(s), the last one should probably go
in after 3.11-rc1 is released, in order to ensure no remaining in-tree
users of the function are still around.

thanks,

greg k-h
David Miller June 12, 2013, 9:23 a.m. UTC | #4
From: Tushar Behera <tushar.behera@linaro.org>
Date: Mon, 10 Jun 2013 17:05:07 +0530

> 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>

Applied.
Tushar Behera June 13, 2013, 5:30 a.m. UTC | #5
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: netdev@vger.kernel.org
> CC: linux-can@vger.kernel.org
> CC: Marc Kleine-Budde <mkl@pengutronix.de>
> CC: Wolfgang Grandegger <wg@grandegger.com>
> ---
>  drivers/net/can/c_can/c_can_platform.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
> index 6b6130b..b918c73 100644
> --- a/drivers/net/can/c_can/c_can_platform.c
> +++ b/drivers/net/can/c_can/c_can_platform.c
> @@ -201,8 +201,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
>  			priv->instance = pdev->id;
>  
>  		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -		priv->raminit_ctrlreg =	devm_request_and_ioremap(&pdev->dev, res);
> -		if (!priv->raminit_ctrlreg || priv->instance < 0)
> +		priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
> +		if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
>  			dev_info(&pdev->dev, "control memory is not used for raminit\n");
>  		else
>  			priv->raminit = c_can_hw_raminit;
> 

IS_ERR() check on the return value of devm_ioremap_resource produces
following sparse warning. This is because of the __iomem address space
attribute. How should we fix this?

drivers/net/can/c_can/c_can_platform.c:205:32: warning: incorrect type
in argument 1 (different address spaces)
drivers/net/can/c_can/c_can_platform.c:205:32:    expected void const *ptr
drivers/net/can/c_can/c_can_platform.c:205:32:    got unsigned int
[noderef] [usertype] <asn:2>*raminit_ctrlreg
Sachin Kamat June 13, 2013, 5:41 a.m. UTC | #6
On 13 June 2013 11:00, Tushar Behera <tushar.behera@linaro.org> 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().
>>
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> CC: netdev@vger.kernel.org
>> CC: linux-can@vger.kernel.org
>> CC: Marc Kleine-Budde <mkl@pengutronix.de>
>> CC: Wolfgang Grandegger <wg@grandegger.com>
>> ---
>>  drivers/net/can/c_can/c_can_platform.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
>> index 6b6130b..b918c73 100644
>> --- a/drivers/net/can/c_can/c_can_platform.c
>> +++ b/drivers/net/can/c_can/c_can_platform.c
>> @@ -201,8 +201,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
>>                       priv->instance = pdev->id;
>>
>>               res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>> -             priv->raminit_ctrlreg = devm_request_and_ioremap(&pdev->dev, res);
>> -             if (!priv->raminit_ctrlreg || priv->instance < 0)
>> +             priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
>> +             if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
>>                       dev_info(&pdev->dev, "control memory is not used for raminit\n");
>>               else
>>                       priv->raminit = c_can_hw_raminit;
>>
>
> IS_ERR() check on the return value of devm_ioremap_resource produces
> following sparse warning. This is because of the __iomem address space
> attribute. How should we fix this?
>
> drivers/net/can/c_can/c_can_platform.c:205:32: warning: incorrect type
> in argument 1 (different address spaces)
> drivers/net/can/c_can/c_can_platform.c:205:32:    expected void const *ptr
> drivers/net/can/c_can/c_can_platform.c:205:32:    got unsigned int
> [noderef] [usertype] <asn:2>*raminit_ctrlreg
>

This is a known issue since the time devm_ioremap_resource was
introduced. Thierry had already submitted some fixes for this.
I am not sure if they have been applied yet.
More details here:
https://patchwork.kernel.org/patch/2071361/
diff mbox

Patch

diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 6b6130b..b918c73 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -201,8 +201,8 @@  static int c_can_plat_probe(struct platform_device *pdev)
 			priv->instance = pdev->id;
 
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		priv->raminit_ctrlreg =	devm_request_and_ioremap(&pdev->dev, res);
-		if (!priv->raminit_ctrlreg || priv->instance < 0)
+		priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
 			dev_info(&pdev->dev, "control memory is not used for raminit\n");
 		else
 			priv->raminit = c_can_hw_raminit;