Re: [PATCH v4 5/9] iio: imu: st_lsm6dsx: remove event_threshold field from hw struct

From: Andy Shevchenko

Date: Sun Dec 07 2025 - 17:50:46 EST


On Sun, Dec 07, 2025 at 03:31:13PM +0000, Jonathan Cameron wrote:
> On Mon, 1 Dec 2025 11:00:14 +0100
> Francesco Lavra <flavra@xxxxxxxxxxxx> wrote:
>
> > This field is used to store the wakeup event detection threshold value.
> > When adding support for more event types, some of which may have different
> > threshold values for different axes, storing all threshold values for all
> > event sources would be cumbersome. Thus, remove this field altogether, and
> > read the currently configured value from the sensor when requested by
> > userspace.

...

> > #define ST_LSM6DSX_SHIFT_VAL(val, mask) (((val) << __ffs(mask)) & (mask))
> > +#define st_lsm6dsx_field_get(mask, reg) ((reg & mask) >> __ffs(mask))
>
> I'm not going to fuss too much about this as expectation is that
> this will be replaced soon anyway with a generic version but convention
> would be to (reg) & (mask) to avoid precedence of operator problems if
> there are any in the parameters passed. The generic version will I guess also deal
> with avoiding multiple evaluation of mask.
>
> Anyhow, doesn't matter here given the simple user.
>
> Applied.

Note, the new API is already in Linus' tree.

--
With Best Regards,
Andy Shevchenko