* [PATCH AUTOSEL 5.4 011/350] iio: max31856: add missing of_node and parent references to iio_dev
[not found] <20191210210402.8367-1-sashal@kernel.org>
@ 2019-12-10 20:58 ` 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
2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2019-12-10 20:58 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Andrea Merello, Jonathan Cameron, Sasha Levin, linux-iio
From: Andrea Merello <andrea.merello@gmail.com>
[ Upstream commit 505ea3ada665c466d0064b11b6e611b7f995517d ]
Adding missing indio_dev->dev.of_node references so that, in case multiple
max31856 are present, users can get some clues to being able to distinguish
each of them. While at it, add also the missing parent reference.
Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/temperature/max31856.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/temperature/max31856.c b/drivers/iio/temperature/max31856.c
index f184ba5601d94..73ed550e3fc95 100644
--- a/drivers/iio/temperature/max31856.c
+++ b/drivers/iio/temperature/max31856.c
@@ -284,6 +284,8 @@ static int max31856_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
indio_dev->info = &max31856_info;
+ indio_dev->dev.parent = &spi->dev;
+ indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->name = id->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = max31856_channels;
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH AUTOSEL 5.4 012/350] iio: light: bh1750: Resolve compiler warning and make code more readable
[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 ` 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
2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2019-12-10 20:58 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Krzysztof Wilczynski, Uwe Kleine-König, Jonathan Cameron,
Sasha Levin, linux-iio
From: Krzysztof Wilczynski <kw@linux.com>
[ Upstream commit f552fde983d378e7339f9ea74a25f918563bf0d3 ]
Separate the declaration of struct bh1750_chip_info from definition
of bh1750_chip_info_tbl[] in a single statement as it makes the code
hard to read, and with the extra newline it makes it look as if the
bh1750_chip_info_tbl[] had no explicit type.
This change also resolves the following compiler warning about the
unusual position of the static keyword that can be seen when building
with warnings enabled (W=1):
drivers/iio/light/bh1750.c:64:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]
Related to commit 3a11fbb037a1 ("iio: light: add support for ROHM
BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensors").
Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/light/bh1750.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c
index 28347df78cff6..adb5ab9e34390 100644
--- a/drivers/iio/light/bh1750.c
+++ b/drivers/iio/light/bh1750.c
@@ -59,9 +59,9 @@ struct bh1750_chip_info {
u16 int_time_low_mask;
u16 int_time_high_mask;
-}
+};
-static const bh1750_chip_info_tbl[] = {
+static const struct bh1750_chip_info bh1750_chip_info_tbl[] = {
[BH1710] = { 140, 1022, 300, 400, 250000000, 2, 0x001F, 0x03E0 },
[BH1721] = { 140, 1020, 300, 400, 250000000, 2, 0x0010, 0x03E0 },
[BH1750] = { 31, 254, 69, 1740, 57500000, 1, 0x001F, 0x00E0 },
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH AUTOSEL 5.4 019/350] iio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions
[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 ` Sasha Levin
2019-12-15 15:52 ` Jonathan Cameron
2 siblings, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2019-12-10 20:58 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Alexandru Ardelean, Jonathan Cameron, Sasha Levin, linux-iio
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>
---
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,
};
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH AUTOSEL 5.4 019/350] iio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions
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
2019-12-19 15:22 ` Sasha Levin
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2019-12-15 15:52 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Alexandru Ardelean, Jonathan Cameron,
linux-iio
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,
> };
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH AUTOSEL 5.4 019/350] iio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions
2019-12-15 15:52 ` Jonathan Cameron
@ 2019-12-19 15:22 ` Sasha Levin
0 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2019-12-19 15:22 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-kernel, stable, Alexandru Ardelean, Jonathan Cameron,
linux-iio
On Sun, Dec 15, 2019 at 03:52:03PM +0000, Jonathan Cameron wrote:
>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.
I'll drop it from everywhere, thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-12-19 15:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2019-12-19 15:22 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox