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 019/350] iio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions
Date: Sun, 15 Dec 2019 15:52:03 +0000 [thread overview]
Message-ID: <20191215155203.607cc56d@archlinux> (raw)
In-Reply-To: <20191210210402.8367-19-sashal@kernel.org>
On Tue, 10 Dec 2019 15:58:31 -0500
Sasha Levin <sashal@kernel.org> wrote:
> From: Alexandru Ardelean <alexandru.ardelean@analog.com>
>
> [ Upstream commit 0fe2f2b789190661df24bb8bf62294145729a1fe ]
>
> 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.
>
> The driver was slightly reworked. The preenable hook was moved to the
> postenable, to add some symmetry to the postenable/predisable part.
>
> 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>
I doubt this did any harm, but wouldn't consider it stable material normally.
This is part of a general rework going on to allow some core refactoring.
I should have added a note to this one like some related patches that it
is a logical fix, but we don't have an actual known bug afaik.
Sorry about that.
Jonathan
> ---
> drivers/iio/light/tcs3414.c | 30 ++++++++++++++++++++----------
> 1 file changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c
> index 7c0291c5fe76e..b542e5619ead8 100644
> --- a/drivers/iio/light/tcs3414.c
> +++ b/drivers/iio/light/tcs3414.c
> @@ -240,32 +240,42 @@ static const struct iio_info tcs3414_info = {
> .attrs = &tcs3414_attribute_group,
> };
>
> -static int tcs3414_buffer_preenable(struct iio_dev *indio_dev)
> +static int tcs3414_buffer_postenable(struct iio_dev *indio_dev)
> {
> struct tcs3414_data *data = iio_priv(indio_dev);
> + int ret;
> +
> + ret = iio_triggered_buffer_postenable(indio_dev);
> + if (ret)
> + return ret;
>
> data->control |= TCS3414_CONTROL_ADC_EN;
> - return i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
> + ret = i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
> data->control);
> + if (ret)
> + iio_triggered_buffer_predisable(indio_dev);
> +
> + return ret;
> }
>
> static int tcs3414_buffer_predisable(struct iio_dev *indio_dev)
> {
> struct tcs3414_data *data = iio_priv(indio_dev);
> - int ret;
> -
> - ret = iio_triggered_buffer_predisable(indio_dev);
> - if (ret < 0)
> - return ret;
> + int ret, ret2;
>
> data->control &= ~TCS3414_CONTROL_ADC_EN;
> - return i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
> + ret = i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
> data->control);
> +
> + ret2 = iio_triggered_buffer_predisable(indio_dev);
> + if (!ret)
> + ret = ret2;
> +
> + return ret;
> }
>
> static const struct iio_buffer_setup_ops tcs3414_buffer_setup_ops = {
> - .preenable = tcs3414_buffer_preenable,
> - .postenable = &iio_triggered_buffer_postenable,
> + .postenable = tcs3414_buffer_postenable,
> .predisable = tcs3414_buffer_predisable,
> };
>
next prev parent reply other threads:[~2019-12-15 15:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191210210402.8367-1-sashal@kernel.org>
2019-12-10 20:58 ` [PATCH AUTOSEL 5.4 011/350] iio: max31856: add missing of_node and parent references to iio_dev Sasha Levin
2019-12-10 20:58 ` [PATCH AUTOSEL 5.4 012/350] iio: light: bh1750: Resolve compiler warning and make code more readable Sasha Levin
2019-12-10 20:58 ` [PATCH AUTOSEL 5.4 019/350] iio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions Sasha Levin
2019-12-15 15:52 ` Jonathan Cameron [this message]
2019-12-19 15:22 ` 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=20191215155203.607cc56d@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