[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfCJSytzFHKAjCiW8xBsb+qQQjb7kyBnoH14FWtqmJkGg@mail.gmail.com>
Date: Sat, 21 Jun 2025 22:28:02 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: Andy Shevchenko <andriy.shevchenko@...el.com>, lars@...afoo.de,
Michael.Hennerich@...log.com, jic23@...nel.org, dlechner@...libre.com,
nuno.sa@...log.com, andy@...nel.org, corbet@....net,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, eraretuya@...il.com
Subject: Re: [PATCH v9 08/11] iio: accel: adxl345: add inactivity feature
On Sat, Jun 21, 2025 at 10:24 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
> On Sat, Jun 21, 2025 at 9:54 PM Lothar Rubusch <l.rubusch@...il.com> wrote:
> > On Thu, Jun 12, 2025 at 2:15 PM Andy Shevchenko
> > <andriy.shevchenko@...el.com> wrote:
> > > On Tue, Jun 10, 2025 at 09:59:30PM +0000, Lothar Rubusch wrote:
...
> > > > + val = (adxl345_odr_tbl[odr][0] > max_boundary)
> > > > + ? min_boundary : max_boundary - adxl345_odr_tbl[odr][0];
> > >
> > > clamp() ?
> >
> > Isn't clamp() dealing with signed ints?
>
> clamp() is a macro.
>
> > Also, I'll take the diff from
> > max_boundary here.
>
> How does it affect usage of the clamp()?
I see what you mean, but this can be done by clamping the signed values.
So, in any case try to improve this and add a comment explaining why
the maximum boundary is adjusted.
> > So, I'll try staying with the current line and hope
> > it's fine.
>
> I suggest you spend some time thinking about this expression on how to
> make it easier to read and understand. In my opinion clamp() helps a
> lot in this case.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists