Skip to contentSkip to conversation

staging: media: starfive: Clean pad selection in isp_try_format()

PATCH In review Changhuang Liang 2 participants 5 messages Mar 12, 2024 – Apr 19, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: starfive: Clean pad selection in isp_try_format()

The code to select isp_dev->formats[] is overly complicated. We can just use the "pad" as the index. This will making adding new pads easier in future patches. No functional change.

---
 drivers/staging/media/starfive/camss/stf-isp.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/staging/media/starfive/camss/stf-isp.c +2 -8
index d50616ef351e..4e6e26736852 100644
@@ -10,9 +10,6 @@
 
 #include "stf-camss.h"
 
-#define SINK_FORMATS_INDEX	0
-#define SOURCE_FORMATS_INDEX	1
-
 static int isp_set_selection(struct v4l2_subdev *sd,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_selection *sel);
@@ -94,10 +91,7 @@ static void isp_try_format(struct stf_isp_dev *isp_dev,
 		return;
 	}
 
-	if (pad == STF_ISP_PAD_SINK)
-		formats = &isp_dev->formats[SINK_FORMATS_INDEX];
-	else if (pad == STF_ISP_PAD_SRC)
-		formats = &isp_dev->formats[SOURCE_FORMATS_INDEX];
+	formats = &isp_dev->formats[pad];
 
 	fmt->width = clamp_t(u32, fmt->width, STFCAMSS_FRAME_MIN_WIDTH,
 			     STFCAMSS_FRAME_MAX_WIDTH);
@@ -123,7 +117,7 @@ static int isp_enum_mbus_code(struct v4l2_subdev *sd,
 		if (code->index >= ARRAY_SIZE(isp_formats_sink))
 			return -EINVAL;
 
-		formats = &isp_dev->formats[SINK_FORMATS_INDEX];
+		formats = &isp_dev->formats[code->pad];
 		code->code = formats->fmts[code->index].code;
 	} else {
 		struct v4l2_mbus_framefmt *sink_fmt;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Changhuang Liang

The code to select isp_dev->formats[] is overly complicated. We can just use the "pad" as the index. This will making adding new pads easier in future patches. No functional change.

---

I'm not sure that patchwork will find this patch if it doesn't have [PATCH] in the subject... But otherwise the patch looks good. Thanks!

regards,
dan carpenter

#3 lore raw
Quoted 10 lines · Changhuang Liang

Hi, Hans

Quoted 6 lines

The code to select isp_dev->formats[] is overly complicated. We can just use the "pad" as the index. This will making adding new pads easier in future patches. No functional change.

---

Could you please help to review this patch, thanks for your time.

Linux-media uses patchwork, so probably it was missed because it didn't have a [PATCH] in the subject. Just resend.

regards,
dan carpenter

#4 lore raw

Hi, dan

Quoted 7 lines · Changhuang Liang
Quoted 6 lines

Hi, Hans

Quoted 4 lines

The code to select isp_dev->formats[] is overly complicated. We can just use the "pad" as the index. This will making adding new pads easier in future patches. No functional change.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

---

Could you please help to review this patch, thanks for your time.

Linux-media uses patchwork, so probably it was missed because it didn't have a [PATCH] in the subject. Just resend.

But I can find it in the patchwork:
https://patchwork.linuxtv.org/project/linux-media/list/?param=3&page=4

regards,
Changhuang