[PATCH v3 2/5] iio: adc: ad7192: Pass state directly

From: Alisa-Dariana Roman
Date: Thu Feb 08 2024 - 12:26:07 EST


Pass only the ad7192_state structure. There is no need to pass the
iio_dev structure.

Signed-off-by: Alisa-Dariana Roman <alisa.roman@xxxxxxxxxx>
---
drivers/iio/adc/ad7192.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 48e0357564af..5e8043865233 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -384,9 +384,8 @@ static int ad7192_device_clock_select(struct ad7192_state *st)
return clock_sel;
}

-static int ad7192_setup(struct iio_dev *indio_dev)
+static int ad7192_setup(struct ad7192_state *st)
{
- struct ad7192_state *st = iio_priv(indio_dev);
struct device *dev = &st->sd.spi->dev;
bool rej60_en, refin2_en;
bool buf_en, bipolar, burnout_curr_en;
@@ -458,7 +457,7 @@ static int ad7192_setup(struct iio_dev *indio_dev)
/* Populate available ADC input ranges */
for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++) {
scale_uv = ((u64)st->int_vref_mv * 100000000)
- >> (indio_dev->channels[0].scan_type.realbits -
+ >> (st->chip_info->channels[0].scan_type.realbits -
!FIELD_GET(AD7192_CONF_UNIPOLAR, st->conf));
scale_uv >>= i;

@@ -1150,7 +1149,7 @@ static int ad7192_probe(struct spi_device *spi)
}
}

- ret = ad7192_setup(indio_dev);
+ ret = ad7192_setup(st);
if (ret)
return ret;

--
2.34.1