Re: [PATCH v3 3/5] iio: adc: ad7380: do not store osr in private data structure

From: Jonathan Cameron
Date: Sun Jan 12 2025 - 06:34:38 EST


On Tue, 07 Jan 2025 09:48:27 +0100
Julien Stephan <jstephan@xxxxxxxxxxxx> wrote:

> Since regmap cache is now enabled, we don't need to store the
> oversampling ratio in the private data structure.
>
> Signed-off-by: Julien Stephan <jstephan@xxxxxxxxxxxx>
I don't mind the solution you have here, but one passing comment inline.
Up to you on whether you take any notice!


> +static int ad7380_get_osr(struct ad7380_state *st, int *val)
> +{
> + u32 tmp;
> + int ret;
> +
> + ret = regmap_read(st->regmap, AD7380_REG_ADDR_CONFIG1, &tmp);
> + if (ret)
> + return ret;
> +
> + *val = ad7380_regval_to_osr(FIELD_GET(AD7380_CONFIG1_OSR, tmp));

All small values, so maybe cleaner to just return this instead
of using a parameter.

> +
> + return 0;
> +}