iio: imu: bmi323: remove unnecessary cast in watermark limit
Subsystems (2)
PATCH v2 1/1 iio: imu: bmi323: remove unnecessary cast in watermark limit
Remove the explicit u32 cast in the watermark limit calculation.
The BMI323_FIFO_FULL_IN_FRAMES macro can be used directly with min() without triggering type issues.
---
Changes in v2:
- Drop the unnecessary cast instead of using min_t().
- Follow reviewer feedback from David Laight and Andy Shevchenko.
drivers/iio/imu/bmi323/bmi323_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/bmi323/bmi323_core.c +1 -1
@@ -1128,7 +1128,7 @@ static int bmi323_set_watermark(struct iio_dev *indio_dev, unsigned int val) {struct bmi323_data *data =iio_priv (indio_dev); - val =min (val, (u32 )BMI323_FIFO_FULL_IN_FRAMES ); + val =min (val,BMI323_FIFO_FULL_IN_FRAMES );guard (mutex)(&data->mutex); data->watermark = val;
Signature · 1 line
2.34.1
Quoted 7 lines · Hungyu Lin
Remove the explicit u32 cast in the watermark limit calculation.
The
BMI323_FIFO_FULL_IN_FRAMESmacro can be used directly withmin()without triggering type issues.Signed-off-by Hungyu Lin <[email protected]>---
Quoted 22 lines
Changes in v2:
- Drop the unnecessary cast instead of usingmin_t().
- Follow reviewer feedback from David Laight and Andy Shevchenko.drivers/iio/imu/bmi323/bmi323_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/imu/bmi323/bmi323_core.c +0
-0@@ -1128,7 +1128,7 @@ static int bmi323_set_watermark(struct iio_dev *indio_dev, unsigned int val) { struct bmi323_data *data = iio_priv(indio_dev);drivers/iio/imu/bmi323/bmi323_core.c +1
-1- val =min (val, (u32 )BMI323_FIFO_FULL_IN_FRAMES ); + val =min (val,BMI323_FIFO_FULL_IN_FRAMES );
guard(mutex)(&data->mutex);
data->watermark= val;
Quoted 4 lines · Hungyu Lin
Remove the explicit u32 cast in the watermark limit calculation.
The
BMI323_FIFO_FULL_IN_FRAMESmacro can be used directly withmin()without triggering type issues.
Right, now it looks much better.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 9 lines · On Tue, 9 Jun 2026 16:28:31 +0300 Andy Shevchenko…
Quoted 4 lines · Hungyu Lin
Remove the explicit u32 cast in the watermark limit calculation.
The
BMI323_FIFO_FULL_IN_FRAMESmacro can be used directly withmin()without triggering type issues.Right, now it looks much better.
Reviewed-by Andy Shevchenko <[email protected]>
Agreed. Easy to check these min conditions as there is good documentation in minmax.h Entry that is relevant here I think is this one.
* - Unsigned arguments can be compared against non-negative signed constants.
Applied to the testing branch of iio.git.
Thanks,
Jonathan