linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Question: locomo_{read/write}l macros
@ 2010-01-20 21:33 H Hartley Sweeten
  2010-01-21  2:06 ` Eric Miao
       [not found] ` <4B581CD2.9010007@ru.mvista.com>
  0 siblings, 2 replies; 3+ messages in thread
From: H Hartley Sweeten @ 2010-01-20 21:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hello all,

Is there a reason why the locomo stuff is using custom
macros for {read/write}l access?

In arch/arm/include/asm/hardware/locomo.h:

#define locomo_writel(val,addr)	({ *(volatile u16 *)(addr) = (val); })
#define locomo_readl(addr)	(*(volatile u16 *)(addr))

It appears that these are just non-typesafe versions of the
__raw_{read/write}w macros in arch/arm/include/asm/io.h:

#define __raw_writew(v,a)	(__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v))
#define __raw_readw(a)		(__chk_io_ptr(a), *(volatile unsigned short __force *)(a))

Is there any reason not to change them all (other than
having to then fix all the callers to be typesafe)?

It appears the only users are in:

arch/arm/common/locomo.c
arch/arm/include/asm/hardware/locomo.h
drivers/input/keyboard/locomokbd.c
drivers/leds/leds-locomo.c
drivers/video/backlight/locomolcd.c

Thanks,
Hartley

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

* Question: locomo_{read/write}l macros
  2010-01-20 21:33 Question: locomo_{read/write}l macros H Hartley Sweeten
@ 2010-01-21  2:06 ` Eric Miao
       [not found] ` <4B581CD2.9010007@ru.mvista.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Miao @ 2010-01-21  2:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 21, 2010 at 5:33 AM, H Hartley Sweeten
<hartleys@visionengravers.com> wrote:
> Hello all,
>
> Is there a reason why the locomo stuff is using custom
> macros for {read/write}l access?
>

No.

> In arch/arm/include/asm/hardware/locomo.h:
>
> #define locomo_writel(val,addr) ({ *(volatile u16 *)(addr) = (val); })
> #define locomo_readl(addr) ? ? ?(*(volatile u16 *)(addr))
>
> It appears that these are just non-typesafe versions of the
> __raw_{read/write}w macros in arch/arm/include/asm/io.h:
>
> #define __raw_writew(v,a) ? ? ? (__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v))
> #define __raw_readw(a) ? ? ? ? ?(__chk_io_ptr(a), *(volatile unsigned short __force *)(a))
>
> Is there any reason not to change them all (other than
> having to then fix all the callers to be typesafe)?
>
> It appears the only users are in:
>
> arch/arm/common/locomo.c
> arch/arm/include/asm/hardware/locomo.h
> drivers/input/keyboard/locomokbd.c
> drivers/leds/leds-locomo.c
> drivers/video/backlight/locomolcd.c
>

They are "many" users instead of "only" I'm afraid. Thomas Cc'ed
may have some additional out-of-tree drivers, but yeah, I'd agree
that we fixed these in-tree driver first.

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

* Question: locomo_{read/write}l macros
       [not found] ` <4B581CD2.9010007@ru.mvista.com>
@ 2010-01-21 16:52   ` H Hartley Sweeten
  0 siblings, 0 replies; 3+ messages in thread
From: H Hartley Sweeten @ 2010-01-21 16:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, January 21, 2010 2:22 AM, Sergei Shtylyov wrote:
> Hello.
> 
> H Hartley Sweeten wrote:
> 
>> Hello all,
>>
>> Is there a reason why the locomo stuff is using custom
>> macros for {read/write}l access?
>>
>> In arch/arm/include/asm/hardware/locomo.h:
>>
>> #define locomo_writel(val,addr)	({ *(volatile u16 *)(addr) = (val); })
>> #define locomo_readl(addr)	(*(volatile u16 *)(addr))
>>
>> It appears that these are just non-typesafe versions of the
>> __raw_{read/write}w macros in arch/arm/include/asm/io.h:
>>   
>
>   You mean __raw_{read/write}l for sure?

No.

The locomo_* macros are both using u16 *.  The equivalent __raw_*
macros would be the unsigned short * type which is __raw_{read/write}w.

Plus, all the masking used with locomo_{read/write}l uses 16-bit
values.  My guess is the names used for the locomo_* macros are
wrong.

Regards,
Hartley

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

end of thread, other threads:[~2010-01-21 16:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-20 21:33 Question: locomo_{read/write}l macros H Hartley Sweeten
2010-01-21  2:06 ` Eric Miao
     [not found] ` <4B581CD2.9010007@ru.mvista.com>
2010-01-21 16:52   ` H Hartley Sweeten

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