public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>, <gregor.boirie@parrot.com>
Subject: Re: [PATCH] iio: pressure: zpa2326: fix iio_triggered_buffer_postenable position
Date: Tue, 22 Oct 2019 12:54:51 +0100	[thread overview]
Message-ID: <20191022125451.79feacdd@archlinux> (raw)
In-Reply-To: <20191005161420.34c17eea@archlinux>

On Sat, 5 Oct 2019 16:14:20 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Fri, 20 Sep 2019 11:03:48 +0300
> Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> 
> > The iio_triggered_buffer_{predisable,postenable} functions attach/detach
> > the poll functions.
> > 
> > The iio_triggered_buffer_postenable() should be called before (to attach
> > the poll func) and then the
> > 
> > The iio_triggered_buffer_predisable() function is hooked directly without
> > anything, which is probably fine, as the postenable() version seems to also
> > do some reset/wake-up of the device.
> > This will mean it will be easier when removing it; i.e. it just gets
> > removed.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>  
> Seems straight forward but I've often been wrong before.
> Not heard from Gregor for a while, but we should give him a little more
> time to spot this one.  If nothing for another week I'll just take a
> gamble and apply it.  If I seem to have forgotten any of these give
> me a bump.
Long enough. Time to gamble :) 

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/pressure/zpa2326.c | 16 +++++++++-------
> >  1 file changed, 9 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
> > index 9d0d07930236..99dfe33ee402 100644
> > --- a/drivers/iio/pressure/zpa2326.c
> > +++ b/drivers/iio/pressure/zpa2326.c
> > @@ -1243,6 +1243,11 @@ static int zpa2326_postenable_buffer(struct iio_dev *indio_dev)
> >  	const struct zpa2326_private *priv = iio_priv(indio_dev);
> >  	int                           err;
> >  
> > +	/* Plug our own trigger event handler. */
> > +	err = iio_triggered_buffer_postenable(indio_dev);
> > +	if (err)
> > +		goto err;
> > +
> >  	if (!priv->waken) {
> >  		/*
> >  		 * We were already power supplied. Just clear hardware FIFO to
> > @@ -1250,7 +1255,7 @@ static int zpa2326_postenable_buffer(struct iio_dev *indio_dev)
> >  		 */
> >  		err = zpa2326_clear_fifo(indio_dev, 0);
> >  		if (err)
> > -			goto err;
> > +			goto err_buffer_predisable;
> >  	}
> >  
> >  	if (!iio_trigger_using_own(indio_dev) && priv->waken) {
> > @@ -1260,16 +1265,13 @@ static int zpa2326_postenable_buffer(struct iio_dev *indio_dev)
> >  		 */
> >  		err = zpa2326_config_oneshot(indio_dev, priv->irq);
> >  		if (err)
> > -			goto err;
> > +			goto err_buffer_predisable;
> >  	}
> >  
> > -	/* Plug our own trigger event handler. */
> > -	err = iio_triggered_buffer_postenable(indio_dev);
> > -	if (err)
> > -		goto err;
> > -
> >  	return 0;
> >  
> > +err_buffer_predisable:
> > +	iio_triggered_buffer_predisable(indio_dev);
> >  err:
> >  	zpa2326_err(indio_dev, "failed to enable buffering (%d)", err);
> >    
> 


      reply	other threads:[~2019-10-22 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20  8:03 [PATCH] iio: pressure: zpa2326: fix iio_triggered_buffer_postenable position Alexandru Ardelean
2019-10-05 15:14 ` Jonathan Cameron
2019-10-22 11:54   ` Jonathan Cameron [this message]

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=20191022125451.79feacdd@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=gregor.boirie@parrot.com \
    --cc=linux-iio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox