All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: "Opensource [Anthony Olech]" <anthony.olech.opensource@diasemi.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [NEW DRIVER V1 5/7] DA9058 GPIO driver
Date: Tue, 7 Aug 2012 18:14:38 +0100	[thread overview]
Message-ID: <20120807171437.GC16861@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <24DF37198A1E704D9811D8F72B87EB51032C39DE@NB-EX-MBX02.diasemi.com>

On Mon, Aug 06, 2012 at 03:15:17PM +0000, Opensource [Anthony Olech] wrote:

> I do realize that REGMAP does locking on individual register accesses,
> however, the each GPIO line is controlled by 4-bits in a register, with
> the meaning of the most significant bit depending on the GPIO direction,
> so it is essential that the register be read first before do an update, thus
> two sequential register accesses must be protected by a mutex to
> prevent another process changing the register (and hence the meaning
> of the most-significant bit) in the middle of the two accesses.

> I hope this explains to your satisfaction why a driver mutex is required
> in addition to the regmap's register access mutex

This seems a bit excessive and complicated - I'd be inclined to either
just say that the caller is responsible for avoiding confusion here
(obviously if you're changing the direction there's a race anyway) or
store the data in a variable locally rather than having to do I/O on the
device under lock every time it's interacted with.

  reply	other threads:[~2012-08-07 17:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02  8:48 [NEW DRIVER V1 5/7] DA9058 GPIO driver Anthony Olech
2012-08-02 10:19 ` Mark Brown
2012-08-06 15:15   ` Opensource [Anthony Olech]
2012-08-07 17:14     ` Mark Brown [this message]
2012-08-08  7:52       ` Opensource [Anthony Olech]

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=20120807171437.GC16861@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=anthony.olech.opensource@diasemi.com \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.