Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Passing an `int *` to `div_u64_rem()` where a `u32 *` is expected will trigger a `-Wincompatible-pointer-types` error, breaking the build.
--
--- Patch [3]: [PATCH v3 3/9] iio: adc: ti-ads1262: support per-channel sampling frequency ---
commit a46f605d6f5895d7bee6634dd981e6c2e2026419
Author: Kurt Borja <[email protected]>
iio: adc: ti-ads1262: support per-channel sampling frequency
This patch adds per-channel sampling frequency support to the ti-ads1262
driver. The "available" attribute is assigned per-channel to eventually
support per-filter availability.
> diff --git a/drivers/iio/adc/ti-ads1262.c b/drivers/iio/adc/ti-ads1262.c
> index d78e5e3ae13ee..b3b7b12491026 100644
> --- a/drivers/iio/adc/ti-ads1262.c
> +++ b/drivers/iio/adc/ti-ads1262.c
[ ... ]
> @@ -575,6 +688,36 @@ static const struct regmap_bus ads1262_regmap_bus = {
> .max_raw_write = ADS1262_MAX_REGMAP_WRITE,
> };
>
> +static void ads1262_populate_samp_freqs(struct ads1262 *st,
> + struct ads1262_channel *chan)
> +{
> + int freq_Hz, freq_rem;
> + u64 freq_uHz;
> +
> + for (unsigned int i = 0; i < ARRAY_SIZE(chan->samp_freqs); i++) {
> + freq_uHz = div_u64(mul_u32_u32(st->clk_rate, MICRO),
> + ads1262_data_rate_div[i]);
> + freq_Hz = div_u64_rem(freq_uHz, MICRO, &freq_rem);
[Severity: Low]
Will this cause a build failure due to incompatible pointer types?
div_u64_rem() expects a u32 * for its third argument, but freq_rem is
declared as an int. In modern kernel builds, -Wincompatible-pointer-types
warnings are treated as errors, which would break the build here.
Could freq_rem be declared as a u32 to prevent this mismatch?
> +
> + chan->samp_freqs[i][0] = freq_Hz;
> + chan->samp_freqs[i][1] = freq_rem;
> + }
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.