media: i2c: Replace nested min() with single min3()
Subsystems (3)
PATCH 1/1 media: i2c: Replace nested min() with single min3()
Use min3() macro instead of nesting min() to simplify the return statement.
Signed-off-by Qasim Ijaz <[email protected]>
--- drivers/media/i2c/vgxy61.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/vgxy61.c +2 -2
@@ -892,8 +892,8 @@ static u32 vgxy61_get_expo_long_max(struct vgxy61_dev *sensor, third_rot_max_expo = (sensor->frame_length /71 ) * short_expo_ratio;/* Take the minimum from all rules */ -return min (min (first_rot_max_expo, second_rot_max_expo), - third_rot_max_expo); +return min3 (first_rot_max_expo, second_rot_max_expo, + third_rot_max_expo); } static int vgxy61_update_exposure(struct vgxy61_dev *sensor, u16 new_expo_long,
Signature · 1 line
2.39.5
…
drivers/media/i2c/vgxy61.c static u32 vgxy61_get_expo_long_max(struct vgxy61_dev *sensor, · line 896
Quoted 9 lines
+++
b/drivers/media/i2c/vgxy61.cdrivers/media/i2c/vgxy61.c +2
-2@@ -892,8 +892,8 @@ static u32 vgxy61_get_expo_long_max(struct vgxy61_dev *sensor, third_rot_max_expo = (sensor->frame_length /71 ) * short_expo_ratio;/* Take the minimum from all rules */ -return min (min (first_rot_max_expo, second_rot_max_expo), - third_rot_max_expo); +return min3 (first_rot_max_expo, second_rot_max_expo, + third_rot_max_expo);
…
Can the following source code variant be applied?
+ return min3(first_rot_max_expo, second_rot_max_expo, third_rot_max_expo);
Regards,
Markus
Sakari Ailus
maintainerHi Qasim,
Quoted 2 lines · Qasim Ijaz
Use
min3()macro instead of nestingmin()to simplify the return statement.
Going forward, for this driver on subject:
s/i2c/vgxy61/
as this is a driver for vgxy61. I've done that this time.
Signature · 3 lines
Regards, Sakari Ailus