* [PATCH] iio: adc: ad7380: fix adi,gain-milli property parsing
@ 2025-06-19 15:24 David Lechner
2025-06-22 14:25 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2025-06-19 15:24 UTC (permalink / raw)
To: Michael Hennerich, Nuno Sá, Lars-Peter Clausen,
Jonathan Cameron, Julien Stephan
Cc: Jonathan Cameron, linux-iio, linux-kernel, David Lechner
Change the data type of the "adi,gain-milli" property from u32 to u16.
The devicetree binding specifies it as uint16, so we need to read it as
such to avoid an -EOVERFLOW error when parsing the property.
Fixes: c904e6dcf402 ("iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4")
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
drivers/iio/adc/ad7380.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
index aef85093eb16cbe9cc062f8cb4239e955c8a21b6..fd17e28e279191c2603537a9bddc7eb9976c144c 100644
--- a/drivers/iio/adc/ad7380.c
+++ b/drivers/iio/adc/ad7380.c
@@ -1920,8 +1920,9 @@ static int ad7380_probe(struct spi_device *spi)
if (st->chip_info->has_hardware_gain) {
device_for_each_child_node_scoped(dev, node) {
- unsigned int channel, gain;
+ unsigned int channel;
int gain_idx;
+ u16 gain;
ret = fwnode_property_read_u32(node, "reg", &channel);
if (ret)
@@ -1933,7 +1934,7 @@ static int ad7380_probe(struct spi_device *spi)
"Invalid channel number %i\n",
channel);
- ret = fwnode_property_read_u32(node, "adi,gain-milli",
+ ret = fwnode_property_read_u16(node, "adi,gain-milli",
&gain);
if (ret && ret != -EINVAL)
return dev_err_probe(dev, ret,
---
base-commit: a3245ebdfac846ce0b563a3ed474be2e15381f9f
change-id: 20250619-iio-adc-ad7380-fix-adi-gain-milli-parsing-8df01280f493
Best regards,
--
David Lechner <dlechner@baylibre.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: ad7380: fix adi,gain-milli property parsing
2025-06-19 15:24 [PATCH] iio: adc: ad7380: fix adi,gain-milli property parsing David Lechner
@ 2025-06-22 14:25 ` Jonathan Cameron
2025-06-24 21:09 ` David Lechner
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2025-06-22 14:25 UTC (permalink / raw)
To: David Lechner
Cc: Michael Hennerich, Nuno Sá, Lars-Peter Clausen,
Julien Stephan, Jonathan Cameron, linux-iio, linux-kernel
On Thu, 19 Jun 2025 10:24:22 -0500
David Lechner <dlechner@baylibre.com> wrote:
> Change the data type of the "adi,gain-milli" property from u32 to u16.
> The devicetree binding specifies it as uint16, so we need to read it as
> such to avoid an -EOVERFLOW error when parsing the property.
>
> Fixes: c904e6dcf402 ("iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4")
> Signed-off-by: David Lechner <dlechner@baylibre.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
J
> ---
> drivers/iio/adc/ad7380.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index aef85093eb16cbe9cc062f8cb4239e955c8a21b6..fd17e28e279191c2603537a9bddc7eb9976c144c 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -1920,8 +1920,9 @@ static int ad7380_probe(struct spi_device *spi)
>
> if (st->chip_info->has_hardware_gain) {
> device_for_each_child_node_scoped(dev, node) {
> - unsigned int channel, gain;
> + unsigned int channel;
> int gain_idx;
> + u16 gain;
>
> ret = fwnode_property_read_u32(node, "reg", &channel);
> if (ret)
> @@ -1933,7 +1934,7 @@ static int ad7380_probe(struct spi_device *spi)
> "Invalid channel number %i\n",
> channel);
>
> - ret = fwnode_property_read_u32(node, "adi,gain-milli",
> + ret = fwnode_property_read_u16(node, "adi,gain-milli",
> &gain);
> if (ret && ret != -EINVAL)
> return dev_err_probe(dev, ret,
>
> ---
> base-commit: a3245ebdfac846ce0b563a3ed474be2e15381f9f
> change-id: 20250619-iio-adc-ad7380-fix-adi-gain-milli-parsing-8df01280f493
>
> Best regards,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: ad7380: fix adi,gain-milli property parsing
2025-06-22 14:25 ` Jonathan Cameron
@ 2025-06-24 21:09 ` David Lechner
0 siblings, 0 replies; 3+ messages in thread
From: David Lechner @ 2025-06-24 21:09 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Michael Hennerich, Nuno Sá, Lars-Peter Clausen,
Julien Stephan, Jonathan Cameron, linux-iio, linux-kernel
On Sun, Jun 22, 2025 at 8:25 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Thu, 19 Jun 2025 10:24:22 -0500
> David Lechner <dlechner@baylibre.com> wrote:
>
> > Change the data type of the "adi,gain-milli" property from u32 to u16.
> > The devicetree binding specifies it as uint16, so we need to read it as
> > such to avoid an -EOVERFLOW error when parsing the property.
> >
> > Fixes: c904e6dcf402 ("iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4")
> > Signed-off-by: David Lechner <dlechner@baylibre.com>
> Applied to the fixes-togreg branch of iio.git and marked for stable.
>
Hmm... looks like this branch hasn't been pushed to kernel.org for a while.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-24 21:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 15:24 [PATCH] iio: adc: ad7380: fix adi,gain-milli property parsing David Lechner
2025-06-22 14:25 ` Jonathan Cameron
2025-06-24 21:09 ` David Lechner
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).