Commit c788b9e5 authored by Bragatheswaran Manickavel's avatar Bragatheswaran Manickavel Committed by Jonathan Cameron

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: default avatarBragatheswaran Manickavel <bragathemanick0908@gmail.com>
Acked-by: default avatarJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20231027094410.3706-1-bragathemanick0908@gmail.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 3f6b9598
......@@ -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;
......
......@@ -424,10 +424,7 @@ static int inv_icm42600_buffer_postdisable(struct iio_dev *indio_dev)
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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment