diff mbox series

[v2] iio: adc: ad7192: fix channel select

Message ID 20250124150703.97848-1-markus.burri@mt.com (mailing list archive)
State Accepted
Headers show
Series [v2] iio: adc: ad7192: fix channel select | expand

Commit Message

Markus Burri Jan. 24, 2025, 3:07 p.m. UTC
Channel configuration doesn't work as expected.
For FIELD_PREP the bit mask is needed and not the bit number.

Fixes: 874bbd1219c7 ("iio: adc: ad7192: Use bitfield access macros")

Signed-off-by: Markus Burri <markus.burri@mt.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
---
 drivers/iio/adc/ad7192.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04

Comments

Jonathan Cameron Jan. 25, 2025, 12:22 p.m. UTC | #1
On Fri, 24 Jan 2025 16:07:03 +0100
Markus Burri <markus.burri@mt.com> wrote:

> Channel configuration doesn't work as expected.
> For FIELD_PREP the bit mask is needed and not the bit number.
> 
> Fixes: 874bbd1219c7 ("iio: adc: ad7192: Use bitfield access macros")
needs to be part of the tags block.  Hence no blank line here.

I'll tidy that up whilst applying.  Applied and marked for stable.
Note I'll not push out my tree until I can rebase on rc1 after
next weekend as right now it would make a mess of linux-next.
> 
> Signed-off-by: Markus Burri <markus.burri@mt.com>
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> ---
>  drivers/iio/adc/ad7192.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 1c87db0e0460..c4effe8429c8 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -1082,7 +1082,7 @@ static int ad7192_update_scan_mode(struct iio_dev *indio_dev, const unsigned lon
>  
>  	conf &= ~AD7192_CONF_CHAN_MASK;
>  	for_each_set_bit(i, scan_mask, 8)
> -		conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, i);
> +		conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, BIT(i));
>  
>  	ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, conf);
>  	if (ret < 0)
> 
> base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 1c87db0e0460..c4effe8429c8 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -1082,7 +1082,7 @@  static int ad7192_update_scan_mode(struct iio_dev *indio_dev, const unsigned lon
 
 	conf &= ~AD7192_CONF_CHAN_MASK;
 	for_each_set_bit(i, scan_mask, 8)
-		conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, i);
+		conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, BIT(i));
 
 	ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, conf);
 	if (ret < 0)