public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matteo Martelli <matteomartelli3@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>, victor.duicu@microchip.com
Cc: jic23@kernel.org, lars@metafoo.de, marius.cristea@microchip.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8] iio: adc: pac1921: Add ACPI support to Microchip pac1921
Date: Fri, 08 Nov 2024 10:56:36 +0100	[thread overview]
Message-ID: <6069300280c17c4568bf4e3bcc826797@gmail.com> (raw)
In-Reply-To: <CAHp75Vd924pNBKkoWNse5Bjazrp9+HuqBJ5nj2tdk6vngaOiJg@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

On Fri, 8 Nov 2024 11:23:18 +0200, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Fri, Nov 8, 2024 at 10:52 AM <victor.duicu@microchip.com> wrote:
> >
> > From: Victor Duicu <victor.duicu@microchip.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

  reply	other threads:[~2024-11-08  9:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  8:50 [PATCH v8] iio: adc: pac1921: Add ACPI support to Microchip pac1921 victor.duicu
2024-11-08  9:23 ` Andy Shevchenko
2024-11-08  9:56   ` Matteo Martelli [this message]
2024-11-08 13:33     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6069300280c17c4568bf4e3bcc826797@gmail.com \
    --to=matteomartelli3@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marius.cristea@microchip.com \
    --cc=victor.duicu@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox