linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: linuxppc-embedded@ozlabs.org
Subject: Is in_le32 and out_le32 atomic?
Date: Fri, 08 Dec 2006 21:05:26 +0100	[thread overview]
Message-ID: <4579C586.5040809@grandegger.com> (raw)

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.

             reply	other threads:[~2006-12-08 20:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08 20:05 Wolfgang Grandegger [this message]
2006-12-08 20:15 ` Is in_le32 and out_le32 atomic? Arnd Bergmann
2006-12-11  6:48   ` Benjamin Herrenschmidt
2006-12-11  8:11     ` Wolfgang Grandegger
2006-12-11  9:05       ` Benjamin Herrenschmidt
2006-12-11  6:47 ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4579C586.5040809@grandegger.com \
    --to=wg@grandegger.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).