[PATCH v4 1/4] iio: adc: ad7192: Pass state directly

From: Alisa-Dariana Roman
Date: Wed Feb 28 2024 - 07:27:18 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>
Signed-off-by: romandariana <alisa.roman@xxxxxxxxxx>
---
drivers/iio/adc/ad7192.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 7bcc7e2aa2a2..72de9cc6716e 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -387,9 +387,9 @@ static int ad7192_clock_select(struct ad7192_state *st)
return clock_sel;
}

-static int ad7192_setup(struct iio_dev *indio_dev, struct device *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;
unsigned long long scale_uv;
@@ -460,7 +460,7 @@ static int ad7192_setup(struct iio_dev *indio_dev, struct device *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;

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

- ret = ad7192_setup(indio_dev, &spi->dev);
+ ret = ad7192_setup(st);
if (ret)
return ret;

--
2.34.1