Re: [PATCH 1/3] iio: imu: bmi270: add channel for step counter

From: Andy Shevchenko
Date: Fri Apr 25 2025 - 00:29:44 EST


On Fri, Apr 25, 2025 at 3:15 AM Gustavo Silva <gustavograzs@xxxxxxxxx> wrote:
>
> Add a channel for enabling/disabling the step counter, reading the
> number of steps and resetting the counter.

Looks ideal from the style and maintaining perspective, thanks for
making the reviewer's job easy! One small comment, but
Reviewed-by: Andy Shevchenko <andy@xxxxxxxxxx>

...

> + case IIO_CHAN_INFO_PROCESSED: {
> + guard(mutex)(&data->mutex);

> + if (val || !data->steps_enabled)
> + return -EINVAL;

Please, move the val check outside of the lock, no need to lock for
the local data.

> + /* Clear step counter value */
> + return bmi270_update_feature_reg(data, BMI270_SC_26_REG,
> + BMI270_STEP_SC26_RST_CNT_MSK,
> + FIELD_PREP(BMI270_STEP_SC26_RST_CNT_MSK,
> + 1));
> + }

--
With Best Regards,
Andy Shevchenko