Re: [PATCH v3 1/3] iio: adc: ad7192: Use bitfield access macros

From: Jonathan Cameron
Date: Sat Sep 30 2023 - 13:13:20 EST


On Mon, 25 Sep 2023 00:51:46 +0300
alisadariana@xxxxxxxxx wrote:

> From: Alisa-Dariana Roman <alisa.roman@xxxxxxxxxx>
>
> Include bitfield.h and update driver to use bitfield access macros
> GENMASK, FIELD_PREP and FIELD_GET.
>
> Remove old macros in favor of using FIELD_PREP and masks.
>
> Change %d to %ld to match the type of FIELD_GET().
>
> Signed-off-by: Alisa-Dariana Roman <alisa.roman@xxxxxxxxxx>
Hi Alisa-Dariana,

One more !! in here. I'll get rid of that whilst applying.

Applied to the togreg branch of iio.git.

Thanks,

Jonathan


> @@ -682,7 +682,8 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
> long m)
> {
> struct ad7192_state *st = iio_priv(indio_dev);
> - bool unipolar = !!(st->conf & AD7192_CONF_UNIPOLAR);
> + bool unipolar = !!FIELD_GET(AD7192_CONF_UNIPOLAR, st->conf);

This !! not needed.

> + u8 gain = FIELD_GET(AD7192_CONF_GAIN_MASK, st->conf);
>
> switch (m) {
> case IIO_CHAN_INFO_RAW: