On Sat, 5 Oct 2019 16:14:20 +0100 Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > On Fri, 20 Sep 2019 11:03:48 +0300 > Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx> 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@xxxxxxxxxx> > 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); > > >