[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251207153113.20c97fa9@jic23-huawei>
Date: Sun, 7 Dec 2025 15:31:13 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Francesco Lavra <flavra@...libre.com>
Cc: Lorenzo Bianconi <lorenzo@...nel.org>, David Lechner
<dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>, Andy
Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, Andy Shevchenko <andriy.shevchenko@...el.com>
Subject: Re: [PATCH v4 5/9] iio: imu: st_lsm6dsx: remove event_threshold
field from hw struct
On Mon, 1 Dec 2025 11:00:14 +0100
Francesco Lavra <flavra@...libre.com> 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.
>
> Signed-off-by: Francesco Lavra <flavra@...libre.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...el.com>
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 3 +--
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 12 +++++++++---
> 2 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> index 4200e5231950..b27a833d5107 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> @@ -79,6 +79,7 @@ enum st_lsm6dsx_hw_id {
> #define ST_LSM6DSX_MAX_TAGGED_WORD_LEN ((32 / ST_LSM6DSX_TAGGED_SAMPLE_SIZE) \
> * ST_LSM6DSX_TAGGED_SAMPLE_SIZE)
> #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.
Jonathan
Powered by blists - more mailing lists