linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio-pch: cleanup __iomem annotation usage
@ 2012-01-15 10:32 Németh Márton
  2012-01-17  8:14 ` Linus Walleij
  0 siblings, 1 reply; 9+ messages in thread
From: Németh Márton @ 2012-01-15 10:32 UTC (permalink / raw)
  To: Grant Likely, Linus Walleij; +Cc: LKML

From: Márton Németh <nm127@freemail.hu>

The __iomem annotation is to be used together with pointers used
as iowrite32() parameter. For more details see [1] and [2].

This patch will remove the following sparse warnings ("make C=1"):
 * warning: incorrect type in assignment (different address spaces)
 * warning: incorrect type in argument 1 (different address spaces)
 * warning: incorrect type in argument 2 (different address spaces)

References:
[1] A new I/O memory access mechanism (Sep 15, 2004)
    http://lwn.net/Articles/102232/

[2] Being more anal about iospace accesses (Sep 15, 2004)
    http://lwn.net/Articles/102240/

Signed-off-by: Márton Németh <nm127@freemail.hu>
---
 drivers/gpio/gpio-pch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
index f060329..9061b55 100644
--- a/drivers/gpio/gpio-pch.c
+++ b/drivers/gpio/gpio-pch.c
@@ -231,7 +231,7 @@ static void pch_gpio_setup(struct pch_gpio *chip)
 static int pch_irq_type(struct irq_data *d, unsigned int type)
 {
 	u32 im;
-	u32 *im_reg;
+	u32 __iomem *im_reg;
 	u32 ien;
 	u32 im_pos;
 	int ch;
-- 
1.7.2.5


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

* Re: [PATCH 1/2] gpio-pch: cleanup __iomem annotation usage
  2012-01-15 10:32 [PATCH 1/2] gpio-pch: cleanup __iomem annotation usage Németh Márton
@ 2012-01-17  8:14 ` Linus Walleij
  2012-01-17  8:32   ` Németh Márton
  0 siblings, 1 reply; 9+ messages in thread
From: Linus Walleij @ 2012-01-17  8:14 UTC (permalink / raw)
  To: Németh Márton; +Cc: Grant Likely, Linus Walleij, LKML

2012/1/15 Németh Márton <nm127@freemail.hu>:

> From: Márton Németh <nm127@freemail.hu>
>
> The __iomem annotation is to be used together with pointers used
> as iowrite32() parameter. For more details see [1] and [2].
(...)
> -       u32 *im_reg;
> +       u32 __iomem *im_reg;

Does it work to just say void __iomem *im_reg?

We usually don't type addresses.

Yours,
Linus Walleij

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

* Re: [PATCH 1/2] gpio-pch: cleanup __iomem annotation usage
  2012-01-17  8:14 ` Linus Walleij
@ 2012-01-17  8:32   ` Németh Márton
  2012-01-17  9:01     ` Linus Walleij
  0 siblings, 1 reply; 9+ messages in thread
From: Németh Márton @ 2012-01-17  8:32 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Grant Likely, Linus Walleij, LKML

Hi Linux,

Linus Walleij wrote:
> 2012/1/15 Németh Márton <nm127@freemail.hu>:
> 
>> From: Márton Németh <nm127@freemail.hu>
>>
>> The __iomem annotation is to be used together with pointers used
>> as iowrite32() parameter. For more details see [1] and [2].
> (...)
>> -       u32 *im_reg;
>> +       u32 __iomem *im_reg;
> 
> Does it work to just say void __iomem *im_reg?
> 
> We usually don't type addresses.

You are right, the correct one should be "void __iomem *im_reg;" .

Should I resend a patch for this?

	Márton Németh


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

* Re: [PATCH 1/2] gpio-pch: cleanup __iomem annotation usage
  2012-01-17  8:32   ` Németh Márton
@ 2012-01-17  9:01     ` Linus Walleij
  2012-01-17 20:43       ` [PATCH 1/2 v2] " Németh Márton
  2012-01-17 22:49       ` [PATCH 1/2] " Grant Likely
  0 siblings, 2 replies; 9+ messages in thread
From: Linus Walleij @ 2012-01-17  9:01 UTC (permalink / raw)
  To: Németh Márton; +Cc: Grant Likely, Linus Walleij, LKML

