[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0ff5f7ede826feb6185260a9d2c87fb89e799166.camel@analog.com>
Date: Mon, 16 Dec 2019 07:50:32 +0000
From: "Ardelean, Alexandru" <alexandru.Ardelean@...log.com>
To: "sashal@...nel.org" <sashal@...nel.org>,
"jic23@...23.retrosnub.co.uk" <jic23@...23.retrosnub.co.uk>
CC: "stable@...r.kernel.org" <stable@...r.kernel.org>,
"Jonathan.Cameron@...wei.com" <Jonathan.Cameron@...wei.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>
Subject: Re: [PATCH AUTOSEL 5.4 137/350] iio: pressure: zpa2326: fix
iio_triggered_buffer_postenable position
On Sun, 2019-12-15 at 15:57 +0000, Jonathan Cameron wrote:
> [External]
>
> On Tue, 10 Dec 2019 16:04:02 -0500
> Sasha Levin <sashal@...nel.org> wrote:
>
> > From: Alexandru Ardelean <alexandru.ardelean@...log.com>
> >
> > [ Upstream commit fe2392c67db9730d46f11fc4fadfa7bffa8843fa ]
> >
> > 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.
>
> Ah. I should have added a note to this one as well. This is more general
> rework, that is a fix in the sense of bringing things towards a standard
> way of doing things rather than 'fixing' a known bug.
>
> Alex, for any more of these, lets not have fix in the title (though they
> sort of do 'fix' things).
>
Ack.
I don't think there are many drivers left though.
But will keep this in mind.
Thanks
Alex
> Thanks,
>
> Jonathan
>
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> > Signed-off-by: Sasha Levin <sashal@...nel.org>
> > ---
> > 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 9d0d07930236e..99dfe33ee402f 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);
> >
Powered by blists - more mailing lists