Re: question on memory barrier

From: moreau francis
Date: Wed Aug 24 2005 - 12:32:06 EST



--- "linux-os (Dick Johnson)" <linux-os@xxxxxxxxxxxx> a écrit :

>
> On Wed, 24 Aug 2005, moreau francis wrote:
>
> > Hi,
> >
> > I'm currently trying to write a USB driver for Linux. The device must be
> > configured by writing some values into the same register but I want to be
> > sure that the writing order is respected by either the compiler and the
> cpu.
> >
> > For example, here is a bit of driver's code:
> >
> > """
> > #include <asm/io.h>
> >
> > static inline void dev_out(u32 *reg, u32 value)
> > {
> > writel(value, regs);
> > }
> >
> > void config_dev(void)
> > {
> > dev_out(reg_a, 0x0); /* first io */
> > dev_out(reg_a, 0xA); /* second io */
> > }
> >
>
> This should be fine. The effect of the first bit of code
> plus all side-effects (if any) should be complete at the
> first effective sequence-point (;) but you need to

sorry but I'm not sure to understand you...Do you mean that the first write
into reg_a pointer will be completed before the second write because they're
separated by a (;) ?
Or because writes are encapsulated inside an inline function, therefore
compiler
must execute every single writes before returning from the inline function ?

Thanks.

Francis






___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/