Re: [PATCH 6/9] iio: imu: st_lsm6dsx: remove event_threshold field from hw struct
From: Andy Shevchenko
Date: Mon Nov 03 2025 - 04:43:07 EST
On Mon, Nov 03, 2025 at 10:34:28AM +0100, Francesco Lavra wrote:
> On Sun, 2025-11-02 at 15:45 +0200, Andy Shevchenko wrote:
> > On Sun, Nov 2, 2025 at 1:30 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> > > On Thu, 30 Oct 2025 15:49:37 +0200
> > > Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> > > > On Thu, Oct 30, 2025 at 12:10:08PM +0100, Francesco Lavra wrote:
> > > > > On Thu, 2025-10-30 at 10:01 +0200, Andy Shevchenko wrote:
> > > > > > On Thu, Oct 30, 2025 at 08:27:49AM +0100, Francesco Lavra wrote:
...
> > > > > > > + *val = (data & reg->mask) >> __ffs(reg->mask);
> > > > > >
> > > > > > Seems like yet another candidate for field_get() macro.
> > > > >
> > > > > FIELD_GET() can only be used with compile-time constant masks.
> > > > > And apparently this is the case with u8_get_bits() too, because you
> > > > > get a
> > > > > "bad bitfield mask" compiler error if you try to use u8_get_bits().
> > > >
> > > > We are talking about different things.
> > > > Here are the pointers to what I'm talking:
> > > >
> > > > - git grep -n -w 'field_get'
> > > > -
> > > > https://lore.kernel.org/linux-gpio/cover.1761588465.git.geert+renesas@xxxxxxxxx/
> > > >
> > > True that it will be a usecase for that, but given plan is to merge
> > > that through
> > > a different tree in next merge window, it's not available for us yet.
> > > Hence would
> > > be a follow up patch next cycle.
> >
> > Yes, but we can still define them here. Dunno either with #under or
> > under (namespaced) names, but still possible to use now.
>
> OK, I will define an ST_LSM6DSX_FIELD_GET() macro.
With small letters, as this is about run-time helpers (non-constant).
--
With Best Regards,
Andy Shevchenko