linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>
Subject: Re: [PATCH] iio: adxl372: fix iio_triggered_buffer_{pre,post}enable positions
Date: Sat, 8 Jun 2019 14:50:03 +0100	[thread overview]
Message-ID: <20190608145003.2c099d10@archlinux> (raw)
In-Reply-To: <20190529130108.30331-1-alexandru.ardelean@analog.com>

On Wed, 29 May 2019 16:01:08 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> The iio_triggered_buffer_{predisable,postenable} functions attach/detach
> the poll functions.
> 
> For the predisable hook, the disable code should occur before detaching
> the poll func, and for the postenable hook, the poll func should be
> attached before the enable code.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Looks good to me.

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

Thanks,

Jonathan

> ---
>  drivers/iio/accel/adxl372.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/iio/accel/adxl372.c b/drivers/iio/accel/adxl372.c
> index 3b84cb243a87..055227cb3d43 100644
> --- a/drivers/iio/accel/adxl372.c
> +++ b/drivers/iio/accel/adxl372.c
> @@ -782,10 +782,14 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
>  	unsigned int mask;
>  	int i, ret;
>  
> -	ret = adxl372_set_interrupts(st, ADXL372_INT1_MAP_FIFO_FULL_MSK, 0);
> +	ret = iio_triggered_buffer_postenable(indio_dev);
>  	if (ret < 0)
>  		return ret;
>  
> +	ret = adxl372_set_interrupts(st, ADXL372_INT1_MAP_FIFO_FULL_MSK, 0);
> +	if (ret < 0)
> +		goto err;
> +
>  	mask = *indio_dev->active_scan_mask;
>  
>  	for (i = 0; i < ARRAY_SIZE(adxl372_axis_lookup_table); i++) {
> @@ -793,8 +797,10 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
>  			break;
>  	}
>  
> -	if (i == ARRAY_SIZE(adxl372_axis_lookup_table))
> -		return -EINVAL;
> +	if (i == ARRAY_SIZE(adxl372_axis_lookup_table)) {
> +		ret = -EINVAL;
> +		goto err;
> +	}
>  
>  	st->fifo_format = adxl372_axis_lookup_table[i].fifo_format;
>  	st->fifo_set_size = bitmap_weight(indio_dev->active_scan_mask,
> @@ -814,26 +820,25 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
>  	if (ret < 0) {
>  		st->fifo_mode = ADXL372_FIFO_BYPASSED;
>  		adxl372_set_interrupts(st, 0, 0);
> -		return ret;
> +		goto err;
>  	}
>  
> -	return iio_triggered_buffer_postenable(indio_dev);
> +	return 0;
> +
> +err:
> +	iio_triggered_buffer_predisable(indio_dev);
> +	return ret;
>  }
>  
>  static int adxl372_buffer_predisable(struct iio_dev *indio_dev)
>  {
>  	struct adxl372_state *st = iio_priv(indio_dev);
> -	int ret;
> -
> -	ret = iio_triggered_buffer_predisable(indio_dev);
> -	if (ret < 0)
> -		return ret;
>  
>  	adxl372_set_interrupts(st, 0, 0);
>  	st->fifo_mode = ADXL372_FIFO_BYPASSED;
>  	adxl372_configure_fifo(st);
>  
> -	return 0;
> +	return iio_triggered_buffer_predisable(indio_dev);
>  }
>  
>  static const struct iio_buffer_setup_ops adxl372_buffer_ops = {


      reply	other threads:[~2019-06-08 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 13:01 [PATCH] iio: adxl372: fix iio_triggered_buffer_{pre,post}enable positions Alexandru Ardelean
2019-06-08 13:50 ` 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=20190608145003.2c099d10@archlinux \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=alexandru.ardelean@analog.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;
as well as URLs for NNTP newsgroup(s).