public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: fix readsl/writesl argument
@ 2008-02-20 10:28 Magnus Damm
  2008-02-20 12:15 ` Stuart MENEFY
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Magnus Damm @ 2008-02-20 10:28 UTC (permalink / raw)
  To: linux-sh

writesl() and readsl() use void __iomem * as argument but the current sh 
version of __raw_writesl()/__rawreadsl() takes unsigned long. Casting the
pointer fixes smc91x warnings.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 include/asm-sh/io.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- 0001/include/asm-sh/io.h
+++ work/include/asm-sh/io.h	2008-02-20 16:34:28.000000000 +0900
@@ -162,8 +162,8 @@ static inline void reads##bwlq(volatile 
 
 __BUILD_MEMORY_STRING(b, u8)
 __BUILD_MEMORY_STRING(w, u16)
-#define writesl __raw_writesl
-#define readsl  __raw_readsl
+#define writesl(m, a, c) __raw_writesl((unsigned long)(m), (a), (c))
+#define readsl(m, a, c)  __raw_readsl((unsigned long)(m), (a), (c))
 
 #define readb_relaxed(a) readb(a)
 #define readw_relaxed(a) readw(a)

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

* Re: [PATCH] sh: fix readsl/writesl argument
  2008-02-20 10:28 [PATCH] sh: fix readsl/writesl argument Magnus Damm
@ 2008-02-20 12:15 ` Stuart MENEFY
  2008-02-21  2:57 ` Magnus Damm
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stuart MENEFY @ 2008-02-20 12:15 UTC (permalink / raw)
  To: linux-sh

Magnus

Magnus Damm wrote:
> writesl() and readsl() use void __iomem * as argument but the current sh 
> version of __raw_writesl()/__rawreadsl() takes unsigned long. Casting the
> pointer fixes smc91x warnings.
...
> --- 0001/include/asm-sh/io.h
> +++ work/include/asm-sh/io.h	2008-02-20 16:34:28.000000000 +0900
> -#define writesl __raw_writesl
> -#define readsl  __raw_readsl
> +#define writesl(m, a, c) __raw_writesl((unsigned long)(m), (a), (c))
> +#define readsl(m, a, c)  __raw_readsl((unsigned long)(m), (a), (c))

Wouldn't it be better to do this as inline functions, that way we don't
loose the type checking?

Stuart

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

* Re: [PATCH] sh: fix readsl/writesl argument
  2008-02-20 10:28 [PATCH] sh: fix readsl/writesl argument Magnus Damm
  2008-02-20 12:15 ` Stuart MENEFY
@ 2008-02-21  2:57 ` Magnus Damm
  2008-02-26  5:23 ` Paul Mundt
  2008-02-26  6:39 ` Magnus Damm
  3 siblings, 0 replies; 5+ messages in thread
From: Magnus Damm @ 2008-02-21  2:57 UTC (permalink / raw)
  To: linux-sh

Hi Stuart,

On Wed, Feb 20, 2008 at 9:15 PM, Stuart MENEFY <stuart.menefy@st.com> wrote:
>  Magnus Damm wrote:
>  > writesl() and readsl() use void __iomem * as argument but the current sh
>  > version of __raw_writesl()/__rawreadsl() takes unsigned long. Casting the
>  > pointer fixes smc91x warnings.
>  ...
>
> > --- 0001/include/asm-sh/io.h
>  > +++ work/include/asm-sh/io.h  2008-02-20 16:34:28.000000000 +0900
>
> > -#define writesl __raw_writesl
>  > -#define readsl  __raw_readsl
>  > +#define writesl(m, a, c) __raw_writesl((unsigned long)(m), (a), (c))
>  > +#define readsl(m, a, c)  __raw_readsl((unsigned long)(m), (a), (c))
>
>  Wouldn't it be better to do this as inline functions, that way we don't
>  loose the type checking?

Yes, I think so too. But step by step. =) I'm planning on replacing a
lot of code in io.h actually, and I'll use inlines and avoid casting
to get proper type checking then. Thanks!

/ magnus

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

* Re: [PATCH] sh: fix readsl/writesl argument
  2008-02-20 10:28 [PATCH] sh: fix readsl/writesl argument Magnus Damm
  2008-02-20 12:15 ` Stuart MENEFY
  2008-02-21  2:57 ` Magnus Damm
@ 2008-02-26  5:23 ` Paul Mundt
  2008-02-26  6:39 ` Magnus Damm
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2008-02-26  5:23 UTC (permalink / raw)
  To: linux-sh

On Thu, Feb 21, 2008 at 11:57:12AM +0900, Magnus Damm wrote:
> Hi Stuart,
> 
> On Wed, Feb 20, 2008 at 9:15 PM, Stuart MENEFY <stuart.menefy@st.com> wrote:
> >  Magnus Damm wrote:
> >  > writesl() and readsl() use void __iomem * as argument but the current sh
> >  > version of __raw_writesl()/__rawreadsl() takes unsigned long. Casting the
> >  > pointer fixes smc91x warnings.
> >  ...
> >
> > > --- 0001/include/asm-sh/io.h
> >  > +++ work/include/asm-sh/io.h  2008-02-20 16:34:28.000000000 +0900
> >
> > > -#define writesl __raw_writesl
> >  > -#define readsl  __raw_readsl
> >  > +#define writesl(m, a, c) __raw_writesl((unsigned long)(m), (a), (c))
> >  > +#define readsl(m, a, c)  __raw_readsl((unsigned long)(m), (a), (c))
> >
> >  Wouldn't it be better to do this as inline functions, that way we don't
> >  loose the type checking?
> 
> Yes, I think so too. But step by step. =) I'm planning on replacing a
> lot of code in io.h actually, and I'll use inlines and avoid casting
> to get proper type checking then. Thanks!
> 
There's not a lot of point in merging this for 2.6.25, so lets just drop
this and focus on the proper cleanup for the 2.6.26 window instead.

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

* Re: [PATCH] sh: fix readsl/writesl argument
  2008-02-20 10:28 [PATCH] sh: fix readsl/writesl argument Magnus Damm
                   ` (2 preceding siblings ...)
  2008-02-26  5:23 ` Paul Mundt
@ 2008-02-26  6:39 ` Magnus Damm
  3 siblings, 0 replies; 5+ messages in thread
