* [PATCH] media: i2c: Replace nested min() with single min3()
@ 2025-02-25 12:59 Qasim Ijaz
2025-02-25 16:34 ` Markus Elfring
2025-02-26 13:03 ` Sakari Ailus
0 siblings, 2 replies; 3+ messages in thread
From: Qasim Ijaz @ 2025-02-25 12:59 UTC (permalink / raw)
To: sakari.ailus, benjamin.mugnier, sylvain.petinot, mchehab
Cc: linux-media, linux-kernel
Use min3() macro instead of nesting min() to simplify the return
statement.
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
---
drivers/media/i2c/vgxy61.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c
index d77468c8587b..5b0479f3a3c0 100644
--- a/drivers/media/i2c/vgxy61.c
+++ b/drivers/media/i2c/vgxy61.c
@@ -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,
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: i2c: Replace nested min() with single min3()
2025-02-25 12:59 [PATCH] media: i2c: Replace nested min() with single min3() Qasim Ijaz
@ 2025-02-25 16:34 ` Markus Elfring
2025-02-26 13:03 ` Sakari Ailus
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-02-25 16:34 UTC (permalink / raw)
To: Qasim Ijaz, linux-media, Benjamin Mugnier, Mauro Carvalho Chehab,
Sakari Ailus, Sylvain Petinot
Cc: LKML
…
> +++ b/drivers/media/i2c/vgxy61.c
> @@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: i2c: Replace nested min() with single min3()
2025-02-25 12:59 [PATCH] media: i2c: Replace nested min() with single min3() Qasim Ijaz
2025-02-25 16:34 ` Markus Elfring
@ 2025-02-26 13:03 ` Sakari Ailus
1 sibling, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2025-02-26 13:03 UTC (permalink / raw)
To: Qasim Ijaz
Cc: benjamin.mugnier, sylvain.petinot, mchehab, linux-media,
linux-kernel
Hi Qasim,
On Tue, Feb 25, 2025 at 12:59:37PM +0000, Qasim Ijaz wrote:
> Use min3() macro instead of nesting min() 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.
--
Regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-26 13:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 12:59 [PATCH] media: i2c: Replace nested min() with single min3() Qasim Ijaz
2025-02-25 16:34 ` Markus Elfring
2025-02-26 13:03 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox