public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource()
@ 2013-01-31  7:07 Sachin Kamat
  2013-01-31  7:28 ` Thierry Reding
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sachin Kamat @ 2013-01-31  7:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: sachin.kamat, Vinod Koul, Thierry Reding, Greg Kroah-Hartman

Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
This change is based against linux-next tree (20130128).
This change however introduces the followign sparse warning:
drivers/dma/pl330.c:2883:22: warning: incorrect type in argument 1 (different address spaces)
drivers/dma/pl330.c:2883:22:    expected void const *ptr
drivers/dma/pl330.c:2883:22:    got void [noderef] <asn:2>*base
drivers/dma/pl330.c:2884:34: warning: incorrect type in argument 1 (different address spaces)
drivers/dma/pl330.c:2884:34:    expected void const *ptr
drivers/dma/pl330.c:2884:34:    got void [noderef] <asn:2>*base
---
 drivers/dma/pl330.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 316a43e..142fe4d 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -25,6 +25,7 @@
 #include <linux/amba/pl330.h>
 #include <linux/scatterlist.h>
 #include <linux/of.h>
+#include <linux/err.h>
 
 #include "dmaengine.h"
 #define PL330_MAX_CHAN		8
@@ -2878,9 +2879,9 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 	pi->mcbufsz = pdat ? pdat->mcbuf_sz : 0;
 
 	res = &adev->res;
-	pi->base = devm_request_and_ioremap(&adev->dev, res);
-	if (!pi->base)
-		return -ENXIO;
+	pi->base = devm_ioremap_resource(&adev->dev, res);
+	if (IS_ERR(pi->base))
+		return PTR_ERR(pi->base);
 
 	amba_set_drvdata(adev, pdmac);
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource()
  2013-01-31  7:07 [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource() Sachin Kamat
@ 2013-01-31  7:28 ` Thierry Reding
  2013-01-31  8:09   ` Sachin Kamat
  2013-01-31  7:30 ` Greg Kroah-Hartman
  2013-01-31  8:12 ` Thierry Reding
  2 siblings, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2013-01-31  7:28 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, Vinod Koul, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]

On Thu, Jan 31, 2013 at 12:37:04PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() which provides more consistent error handling.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> This change is based against linux-next tree (20130128).
> This change however introduces the followign sparse warning:
> drivers/dma/pl330.c:2883:22: warning: incorrect type in argument 1 (different address spaces)
> drivers/dma/pl330.c:2883:22:    expected void const *ptr
> drivers/dma/pl330.c:2883:22:    got void [noderef] <asn:2>*base
> drivers/dma/pl330.c:2884:34: warning: incorrect type in argument 1 (different address spaces)
> drivers/dma/pl330.c:2884:34:    expected void const *ptr
> drivers/dma/pl330.c:2884:34:    got void [noderef] <asn:2>*base

Yes, those are false positives. They can be fixed with the two patches I
posted a few hours ago, starting here:

	https://lkml.org/lkml/2013/1/30/455

Note that the first patch is against sparse. The problem, in a nutshell,
is that sparse complains that the pointer address spaces and noderef
attributes differ. In the case of the IS_ERR() function and friends the
attributes aren't relevant because only the pointer value is only used
arithmetically. Unfortunately there is no way you can cast away these
attributes without causing other warnings, so the solution is somewhat
more complex.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource()
  2013-01-31  7:07 [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource() Sachin Kamat
  2013-01-31  7:28 ` Thierry Reding
@ 2013-01-31  7:30 ` Greg Kroah-Hartman
  2013-01-31  8:12 ` Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2013-01-31  7:30 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, Vinod Koul, Thierry Reding

On Thu, Jan 31, 2013 at 12:37:04PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() which provides more consistent error handling.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> This change is based against linux-next tree (20130128).
> This change however introduces the followign sparse warning:
> drivers/dma/pl330.c:2883:22: warning: incorrect type in argument 1 (different address spaces)
> drivers/dma/pl330.c:2883:22:    expected void const *ptr
> drivers/dma/pl330.c:2883:22:    got void [noderef] <asn:2>*base
> drivers/dma/pl330.c:2884:34: warning: incorrect type in argument 1 (different address spaces)
> drivers/dma/pl330.c:2884:34:    expected void const *ptr
> drivers/dma/pl330.c:2884:34:    got void [noderef] <asn:2>*base

These are known, a patch has been posted for both the kernel and sparse
to fix this up.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource()
  2013-01-31  7:28 ` Thierry Reding
@ 2013-01-31  8:09   ` Sachin Kamat
  2013-01-31  8:13     ` Thierry Reding
  0 siblings, 1 reply; 6+ messages in thread
From: Sachin Kamat @ 2013-01-31  8:09 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-kernel, Vinod Koul, Greg Kroah-Hartman

On 31 January 2013 12:58, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> On Thu, Jan 31, 2013 at 12:37:04PM +0530, Sachin Kamat wrote:
>> Use the newly introduced devm_ioremap_resource() instead of
>> devm_request_and_ioremap() which provides more consistent error handling.
>>
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>> Cc: Vinod Koul <vinod.koul@intel.com>
>> Cc: Thierry Reding <thierry.reding@avionic-design.de>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> ---
>> This change is based against linux-next tree (20130128).
>> This change however introduces the followign sparse warning:
>> drivers/dma/pl330.c:2883:22: warning: incorrect type in argument 1 (different address spaces)
>> drivers/dma/pl330.c:2883:22:    expected void const *ptr
>> drivers/dma/pl330.c:2883:22:    got void [noderef] <asn:2>*base
>> drivers/dma/pl330.c:2884:34: warning: incorrect type in argument 1 (different address spaces)
>> drivers/dma/pl330.c:2884:34:    expected void const *ptr
>> drivers/dma/pl330.c:2884:34:    got void [noderef] <asn:2>*base
>
> Yes, those are false positives. They can be fixed with the two patches I
> posted a few hours ago, starting here:
>
>         https://lkml.org/lkml/2013/1/30/455

OK. That's great.
>
> Note that the first patch is against sparse. The problem, in a nutshell,
> is that sparse complains that the pointer address spaces and noderef
> attributes differ. In the case of the IS_ERR() function and friends the
> attributes aren't relevant because only the pointer value is only used
> arithmetically. Unfortunately there is no way you can cast away these
> attributes without causing other warnings, so the solution is somewhat
> more complex.

Thanks for the explaination.
However, is the patch for the dma relevant?


-- 
With warm regards,
Sachin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource()
  2013-01-31  7:07 [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource() Sachin Kamat
  2013-01-31  7:28 ` Thierry Reding
  2013-01-31  7:30 ` Greg Kroah-Hartman
@ 2013-01-31  8:12 ` Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2013-01-31  8:12 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, Vinod Koul, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

On Thu, Jan 31, 2013 at 12:37:04PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() which provides more consistent error handling.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> This change is based against linux-next tree (20130128).
> This change however introduces the followign sparse warning:
> drivers/dma/pl330.c:2883:22: warning: incorrect type in argument 1 (different address spaces)
> drivers/dma/pl330.c:2883:22:    expected void const *ptr
> drivers/dma/pl330.c:2883:22:    got void [noderef] <asn:2>*base
> drivers/dma/pl330.c:2884:34: warning: incorrect type in argument 1 (different address spaces)
> drivers/dma/pl330.c:2884:34:    expected void const *ptr
> drivers/dma/pl330.c:2884:34:    got void [noderef] <asn:2>*base
> ---
>  drivers/dma/pl330.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 316a43e..142fe4d 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -25,6 +25,7 @@
>  #include <linux/amba/pl330.h>
>  #include <linux/scatterlist.h>
>  #include <linux/of.h>
> +#include <linux/err.h>
>  
>  #include "dmaengine.h"
>  #define PL330_MAX_CHAN		8
> @@ -2878,9 +2879,9 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>  	pi->mcbufsz = pdat ? pdat->mcbuf_sz : 0;
>  
>  	res = &adev->res;
> -	pi->base = devm_request_and_ioremap(&adev->dev, res);
> -	if (!pi->base)
> -		return -ENXIO;
> +	pi->base = devm_ioremap_resource(&adev->dev, res);
> +	if (IS_ERR(pi->base))
> +		return PTR_ERR(pi->base);
>  
>  	amba_set_drvdata(adev, pdmac);
>  

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource()
  2013-01-31  8:09   ` Sachin Kamat
@ 2013-01-31  8:13     ` Thierry Reding
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2013-01-31  8:13 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, Vinod Koul, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]

On Thu, Jan 31, 2013 at 01:39:59PM +0530, Sachin Kamat wrote:
> On 31 January 2013 12:58, Thierry Reding
> <thierry.reding@avionic-design.de> wrote:
> > On Thu, Jan 31, 2013 at 12:37:04PM +0530, Sachin Kamat wrote:
> >> Use the newly introduced devm_ioremap_resource() instead of
> >> devm_request_and_ioremap() which provides more consistent error handling.
> >>
> >> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> >> Cc: Vinod Koul <vinod.koul@intel.com>
> >> Cc: Thierry Reding <thierry.reding@avionic-design.de>
> >> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >> ---
> >> This change is based against linux-next tree (20130128).
> >> This change however introduces the followign sparse warning:
> >> drivers/dma/pl330.c:2883:22: warning: incorrect type in argument 1 (different address spaces)
> >> drivers/dma/pl330.c:2883:22:    expected void const *ptr
> >> drivers/dma/pl330.c:2883:22:    got void [noderef] <asn:2>*base
> >> drivers/dma/pl330.c:2884:34: warning: incorrect type in argument 1 (different address spaces)
> >> drivers/dma/pl330.c:2884:34:    expected void const *ptr
> >> drivers/dma/pl330.c:2884:34:    got void [noderef] <asn:2>*base
> >
> > Yes, those are false positives. They can be fixed with the two patches I
> > posted a few hours ago, starting here:
> >
> >         https://lkml.org/lkml/2013/1/30/455
> 
> OK. That's great.
> >
> > Note that the first patch is against sparse. The problem, in a nutshell,
> > is that sparse complains that the pointer address spaces and noderef
> > attributes differ. In the case of the IS_ERR() function and friends the
> > attributes aren't relevant because only the pointer value is only used
> > arithmetically. Unfortunately there is no way you can cast away these
> > attributes without causing other warnings, so the solution is somewhat
> > more complex.
> 
> Thanks for the explaination.
> However, is the patch for the dma relevant?

Yes, I forgot to add my Reviewed-by. Done now.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-31  8:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-31  7:07 [PATCH 1/1] dma: pl330: Convert to devm_ioremap_resource() Sachin Kamat
2013-01-31  7:28 ` Thierry Reding
2013-01-31  8:09   ` Sachin Kamat
2013-01-31  8:13     ` Thierry Reding
2013-01-31  7:30 ` Greg Kroah-Hartman
2013-01-31  8:12 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox