diff options
author | Bragatheswaran Manickavel <bragathemanick0908@gmail.com> | 2023-10-27 15:14:10 +0530 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-11-16 19:10:28 +0000 |
commit | c788b9e56acd46f3a07d0fad6fc3f543c3557d2c (patch) | |
tree | 81422047da3f77081a719624ea1e848ebe861148 /drivers/iio | |
parent | 3f6b9598b6df604a7c556873de18fcc97919b81c (diff) | |
download | linux-c788b9e56acd46f3a07d0fad6fc3f543c3557d2c.tar.gz linux-c788b9e56acd46f3a07d0fad6fc3f543c3557d2c.tar.bz2 linux-c788b9e56acd46f3a07d0fad6fc3f543c3557d2c.zip |
iio/imu: inv_icm42600: Use max() helper macros
Use the standard max() helper macros instead of direct variable comparison
using if/else blocks or ternary operator. Change identified using
minmax.cocci Coccinelle semantic patch.
Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20231027094410.3706-1-bragathemanick0908@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 5 | ||||
-rw-r--r-- | drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c | 5 | ||||
-rw-r--r-- | drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 5 |
3 files changed, 3 insertions, 12 deletions
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c index b1e4fde27d25..f67bd5a39beb 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c @@ -137,10 +137,7 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev, out_unlock: mutex_unlock(&st->lock); /* sleep maximum required time */ - if (sleep_accel > sleep_temp) - sleep = sleep_accel; - else - sleep = sleep_temp; + sleep = max(sleep_accel, sleep_temp); if (sleep) msleep(sleep); return ret; diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c index 6ef1df9d60b7..b52f328fd26c 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c @@ -424,10 +424,7 @@ out_unlock: mutex_unlock(&st->lock); /* sleep maximum required time */ - if (sleep_sensor > sleep_temp) - sleep = sleep_sensor; - else - sleep = sleep_temp; + sleep = max(sleep_sensor, sleep_temp); if (sleep) msleep(sleep); diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c index 3bf946e56e1d..3df0a715e885 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c @@ -137,10 +137,7 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev, out_unlock: mutex_unlock(&st->lock); /* sleep maximum required time */ - if (sleep_gyro > sleep_temp) - sleep = sleep_gyro; - else - sleep = sleep_temp; + sleep = max(sleep_gyro, sleep_temp); if (sleep) msleep(sleep); return ret; |