2012/1/17 Németh Márton <nm127@freemail.hu>:

> Hi Linux,

:-)

Common mistake, as are our brother Kubys who also
appear on the lists sometimes...

> You are right, the correct one should be "void __iomem *im_reg;" .
>
> Should I resend a patch for this?

Yep just send it with subject [PATCH 1/2 v2] atleast
that's what I usually do.

Yours,
Linus Walleij

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

* [PATCH 1/2 v2] gpio-pch: cleanup __iomem annotation usage
  2012-01-17  9:01     ` Linus Walleij
@ 2012-01-17 20:43       ` Németh Márton
  2012-01-17 22:49       ` [PATCH 1/2] " Grant Likely
  1 sibling, 0 replies; 9+ messages in thread
From: Németh Márton @ 2012-01-17 20:43 UTC (permalink / raw)
  To: Linus Walleij, Grant Likely; +Cc: Linus Walleij, LKML

From: Márton Németh <nm127@freemail.hu>

The __iomem annotation is to be used together with pointers used
as iowrite32() parameter. For more details see [1] and [2].

This patch will remove the following sparse warnings ("make C=1"):
 * warning: incorrect type in assignment (different address spaces)
 * warning: incorrect type in argument 1 (different address spaces)
 * warning: incorrect type in argument 2 (different address spaces)

References:
[1] A new I/O memory access mechanism (Sep 15, 2004)
    http://lwn.net/Articles/102232/

[2] Being more anal about iospace accesses (Sep 15, 2004)
    http://lwn.net/Articles/102240/

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-pch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
index f060329..8f101b3 100644
--- a/drivers/gpio/gpio-pch.c
+++ b/drivers/gpio/gpio-pch.c
@@ -231,7 +231,7 @@ static void pch_gpio_setup(struct pch_gpio *chip)
 static int pch_irq_type(struct irq_data *d, unsigned int type)
 {
 	u32 im;
-	u32 *im_reg;
+	void __iomem *im_reg;
 	u32 ien;
 	u32 im_pos;
 	int ch;
-- 
1.7.2.5

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

* Re: [PATCH 1/2] gpio-pch: cleanup __iomem annotation usage
  2012-01-17  9:01     ` Linus Walleij
  2012-01-17 20:43       ` [PATCH 1/2 v2] " Németh Márton
@ 2012-01-17 22:49       ` Grant Likely
  2012-01-18  6:05         ` PATCH] use void __iomem * pointers for ioread32()/iowrite32() Németh Márton
  1 sibling, 1 reply; 9+ messages in thread
From: Grant Likely @ 2012-01-17 22:49 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Németh Márton, Linus Walleij, LKML

2012/1/17 Linus Walleij <linus.walleij@linaro.org>:
> 2012/1/17 Németh Márton <nm127@freemail.hu>:
>
>> Hi Linux,
>
> :-)
>
> Common mistake, as are our brother Kubys who also
> appear on the lists sometimes...
>
>> You are right, the correct one should be "void __iomem *im_reg;" .
>>
>> Should I resend a patch for this?
>
> Yep just send it with subject [PATCH 1/2 v2] atleast
> that's what I usually do.

Actually, I've already applied it.  Send a follow-on patch.  It is
logically a separate change anyway since the existing code already
uses u32.

g.

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

* PATCH] use void __iomem * pointers for ioread32()/iowrite32()
  2012-01-17 22:49       ` [PATCH 1/2] " Grant Likely
@ 2012-01-18  6:05         ` Németh Márton
  2012-01-18  6:18           ` Al Viro
  0 siblings, 1 reply; 9+ messages in thread
From: Németh Márton @ 2012-01-18  6:05 UTC (permalink / raw)
  To: Grant Likely, Linus Walleij; +Cc: Linus Walleij, LKML

From: Márton Németh <nm127@freemail.hu>

The address pointer of ioread32()/iowrite32() functions are
of type "void __iomem *". Use matching variable type.

For details on __iomem see [1] and [2].

References:
[1] A new I/O memory access mechanism (Sep 15, 2004)
    http://lwn.net/Articles/102232/

