From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>, <vlad.dogaru@intel.com>
Subject: Re: [PATCH] iio: proximity: sx9500: fix iio_triggered_buffer_{predisable,postenable} positions
Date: Sat, 5 Oct 2019 16:17:50 +0100 [thread overview]
Message-ID: <20191005161750.2b3fb0ea@archlinux> (raw)
In-Reply-To: <20190920083513.720-1-alexandru.ardelean@analog.com>
On Fri, 20 Sep 2019 11:35:13 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> The iio_triggered_buffer_predisable() should be called last, to detach the
> poll func after the devices has been suspended.
>
> This change re-organizes things a bit so that the postenable & predisable
> are symmetrical. It also converts the preenable() to a postenable().
>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
This one seems simple and I've not heard from Vlad recently so
applied to the togreg branch of iio.git with a note to try and stop
the stable trees picking it up.
Thanks,
Jonathan
> ---
> drivers/iio/proximity/sx9500.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
> index 612f79c53cfc..287d288e40c2 100644
> --- a/drivers/iio/proximity/sx9500.c
> +++ b/drivers/iio/proximity/sx9500.c
> @@ -675,11 +675,15 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)
> return IRQ_HANDLED;
> }
>
> -static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
> +static int sx9500_buffer_postenable(struct iio_dev *indio_dev)
> {
> struct sx9500_data *data = iio_priv(indio_dev);
> int ret = 0, i;
>
> + ret = iio_triggered_buffer_postenable(indio_dev);
> + if (ret)
> + return ret;
> +
> mutex_lock(&data->mutex);
>
> for (i = 0; i < SX9500_NUM_CHANNELS; i++)
> @@ -696,6 +700,9 @@ static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
>
> mutex_unlock(&data->mutex);
>
> + if (ret)
> + iio_triggered_buffer_predisable(indio_dev);
> +
> return ret;
> }
>
> @@ -704,8 +711,6 @@ static int sx9500_buffer_predisable(struct iio_dev *indio_dev)
> struct sx9500_data *data = iio_priv(indio_dev);
> int ret = 0, i;
>
> - iio_triggered_buffer_predisable(indio_dev);
> -
> mutex_lock(&data->mutex);
>
> for (i = 0; i < SX9500_NUM_CHANNELS; i++)
> @@ -722,12 +727,13 @@ static int sx9500_buffer_predisable(struct iio_dev *indio_dev)
>
> mutex_unlock(&data->mutex);
>
> + iio_triggered_buffer_predisable(indio_dev);
> +
> return ret;
> }
>
> static const struct iio_buffer_setup_ops sx9500_buffer_setup_ops = {
> - .preenable = sx9500_buffer_preenable,
> - .postenable = iio_triggered_buffer_postenable,
> + .postenable = sx9500_buffer_postenable,
> .predisable = sx9500_buffer_predisable,
> };
>
prev parent reply other threads:[~2019-10-05 15:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 8:35 [PATCH] iio: proximity: sx9500: fix iio_triggered_buffer_{predisable,postenable} positions Alexandru Ardelean
2019-10-05 15:17 ` 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=20191005161750.2b3fb0ea@archlinux \
--to=jic23@kernel.org \
--cc=alexandru.ardelean@analog.com \
--cc=linux-iio@vger.kernel.org \
--cc=vlad.dogaru@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.