From: Magnus Damm @ 2008-02-26  6:39 UTC (permalink / raw)
  To: linux-sh

On Tue, Feb 26, 2008 at 2:23 PM, Paul Mundt <lethal@linux-sh.org> wrote:
> On Thu, Feb 21, 2008 at 11:57:12AM +0900, Magnus Damm wrote:
>  > On Wed, Feb 20, 2008 at 9:15 PM, Stuart MENEFY <stuart.menefy@st.com> wrote:
>  > >  Magnus Damm wrote:
>  > >  > writesl() and readsl() use void __iomem * as argument but the current sh
>  > >  > version of __raw_writesl()/__rawreadsl() takes unsigned long. Casting the
>  > >  > pointer fixes smc91x warnings.
>  > >  ...
>  > >
>  > > > --- 0001/include/asm-sh/io.h
>  > >  > +++ work/include/asm-sh/io.h  2008-02-20 16:34:28.000000000 +0900
>  > >
>  > > > -#define writesl __raw_writesl
>  > >  > -#define readsl  __raw_readsl
>  > >  > +#define writesl(m, a, c) __raw_writesl((unsigned long)(m), (a), (c))
>  > >  > +#define readsl(m, a, c)  __raw_readsl((unsigned long)(m), (a), (c))
>  > >
>  > >  Wouldn't it be better to do this as inline functions, that way we don't
>  > >  loose the type checking?
>  >
>  > Yes, I think so too. But step by step. =) I'm planning on replacing a
>  > lot of code in io.h actually, and I'll use inlines and avoid casting
>  > to get proper type checking then. Thanks!
>  >
>  There's not a lot of point in merging this for 2.6.25, so lets just drop
>  this and focus on the proper cleanup for the 2.6.26 window instead.

Sure, merging this for 2.6.25 doesn't make any sense.

I do however wonder what a proper cleanup would look like...

I heard something about starting to use __raw_readN/writeN() instead
of ctrl_inN/outN() for on-chip access, and with proper type checking
we should use unsigned longs to specify address for
__raw_readN/writeN().  But we can't do that since  __raw_writeN() in
lib/iomap.c takes void __iomem * instead of unsigned long.

Arm solves this by using macros and casting, but then we loose the
type checking. What about using __readN/writeN() for on-chip access?
Or maybe just keep ctrl_inN/outN() and focus on fixing up the rest.

/ magnus

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

end of thread, other threads:[~2008-02-26  6:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-20 10:28 [PATCH] sh: fix readsl/writesl argument Magnus Damm
2008-02-20 12:15 ` Stuart MENEFY
2008-02-21  2:57 ` Magnus Damm
2008-02-26  5:23 ` Paul Mundt
2008-02-26  6:39 ` Magnus Damm

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