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>
This commit is contained in:
Bragatheswaran Manickavel 2023-10-27 15:14:10 +05:30 committed by Jonathan Cameron
parent 3f6b9598b6
commit c788b9e56a
3 changed files with 3 additions and 12 deletions

View File

@ -137,10 +137,7 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev,
out_unlock: out_unlock:
mutex_unlock(&st->lock); mutex_unlock(&st->lock);
/* sleep maximum required time */ /* sleep maximum required time */
if (sleep_accel > sleep_temp) sleep = max(sleep_accel, sleep_temp);
sleep = sleep_accel;
else
sleep = sleep_temp;
if (sleep) if (sleep)
msleep(sleep); msleep(sleep);
return ret; return ret;

View File

@ -424,10 +424,7 @@ out_unlock:
mutex_unlock(&st->lock); mutex_unlock(&st->lock);
/* sleep maximum required time */ /* sleep maximum required time */
if (sleep_sensor > sleep_temp) sleep = max(sleep_sensor, sleep_temp);
sleep = sleep_sensor;
else
sleep = sleep_temp;
if (sleep) if (sleep)
msleep(sleep); msleep(sleep);

View File

@ -137,10 +137,7 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev,
out_unlock: out_unlock:
mutex_unlock(&st->lock); mutex_unlock(&st->lock);
/* sleep maximum required time */ /* sleep maximum required time */
if (sleep_gyro > sleep_temp) sleep = max(sleep_gyro, sleep_temp);
sleep = sleep_gyro;
else
sleep = sleep_temp;
if (sleep) if (sleep)
msleep(sleep); msleep(sleep);
return ret; return ret;