[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6069300280c17c4568bf4e3bcc826797@gmail.com>
Date: Fri, 08 Nov 2024 10:56:36 +0100
From: Matteo Martelli <matteomartelli3@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>, victor.duicu@...rochip.com
Cc: jic23@...nel.org, lars@...afoo.de, marius.cristea@...rochip.com,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8] iio: adc: pac1921: Add ACPI support to Microchip
pac1921
On Fri, 8 Nov 2024 11:23:18 +0200, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> On Fri, Nov 8, 2024 at 10:52 AM <victor.duicu@...rochip.com> wrote:
> >
> > From: Victor Duicu <victor.duicu@...rochip.com>
> >
...
> > +static inline bool pac1921_shunt_is_valid(u32 shunt_val)
> > +{
> > + return shunt_val > 0 && shunt_val <= INT_MAX;
> > +}
>
> This basically is the (shunt_val - 1) & BIT(31) which can be used
> inline in the caller. Hence, drop this function and use the check
> inline. See also below.
>
I think the current comparison check is more clear. Also my suggestion
to move the check in a seperate function was to keep it consistent in
different places since such check can change in future and one might
change it only in one place, as it was happening during the first
iterations of this series. However I am fine to remove the function and
move the check back inline in the caller as the check is now only in two
places and it shouldn't be a big deal.
...
> --
> With Best Regards,
> Andy Shevchenko
Best regards,
Matteo Martelli
Powered by blists - more mailing lists