linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ad7280a: fix ad7280_store_balance_timer()
@ 2025-10-10 15:44 David Lechner
  2025-10-10 19:02 ` Nuno Sá
  0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2025-10-10 15:44 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Nuno Sá, Andy Shevchenko, Marcelo Schmitt
  Cc: Jonathan Cameron, linux-iio, linux-kernel, David Lechner

Use correct argument to iio_str_to_fixpoint() to parse 3 decimal places.

iio_str_to_fixpoint() has a bit of an unintuitive API where the
fract_mult parameter is the multiplier of the first decimal place as if
it was already an integer.  So to get 3 decimal places, fract_mult must
be 100 rather than 1000.

Fixes: 96ccdbc07a74 ("staging:iio:adc:ad7280a: Standardize extended ABI naming")
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/adc/ad7280a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7280a.c b/drivers/iio/adc/ad7280a.c
index dda2986ccda075fbfa04851a1ceac7a186b47537..50a6ff7c8b1c73905fabdef119d41204c32b590c 100644
--- a/drivers/iio/adc/ad7280a.c
+++ b/drivers/iio/adc/ad7280a.c
@@ -541,7 +541,7 @@ static ssize_t ad7280_store_balance_timer(struct iio_dev *indio_dev,
 	int val, val2;
 	int ret;
 
-	ret = iio_str_to_fixpoint(buf, 1000, &val, &val2);
+	ret = iio_str_to_fixpoint(buf, 100, &val, &val2);
 	if (ret)
 		return ret;
 

---
base-commit: a9682f53c2d1678b93a123cdaa260e955430bc5c
change-id: 20251010-iio-adc-ad7280a-fix-ad7280_store_balance_timer-126bc5b4ee90

Best regards,
-- 
David Lechner <dlechner@baylibre.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ad7280a: fix ad7280_store_balance_timer()
  2025-10-10 15:44 [PATCH] iio: adc: ad7280a: fix ad7280_store_balance_timer() David Lechner
@ 2025-10-10 19:02 ` Nuno Sá
  2025-10-12 18:59   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Nuno Sá @ 2025-10-10 19:02 UTC (permalink / raw)
  To: David Lechner, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Nuno Sá, Andy Shevchenko, Marcelo Schmitt
  Cc: Jonathan Cameron, linux-iio, linux-kernel

On Fri, 2025-10-10 at 10:44 -0500, David Lechner wrote:
> Use correct argument to iio_str_to_fixpoint() to parse 3 decimal places.
> 
> iio_str_to_fixpoint() has a bit of an unintuitive API where the
> fract_mult parameter is the multiplier of the first decimal place as if
> it was already an integer.  So to get 3 decimal places, fract_mult must
> be 100 rather than 1000.
> 
> Fixes: 96ccdbc07a74 ("staging:iio:adc:ad7280a: Standardize extended ABI naming")
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/adc/ad7280a.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7280a.c b/drivers/iio/adc/ad7280a.c
> index
> dda2986ccda075fbfa04851a1ceac7a186b47537..50a6ff7c8b1c73905fabdef119d41204c32b590c
> 100644
> --- a/drivers/iio/adc/ad7280a.c
> +++ b/drivers/iio/adc/ad7280a.c
> @@ -541,7 +541,7 @@ static ssize_t ad7280_store_balance_timer(struct iio_dev
> *indio_dev,
>  	int val, val2;
>  	int ret;
>  
> -	ret = iio_str_to_fixpoint(buf, 1000, &val, &val2);
> +	ret = iio_str_to_fixpoint(buf, 100, &val, &val2);
>  	if (ret)
>  		return ret;
>  
> 
> ---
> base-commit: a9682f53c2d1678b93a123cdaa260e955430bc5c
> change-id: 20251010-iio-adc-ad7280a-fix-ad7280_store_balance_timer-126bc5b4ee90
> 
> Best regards,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ad7280a: fix ad7280_store_balance_timer()
  2025-10-10 19:02 ` Nuno Sá
@ 2025-10-12 18:59   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-10-12 18:59 UTC (permalink / raw)
  To: Nuno Sá
  Cc: David Lechner, Lars-Peter Clausen, Michael Hennerich,
	Nuno Sá, Andy Shevchenko, Marcelo Schmitt, Jonathan Cameron,
	linux-iio, linux-kernel

On Fri, 10 Oct 2025 20:02:44 +0100
Nuno Sá <noname.nuno@gmail.com> wrote:

> On Fri, 2025-10-10 at 10:44 -0500, David Lechner wrote:
> > Use correct argument to iio_str_to_fixpoint() to parse 3 decimal places.
> > 
> > iio_str_to_fixpoint() has a bit of an unintuitive API where the
> > fract_mult parameter is the multiplier of the first decimal place as if
> > it was already an integer.  So to get 3 decimal places, fract_mult must
> > be 100 rather than 1000.

I'd completely forgotten about that...

> > 
> > Fixes: 96ccdbc07a74 ("staging:iio:adc:ad7280a: Standardize extended ABI naming")
> > Signed-off-by: David Lechner <dlechner@baylibre.com>
> > ---  
> 
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Applied and +CC stable.

> 
> >  drivers/iio/adc/ad7280a.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/ad7280a.c b/drivers/iio/adc/ad7280a.c
> > index
> > dda2986ccda075fbfa04851a1ceac7a186b47537..50a6ff7c8b1c73905fabdef119d41204c32b590c
> > 100644
> > --- a/drivers/iio/adc/ad7280a.c
> > +++ b/drivers/iio/adc/ad7280a.c
> > @@ -541,7 +541,7 @@ static ssize_t ad7280_store_balance_timer(struct iio_dev
> > *indio_dev,
> >  	int val, val2;
> >  	int ret;
> >  
> > -	ret = iio_str_to_fixpoint(buf, 1000, &val, &val2);
> > +	ret = iio_str_to_fixpoint(buf, 100, &val, &val2);
> >  	if (ret)
> >  		return ret;
> >  
> > 
> > ---
> > base-commit: a9682f53c2d1678b93a123cdaa260e955430bc5c
> > change-id: 20251010-iio-adc-ad7280a-fix-ad7280_store_balance_timer-126bc5b4ee90
> > 
> > Best regards,  
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-12 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-10 15:44 [PATCH] iio: adc: ad7280a: fix ad7280_store_balance_timer() David Lechner
2025-10-10 19:02 ` Nuno Sá
2025-10-12 18:59   ` Jonathan Cameron

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).