[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250518180349.6fb308be@jic23-huawei>
Date: Sun, 18 May 2025 18:03:49 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Jonathan Santos <Jonathan.Santos@...log.com>
Cc: <linux-iio@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>,
<andy@...nel.org>, <nuno.sa@...log.com>, <Michael.Hennerich@...log.com>,
<marcelo.schmitt@...log.com>, <robh@...nel.org>, <krzk+dt@...nel.org>,
<conor+dt@...nel.org>, <marcelo.schmitt1@...il.com>,
<linus.walleij@...aro.org>, <brgl@...ev.pl>, <lgirdwood@...il.com>,
<broonie@...nel.org>, <jonath4nns@...il.com>, <dlechner@...libre.com>, "Pop
Paul" <paul.pop@...log.com>
Subject: Re: [PATCH v8 10/11] iio: adc: ad7768-1: add filter type and
oversampling ratio attributes
> * DMA (thus cache coherency maintenance) may require the
> @@ -326,11 +337,37 @@ static int ad7768_send_sync_pulse(struct ad7768_state *st)
>
> static void ad7768_fill_samp_freq_tbl(struct ad7768_state *st)
> {
> - unsigned int i;
> + unsigned int i, samp_freq_avail, freq_filtered, len = 0;
If you are spinning again, please split the len = 0 onto it's own
unsigned int len = 0;
to avoid mixing assigning and non assigning declarations
as they are a little hard to spot when mixed up!
> +
> + freq_filtered = DIV_ROUND_CLOSEST(st->mclk_freq, st->oversampling_ratio);
> + for (i = 0; i < ARRAY_SIZE(ad7768_mclk_div_rates); i++) {
> + samp_freq_avail = DIV_ROUND_CLOSEST(freq_filtered, ad7768_mclk_div_rates[i]);
> + /* Sampling frequency cannot be lower than the minimum of 50 SPS */
> + if (samp_freq_avail < 50)
> + continue;
> +
> + st->samp_freq_avail[len++] = samp_freq_avail;
> + }
> +
> + st->samp_freq_avail_len = len;
> +}
Powered by blists - more mailing lists