Re: [PATCH v7 10/11] input: misc: Add support for MAX7360 rotary

From: Andy Shevchenko
Date: Fri May 02 2025 - 10:10:20 EST


On Fri, May 02, 2025 at 03:58:04PM +0200, Mathieu Dubois-Briand wrote:
> On Fri May 2, 2025 at 12:52 PM CEST, Andy Shevchenko wrote:
> > On Mon, Apr 28, 2025 at 01:57:28PM +0200, Mathieu Dubois-Briand wrote:

...

> >> + pos = max(0, (int)pos + steps);
> >
> > Please, no castings for min()/max()/clamp(). It diminishes the use of those
> > macros.
>
> Sorry, I'm not sure to get the point. Should I use MIN_T() instead?

Are the second argument is compile-time constant? I don't think so. Hence no
use for MIN*()/MAX*(). First of all, try to answer to the Q: Why is the explicit
casting being used? The second Q: How can it be easily fixed without using _t()
variants of the macros?

--
With Best Regards,
Andy Shevchenko