From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Alexandru Ardelean <alexandru.ardelean@analog.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
linux-iio@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 5.4 074/350] iio: proximity: sx9500: fix iio_triggered_buffer_{predisable,postenable} positions
Date: Sun, 15 Dec 2019 15:52:47 +0000 [thread overview]
Message-ID: <20191215155247.66ea5412@archlinux> (raw)
In-Reply-To: <20191210210735.9077-35-sashal@kernel.org>
On Tue, 10 Dec 2019 16:02:59 -0500
Sasha Levin <sashal@kernel.org> wrote:
> From: Alexandru Ardelean <alexandru.ardelean@analog.com>
>
> [ Upstream commit 3cfd6464fe23deb45bb688df66184b3f32fefc16 ]
>
> 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().
>
> Not stable material as there is no known problem with the current
> code, it's just not consistent with the form we would like all the
> IIO drivers to adopt so as to allow subsystem wide changes.
See comment.
Jonathan
>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> 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 612f79c53cfc6..287d288e40c27 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,
> };
>
next prev parent reply other threads:[~2019-12-15 15:52 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191210210735.9077-1-sashal@kernel.org>
2019-12-10 21:02 ` [PATCH AUTOSEL 5.4 074/350] iio: proximity: sx9500: fix iio_triggered_buffer_{predisable,postenable} positions Sasha Levin
2019-12-15 15:52 ` Jonathan Cameron [this message]
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 105/350] iio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position Sasha Levin
2019-12-15 15:53 ` Jonathan Cameron
2019-12-15 23:25 ` Matt Ranostay
2019-12-19 17:34 ` Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 116/350] iio: adc: max1027: Reset the device at probe time Sasha Levin
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 117/350] iio: dac: ad7303: replace mlock with own lock Sasha Levin
2019-12-15 15:55 ` Jonathan Cameron
2019-12-10 21:03 ` [PATCH AUTOSEL 5.4 129/350] staging: iio: ad9834: add a check for devm_clk_get Sasha Levin
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 137/350] iio: pressure: zpa2326: fix iio_triggered_buffer_postenable position Sasha Levin
2019-12-15 15:57 ` Jonathan Cameron
2019-12-16 7:50 ` Ardelean, Alexandru
2019-12-10 21:04 ` [PATCH AUTOSEL 5.4 192/350] iio: dln2-adc: fix iio_triggered_buffer_postenable() position Sasha Levin
2019-12-15 15:58 ` Jonathan Cameron
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 256/350] iio: imu: st_lsm6dsx: fix ODR check in st_lsm6dsx_write_raw Sasha Levin
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 260/350] iio: cros_ec_baro: set info_mask_shared_by_all_available field Sasha Levin
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 266/350] iio: dac: ad5446: Add support for new AD5600 DAC Sasha Levin
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 268/350] iio: adis16480: Fix scales factors Sasha Levin
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=20191215155247.66ea5412@archlinux \
--to=jic23@jic23.retrosnub.co.uk \
--cc=Jonathan.Cameron@huawei.com \
--cc=alexandru.ardelean@analog.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=stable@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