Skip to contentSkip to conversation

media:Fix repeated initialization

PATCH In review Wang Ming 3 participants 4 messages Jul 5, 2023 – Jul 19, 2023

Subsystems (3)
lore
Share & tools
lore

Wang Ming

author
#0 lore raw

PATCH 1/1 media:Fix repeated initialization

If the first report returns NULL,
there is no need to execute the
fimc_capture_try_format() function
again.

---
 .../media/platform/samsung/exynos4-is/fimc-capture.c   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +6 -4
index a0d43bf892e6..5ce2f04afa1e 100644
@@ -825,10 +825,12 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
 		tfmt->height = mf->height;
 		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
 					NULL, &fcc, FIMC_SD_PAD_SINK_CAM);
-		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
-					NULL, &fcc, FIMC_SD_PAD_SOURCE);
-		if (ffmt && ffmt->mbus_code)
-			mf->code = ffmt->mbus_code;
+		if (ffmt) {
+			ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
+				NULL, &fcc, FIMC_SD_PAD_SOURCE);
+			if (ffmt && ffmt->mbus_code)
+				mf->code = ffmt->mbus_code;
+		}
 		if (mf->width != tfmt->width || mf->height != tfmt->height)
 			continue;
 		tfmt->code = mf->code;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 4 lines · Wang Ming

If the first report returns NULL,
there is no need to execute the
fimc_capture_try_format() function
again.

Few nitpicks only, as I don't know the code unfortunately:

Please wrap commit message according to Linux coding style / submission process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597

Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching.

Quoted 11 lines
---
 .../media/platform/samsung/exynos4-is/fimc-capture.c   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +0 -0
index a0d43bf892e6..5ce2f04afa1e 100644

drivers/media/platform/samsung/exynos4-is/fimc-capture.c static int fimc_pipeline_try_format(struct fimc_ctx *ctx, · line 830

Quoted 10 lines
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +3 -4
@@ -825,10 +825,12 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
 		tfmt->height = mf->height;
 		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
 					NULL, &fcc, FIMC_SD_PAD_SINK_CAM);
-		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
-					NULL, &fcc, FIMC_SD_PAD_SOURCE);
-		if (ffmt && ffmt->mbus_code)
-			mf->code = ffmt->mbus_code;
+		if (ffmt) {
+			ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
+				NULL, &fcc, FIMC_SD_PAD_SOURCE);

This does not look aligned.

Best regards,
Krzysztof

#2 lore raw

Hi Krzysztof Kozlowski.
Look closely, there seems to be a misalignment problem here. In addition, what modifications do you need me to make, I will submit them repeatedly according to your requirements.
: )
-----邮件原件-----
发件人: Krzysztof Kozlowski <[email protected]>
发送时间: 2023年7月5日 23:10
收件人: 王明-软件底层技术部 <[email protected]>; Sylwester Nawrocki <[email protected]>; Mauro Carvalho Chehab <[email protected]>; Alim Akhtar <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected] 抄送: opensource.kernel <[email protected]>
主题: Re: [PATCH v1] media:Fix repeated initialization

Quoted 4 lines · Wang Ming

If the first report returns NULL,
there is no need to execute the
fimc_capture_try_format() function
again.

Few nitpicks only, as I don't know the code unfortunately:

Please wrap commit message according to Linux coding style / submission process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597

Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching.

Quoted 12 lines
---
 .../media/platform/samsung/exynos4-is/fimc-capture.c   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +0 -0
index a0d43bf892e6..5ce2f04afa1e 100644

drivers/media/platform/samsung/exynos4-is/fimc-capture.c static int fimc_pipeline_try_format(struct fimc_ctx *ctx, · line 830

Quoted 10 lines
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +3 -4
@@ -825,10 +825,12 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
 		tfmt->height = mf->height;
 		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
 					NULL, &fcc, FIMC_SD_PAD_SINK_CAM);
-		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
-					NULL, &fcc, FIMC_SD_PAD_SOURCE);
-		if (ffmt && ffmt->mbus_code)
-			mf->code = ffmt->mbus_code;
+		if (ffmt) {
+			ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
+				NULL, &fcc, FIMC_SD_PAD_SOURCE);

This does not look aligned.

Best regards,
Krzysztof

#3 lore raw
In reply to Wang Ming
Quoted 18 lines · Wang Ming

If the first report returns NULL,
there is no need to execute the
fimc_capture_try_format() function
again.

---
 .../media/platform/samsung/exynos4-is/fimc-capture.c   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +0 -0
index a0d43bf892e6..5ce2f04afa1e 100644
@@ -825,10 +825,12 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
 		tfmt->height = mf->height;
 		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
 					NULL, &fcc, FIMC_SD_PAD_SINK_CAM);

drivers/media/platform/samsung/exynos4-is/fimc-capture.c static int fimc_pipeline_try_format(struct fimc_ctx *ctx, · line 833

Quoted 10 lines
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +6 -4
-		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
-					NULL, &fcc, FIMC_SD_PAD_SOURCE);
-		if (ffmt && ffmt->mbus_code)
-			mf->code = ffmt->mbus_code;
+		if (ffmt) {
+			ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
+				NULL, &fcc, FIMC_SD_PAD_SOURCE);
+			if (ffmt && ffmt->mbus_code)
+				mf->code = ffmt->mbus_code;
+		}

I'm not so sure this is a bug at all. I think (not quite certain) that the first fimc_capture_try_format() call constrains the width and height to whatever is the SINK_CAM pad, then further constrains it to that of the SOURCE pad.

But really, someone from Samsung should take a look as well. Adding Marek and Sylwester.

Regards,

Hans

Quoted 3 lines
drivers/media/platform/samsung/exynos4-is/fimc-capture.c +0 -0
 		if (mf->width != tfmt->width || mf->height != tfmt->height)
 			continue;
 		tfmt->code = mf->code;