Re: [PATCH] iio: adc: ad7625: fix type mismatch in clamp() macro
From: Giorgi Tchankvetadze
Date: Sat Apr 25 2026 - 03:15:23 EST
On Fri, Apr 24, 2026 at 12:27 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxx> wrote:
>
> You can modify types including for 'target' on your wish as it seems local
> variable anyway. Have you tried
>
> cnv_wf.period_length_ns = clamp(target, 100UL, 10UL * NSEC_PER_USEC);
>
> ?
>
> (Note, KILO as it's currently used is 'unsigned long'.)
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Andy, thanks. I changed target to unsigned long since it is local, and used
unsigned long bounds with NSEC_PER_USEC. This avoids the cast and keeps the
clamp operands naturally compatible.