[2] Being more anal about iospace accesses (Sep 15, 2004)
    http://lwn.net/Articles/102240/

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-pch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
index 68fa55e..84b7f28 100644
--- a/drivers/gpio/gpio-pch.c
+++ b/drivers/gpio/gpio-pch.c
@@ -231,7 +231,7 @@ static void pch_gpio_setup(struct pch_gpio *chip)
 static int pch_irq_type(struct irq_data *d, unsigned int type)
 {
 	u32 im;
-	u32 __iomem *im_reg;
+	void __iomem *im_reg;
 	u32 ien;
 	u32 im_pos;
 	int ch;
-- 
1.7.2.5



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

* Re: PATCH] use void __iomem * pointers for ioread32()/iowrite32()
  2012-01-18  6:05         ` PATCH] use void __iomem * pointers for ioread32()/iowrite32() Németh Márton
@ 2012-01-18  6:18           ` Al Viro
  2012-01-18 21:07             ` Grant Likely
  0 siblings, 1 reply; 9+ messages in thread
From: Al Viro @ 2012-01-18  6:18 UTC (permalink / raw)
  To: N?meth M?rton; +Cc: Grant Likely, Linus Walleij, Linus Walleij, LKML

On Wed, Jan 18, 2012 at 07:05:18AM +0100, N?meth M?rton wrote:
> From: M?rton N?meth <nm127@freemail.hu>
> 
> The address pointer of ioread32()/iowrite32() functions are
> of type "void __iomem *". Use matching variable type.

> diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
> index 68fa55e..84b7f28 100644
> --- a/drivers/gpio/gpio-pch.c
> +++ b/drivers/gpio/gpio-pch.c
> @@ -231,7 +231,7 @@ static void pch_gpio_setup(struct pch_gpio *chip)
>  static int pch_irq_type(struct irq_data *d, unsigned int type)
>  {
>  	u32 im;
> -	u32 __iomem *im_reg;
> +	void __iomem *im_reg;

NAK.  Please, learn what "function with pointer to (possibly qualified) void"
means.  It's fairly basic C, so any (post-K&R) textbook would do.

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

* Re: PATCH] use void __iomem * pointers for ioread32()/iowrite32()
  2012-01-18  6:18           ` Al Viro
@ 2012-01-18 21:07             ` Grant Likely
  0 siblings, 0 replies; 9+ messages in thread
From: Grant Likely @ 2012-01-18 21:07 UTC (permalink / raw)
  To: Al Viro; +Cc: N?meth M?rton, Linus Walleij, Linus Walleij, LKML

On Wed, Jan 18, 2012 at 06:18:15AM +0000, Al Viro wrote:
> On Wed, Jan 18, 2012 at 07:05:18AM +0100, N?meth M?rton wrote:
> > From: M?rton N?meth <nm127@freemail.hu>
> > 
> > The address pointer of ioread32()/iowrite32() functions are
> > of type "void __iomem *". Use matching variable type.
> 
> > diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
> > index 68fa55e..84b7f28 100644
> > --- a/drivers/gpio/gpio-pch.c
> > +++ b/drivers/gpio/gpio-pch.c
> > @@ -231,7 +231,7 @@ static void pch_gpio_setup(struct pch_gpio *chip)
> >  static int pch_irq_type(struct irq_data *d, unsigned int type)
> >  {
> >  	u32 im;
> > -	u32 __iomem *im_reg;
> > +	void __iomem *im_reg;
> 
> NAK.  Please, learn what "function with pointer to (possibly qualified) void"
> means.  It's fairly basic C, so any (post-K&R) textbook would do.

Okay, ignoring.

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

end of thread, other threads:[~2012-01-18 21:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-15 10:32 [PATCH 1/2] gpio-pch: cleanup __iomem annotation usage Németh Márton
2012-01-17  8:14 ` Linus Walleij
2012-01-17  8:32   ` Németh Márton
2012-01-17  9:01     ` Linus Walleij
2012-01-17 20:43       ` [PATCH 1/2 v2] " Németh Márton
2012-01-17 22:49       ` [PATCH 1/2] " Grant Likely
2012-01-18  6:05         ` PATCH] use void __iomem * pointers for ioread32()/iowrite32() Németh Márton
2012-01-18  6:18           ` Al Viro
2012-01-18 21:07             ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).