Re: [PATCH v8] iio: adc: pac1921: Add ACPI support to Microchip pac1921

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 8 Nov 2024 11:23:18 +0200, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
> On Fri, Nov 8, 2024 at 10:52â?¯AM <victor.duicu@xxxxxxxxxxxxx> wrote:
> >
> > From: Victor Duicu <victor.duicu@xxxxxxxxxxxxx>
> >

...

> > +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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux