linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Justin Chen <justinpopo6@gmail.com>
Cc: David Lechner <david@lechnology.com>,
	linux-iio@vger.kernel.org, linux-gpio@vger.kernel.org,
	bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	bgolaszewski@baylibre.com,
	Linus Walleij <linus.walleij@linaro.org>,
	knaack.h@gmx.de, lars@metafoo.de,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: ti-ads7950: add GPIO support
Date: Tue, 12 Feb 2019 20:35:43 +0000	[thread overview]
Message-ID: <20190212203544.181b8c19@archlinux> (raw)
In-Reply-To: <CAJx26kXdap3oSBREDfakwaWMz4oKxy=oaagP1jo4grD=kqJ2hA@mail.gmail.com>

On Mon, 11 Feb 2019 12:17:37 -0800
Justin Chen <justinpopo6@gmail.com> wrote:

> On Mon, Feb 11, 2019 at 12:06 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Sat, 9 Feb 2019 12:56:11 -0600
> > David Lechner <david@lechnology.com> wrote:
> >  
> > > On 2/9/19 11:00 AM, Jonathan Cameron wrote:  
> > > > Nope.  This is a state lock used to protect against transitions between
> > > > different modes of the IIO device (buffered vs polled), it
> > > > isn't suitable for general use.
> > > >
> > > > The driver should be modified to handle that correctly.
> > > > We have iio_claim_direct_mode etc that deal with the case
> > > > where a device can't do certain operations whilst in buffered
> > > > mode.  Note it can fail and should.
> > > >
> > > > Seems there are more drivers still doing this than I thought.
> > > > If anyone is bored and wants to clean them out, that would be
> > > > most appreciated!
> > > >
> > > > If you need locking to protect a local buffer or the device
> > > > state, define a new lock to do it with clearly documented
> > > > scope.  
> > >
> > > Just as a reminder, there is a use case for this particular
> > > chip that requires buffered mode and direct mode at the same
> > > time.
> > >
> > > https://patchwork.kernel.org/patch/10539021/
> > > https://patchwork.kernel.org/patch/10527757/  
> >
> > Thanks, I had indeed forgotten that entirely.
> > So it should have a local lock and not take mlock explicitly at all.
> >  
> Thanks for all the feedback.
> So If I am understanding this correctly. I should create a local lock
> to synchronize three different type of transactions (buffered, direct,
> gpio).
> I do not want to use iio_claim_direct_mode because that doesn't allow
> simultaneous use of buffered mode and direct mode, which is necessary
> for this driver because of the above mentioned patch.
No, you should create a local lock to do just one thing. Protect
the buffers used in those transactions.  There is no need
to protect anything else explicitly.

On some devices there are multiple transaction writes, but I don't recall
that being the case here.

Jonathan

> 
> Justin
> > Jonathan  

  reply	other threads:[~2019-02-12 20:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 19:24 [PATCH] iio: adc: ti-ads7950: add GPIO support justinpopo6
2019-02-09 17:00 ` Jonathan Cameron
2019-02-09 18:56   ` David Lechner
2019-02-11 20:05     ` Jonathan Cameron
2019-02-11 20:17       ` Justin Chen
2019-02-12 20:35         ` Jonathan Cameron [this message]
2019-02-11  8:34 ` Linus Walleij

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=20190212203544.181b8c19@archlinux \
    --to=jic23@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=david@lechnology.com \
    --cc=f.fainelli@gmail.com \
    --cc=justinpopo6@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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).