[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VeUYyjZqLsxS8BQn0K9uRGCibKsNTgrCdf58ukCrMgSsA@mail.gmail.com>
Date: Thu, 17 Apr 2025 19:10:03 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@....com>
Cc: Jonathan Cameron <jic23@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>,
David Lechner <dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] iio: imu: inv_icm42600: add WoM support
On Thu, Apr 17, 2025 at 5:25 PM Jean-Baptiste Maneyrol
<Jean-Baptiste.Maneyrol@....com> wrote:
> > On Tue, Apr 15, 2025 at 5:47 PM Jean-Baptiste Maneyrol via B4 Relay
> > <devnull+jean-baptiste.maneyrol.tdk.com@...nel.org> wrote:
...
> > > + /* 1000/256mg per LSB converted in m/s² in micro (1000000) */
> >
> > That 1000000 is redundant, just properly spell the units.
>
> I will use um/s²
FWIW, you may even use a Greek MU letter, kernel is UTF-8 compatible :-)
μm/s²
...
> > > + /* limit value to 8 bits and prevent 0 */
> > > + return min(255, max(1, value));
> >
> > Reinvention of the clamp() ?
>
> It was a copy-paste of an older driver, at the time clamp was not here.
> I will replace by clamp, it is much more readable.
For the curious, read this https://lwn.net/Articles/983965/.
The min(max()) may have really unexpected side effects :-)
...
> > > + if (sleep_ms)
> >
> > Do you need this check?
>
> We need this check in the case sleep_ms is 0. It will happen if accel is
> already on. msleep(0) was usually doing a sleep before. I don't know if it
> is still the case.
I'm wondering if it's documented anywhere, do we need to update /
improve a documentation?
> > > + msleep(sleep_ms);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists