kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: lroluk@gmail.com (Luca Ellero)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Best practice to lock a read/write to a HW register
Date: Thu, 14 Nov 2013 11:32:14 +0100	[thread overview]
Message-ID: <5284A6AE.90901@gmail.com> (raw)

Hi all,
can someone please show me which is the best practice to lock a
read/write to a hardware register.
In other words if, in a driver, I want to modify a bit in a HW register,
I have to read the register, set/reset the relevant bit and write back
the reg.
But what can I do to be sure that no other code modifies the register
between my read and write?
Is spin_lock() suitable for this purpose?
Thanks
Best regards
Luca

             reply	other threads:[~2013-11-14 10:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 10:32 Luca Ellero [this message]
2013-11-14 11:20 ` Best practice to lock a read/write to a HW register Mandeep Sandhu
2013-11-14 11:51 ` binoy.jayan at wipro.com
2013-11-14 12:14 ` Bernd Petrovitsch
2013-11-15  1:30   ` manty kuma
2013-11-15  8:53     ` Luca Ellero

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=5284A6AE.90901@gmail.com \
    --to=lroluk@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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).