[PATCH 08/16] iio: adc: at91-sama5d2_adc: move oversampling storage in its function

From: Claudiu Beznea
Date: Thu Jun 09 2022 - 04:31:11 EST


Move the storage of oversampling_ratio in at91_adc_config_emr().
This prepares for the next commits.

Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
---
drivers/iio/adc/at91-sama5d2_adc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index fbb98e216e70..76367cc948e8 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -796,6 +796,8 @@ static int at91_adc_config_emr(struct at91_adc_state *st,

at91_adc_writel(st, EMR, emr);

+ st->oversampling_ratio = oversampling_ratio;
+
return 0;
}

@@ -1695,9 +1697,6 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev,
goto unlock;
/* update ratio */
ret = at91_adc_config_emr(st, val);
- if (ret)
- goto unlock;
- st->oversampling_ratio = val;
unlock:
mutex_unlock(&st->lock);
return ret;
--
2.34.1