linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [v1] staging: media: starfive: Clean pad selection in isp_try_format()
@ 2024-03-12  2:45 Changhuang Liang
  2024-03-13  6:01 ` Dan Carpenter
  2024-04-18  1:27 ` 回复: " Changhuang Liang
  0 siblings, 2 replies; 5+ messages in thread
From: Changhuang Liang @ 2024-03-12  2:45 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Greg Kroah-Hartman
  Cc: Hans Verkuil, Laurent Pinchart, Jack Zhu, Changhuang Liang,
	Dan Carpenter, linux-media, linux-kernel, linux-staging

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.

Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
---
 drivers/staging/media/starfive/camss/stf-isp.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/media/starfive/camss/stf-isp.c b/drivers/staging/media/starfive/camss/stf-isp.c
index d50616ef351e..4e6e26736852 100644
--- a/drivers/staging/media/starfive/camss/stf-isp.c
+++ b/drivers/staging/media/starfive/camss/stf-isp.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [v1] staging: media: starfive: Clean pad selection in isp_try_format()
  2024-03-12  2:45 [v1] staging: media: starfive: Clean pad selection in isp_try_format() Changhuang Liang
@ 2024-03-13  6:01 ` Dan Carpenter
  2024-04-18  1:27 ` 回复: " Changhuang Liang
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2024-03-13  6:01 UTC (permalink / raw)
  To: Changhuang Liang
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Hans Verkuil,
	Laurent Pinchart, Jack Zhu, linux-media, linux-kernel,
	linux-staging

On Mon, Mar 11, 2024 at 07:45:20PM -0700, Changhuang Liang wrote:
> 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.
> 
> Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> ---

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!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* 回复: [v1] staging: media: starfive: Clean pad selection in isp_try_format()
  2024-03-12  2:45 [v1] staging: media: starfive: Clean pad selection in isp_try_format() Changhuang Liang
  2024-03-13  6:01 ` Dan Carpenter
@ 2024-04-18  1:27 ` Changhuang Liang
  2024-04-18 17:19   ` Dan Carpenter
  1 sibling, 1 reply; 5+ messages in thread
From: Changhuang Liang @ 2024-04-18  1:27 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Greg Kroah-Hartman
  Cc: Hans Verkuil, Laurent Pinchart, Jack Zhu, Dan Carpenter,
	linux-media, linux-kernel, linux-staging

Hi, Hans

> 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.
> 
> Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> ---

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

Best regards,
Changhuang


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 回复: [v1] staging: media: starfive: Clean pad selection in isp_try_format()
  2024-04-18  1:27 ` 回复: " Changhuang Liang
@ 2024-04-18 17:19   ` Dan Carpenter
  2024-04-19  1:17     ` 回复: " Changhuang Liang
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2024-04-18 17:19 UTC (permalink / raw)
  To: Changhuang Liang
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Hans Verkuil,
	Laurent Pinchart, Jack Zhu, linux-media, linux-kernel,
	linux-staging

On Thu, Apr 18, 2024 at 01:27:04AM +0000, Changhuang Liang wrote:
> Hi, Hans
> 
> > 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.
> > 
> > Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> > ---
> 
> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* 回复: 回复: [v1] staging: media: starfive: Clean pad selection in isp_try_format()
  2024-04-18 17:19   ` Dan Carpenter
@ 2024-04-19  1:17     ` Changhuang Liang
  0 siblings, 0 replies; 5+ messages in thread
From: Changhuang Liang @ 2024-04-19  1:17 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Hans Verkuil,
	Laurent Pinchart, Jack Zhu, linux-media, linux-kernel,
	linux-staging

Hi, dan

> On Thu, Apr 18, 2024 at 01:27:04AM +0000, Changhuang Liang wrote:
> > Hi, Hans
> >
> > > 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.
> > >
> > > Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> > > ---
> >
> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-19  1:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12  2:45 [v1] staging: media: starfive: Clean pad selection in isp_try_format() Changhuang Liang
2024-03-13  6:01 ` Dan Carpenter
2024-04-18  1:27 ` 回复: " Changhuang Liang
2024-04-18 17:19   ` Dan Carpenter
2024-04-19  1:17     ` 回复: " Changhuang Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).