linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Matt Ranostay <matt.ranostay@konsulko.com>
Subject: Re: [PATCH] iio: hdc100x: fix iio_triggered_buffer_{predisable,postenable} positions
Date: Sun, 27 Oct 2019 16:58:13 +0000	[thread overview]
Message-ID: <20191027165813.5a5b0519@archlinux> (raw)
In-Reply-To: <20191023082714.18681-1-alexandru.ardelean@analog.com>

On Wed, 23 Oct 2019 11:27:14 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> The iio_triggered_buffer_postenable() hook should be called first to
> attach the poll function and the iio_triggered_buffer_predisable() hook
> should be called last in the predisable hook.
> 
> This change updates the driver to attach/detach the poll func in the
> correct order.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Seems fine, but should have cc'd Matt and I'd like to give him time
to take a quick look.

+CC Matt.

Thanks,

Jonathan

> ---
>  drivers/iio/humidity/hdc100x.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
> index bfe1cdb16846..963ff043eecf 100644
> --- a/drivers/iio/humidity/hdc100x.c
> +++ b/drivers/iio/humidity/hdc100x.c
> @@ -278,31 +278,34 @@ static int hdc100x_buffer_postenable(struct iio_dev *indio_dev)
>  	struct hdc100x_data *data = iio_priv(indio_dev);
>  	int ret;
>  
> +	ret = iio_triggered_buffer_postenable(indio_dev);
> +	if (ret)
> +		return ret;
> +
>  	/* Buffer is enabled. First set ACQ Mode, then attach poll func */
>  	mutex_lock(&data->lock);
>  	ret = hdc100x_update_config(data, HDC100X_REG_CONFIG_ACQ_MODE,
>  				    HDC100X_REG_CONFIG_ACQ_MODE);
>  	mutex_unlock(&data->lock);
>  	if (ret)
> -		return ret;
> +		iio_triggered_buffer_predisable(indio_dev);
>  
> -	return iio_triggered_buffer_postenable(indio_dev);
> +	return ret;
>  }
>  
>  static int hdc100x_buffer_predisable(struct iio_dev *indio_dev)
>  {
>  	struct hdc100x_data *data = iio_priv(indio_dev);
> -	int ret;
> -
> -	/* First detach poll func, then reset ACQ mode. OK to disable buffer */
> -	ret = iio_triggered_buffer_predisable(indio_dev);
> -	if (ret)
> -		return ret;
> +	int ret, ret2;
>  
>  	mutex_lock(&data->lock);
>  	ret = hdc100x_update_config(data, HDC100X_REG_CONFIG_ACQ_MODE, 0);
>  	mutex_unlock(&data->lock);
>  
> +	ret2 = iio_triggered_buffer_predisable(indio_dev);
> +	if (ret == 0)
> +		ret = ret2;
> +
>  	return ret;
>  }
>  


  reply	other threads:[~2019-10-27 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23  8:27 [PATCH] iio: hdc100x: fix iio_triggered_buffer_{predisable,postenable} positions Alexandru Ardelean
2019-10-27 16:58 ` Jonathan Cameron [this message]
2019-10-27 18:37   ` Matt Ranostay
2019-10-28  7:11     ` Ardelean, Alexandru
2019-11-02 14:40       ` Jonathan Cameron

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=20191027165813.5a5b0519@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.ranostay@konsulko.com \
    /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).