Is in_le32 and out_le32 atomic?

Wolfgang Grandegger wg at grandegger.com
Sat Dec 9 07:05:26 EST 2006


Hello,

I'm puzzled about the following read and write funtions in 
include/asm-ppc/mv64x60.h:


/* Define I/O routines for accessing registers on the 64x60 bridge. */
extern inline void
mv64x60_write(struct mv64x60_handle *bh, u32 offset, u32 val) {
         ulong   flags;

         spin_lock_irqsave(&mv64x60_lock, flags);
         out_le32(bh->v_base + offset, val);
         spin_unlock_irqrestore(&mv64x60_lock, flags);
}

extern inline u32
mv64x60_read(struct mv64x60_handle *bh, u32 offset) {
         ulong   flags;
         u32     reg;

         spin_lock_irqsave(&mv64x60_lock, flags);
         reg = in_le32(bh->v_base + offset);
         spin_unlock_irqrestore(&mv64x60_lock, flags);
         return reg;
}

Can anybody tell me why the spin_* protection is needed? I thought that 
32-bit read and write operations are atomic.

TIA.

Wolfgang.



More information about the Linuxppc-embedded mailing list