linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: platform: mtk-mdp3: cmdq: Remove duplicated platforms checks
@ 2024-10-17 20:16 Mohammed Anees
  2024-10-21 12:30 ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 3+ messages in thread
From: Mohammed Anees @ 2024-10-17 20:16 UTC (permalink / raw)
  To: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Mauro Carvalho Chehab, Matthias Brugger,
	AngeloGioacchino Del Regno, Sebastian Fricke, Moudy Ho,
	Ricardo Ribalda, Mohammed Anees

The platform compatibility checks for MT8183 and
MT8195 in mdp_cmdq_prepare() are redundant as they are
done in __get_config_offset() itself. Furthermore
there are two if-else branch in __get_config_offset()
which have similar conditions and are redundant.
To address this, remove the check in mdp_cmdq_prepare()
and combine the two if-else branch into one in
__get_config_offset().

Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
---
 .../platform/mediatek/mdp3/mtk-mdp3-cmdq.c    | 24 ++++++-------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
index ea2ea119dd2a..6eb5affb0366 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
@@ -114,19 +114,15 @@ static struct img_config *__get_config_offset(struct mdp_dev *mdp,
 	if (pp_idx >= mdp->mdp_data->pp_used)
 		goto err_param;
 
-	if (CFG_CHECK(MT8183, p_id))
+	if (CFG_CHECK(MT8183, p_id)) {
 		cfg_c = CFG_OFST(MT8183, param->config, pp_idx);
-	else if (CFG_CHECK(MT8195, p_id))
-		cfg_c = CFG_OFST(MT8195, param->config, pp_idx);
-	else
-		goto err_param;
-
-	if (CFG_CHECK(MT8183, p_id))
 		cfg_n = CFG_OFST(MT8183, param->config, pp_idx + 1);
-	else if (CFG_CHECK(MT8195, p_id))
+	} else if (CFG_CHECK(MT8195, p_id)) {
+		cfg_c = CFG_OFST(MT8195, param->config, pp_idx);
 		cfg_n = CFG_OFST(MT8195, param->config, pp_idx + 1);
-	else
+	} else {
 		goto err_param;
+	}
 
 	if ((long)cfg_n - (long)mdp->vpu.config > bound) {
 		dev_err(dev, "config offset %ld OOB %ld\n", (long)cfg_n, bound);
@@ -607,13 +603,6 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp,
 		goto err_uninit;
 	}
 
-	if (CFG_CHECK(MT8183, p_id))
-		num_comp = CFG_GET(MT8183, config, num_components);
-	else if (CFG_CHECK(MT8195, p_id))
-		num_comp = CFG_GET(MT8195, config, num_components);
-	else
-		goto err_uninit;
-
 	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
 	if (!cmd) {
 		ret = -ENOMEM;
@@ -631,7 +620,8 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp,
 	} else {
 		ret = -EINVAL;
 		goto err_destroy_pkt;
-	}
+	}
+
 	comps = kcalloc(num_comp, sizeof(*comps), GFP_KERNEL);
 	if (!comps) {
 		ret = -ENOMEM;
-- 
2.47.0



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

* Re: [PATCH] media: platform: mtk-mdp3: cmdq: Remove duplicated platforms checks
  2024-10-17 20:16 [PATCH] media: platform: mtk-mdp3: cmdq: Remove duplicated platforms checks Mohammed Anees
@ 2024-10-21 12:30 ` AngeloGioacchino Del Regno
  2024-10-22  6:42   ` Mohammed Anees
  0 siblings, 1 reply; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-10-21 12:30 UTC (permalink / raw)
  To: Mohammed Anees, linux-media, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Mauro Carvalho Chehab, Matthias Brugger, Sebastian Fricke,
	Moudy Ho, Ricardo Ribalda

Il 17/10/24 22:16, Mohammed Anees ha scritto:
> The platform compatibility checks for MT8183 and
> MT8195 in mdp_cmdq_prepare() are redundant as they are
> done in __get_config_offset() itself. Furthermore
> there are two if-else branch in __get_config_offset()
> which have similar conditions and are redundant.
> To address this, remove the check in mdp_cmdq_prepare()
> and combine the two if-else branch into one in
> __get_config_offset().
> 
> Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>

This should've been [PATCH v2], because this *is* a version 2: even if you
have changed the title a bit, it's still "the same" patch ;-)

Next time, please version your patches correctly.

Anyway, apart from this not being declared as v2, this time I'll let you
get my

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

...because the patch is good, and because it's only the first time that I warn
you about this :-)

Keep up the good work!

Cheers,
Angelo


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

* Re: [PATCH] media: platform: mtk-mdp3: cmdq: Remove duplicated platforms checks
  2024-10-21 12:30 ` AngeloGioacchino Del Regno
@ 2024-10-22  6:42   ` Mohammed Anees
  0 siblings, 0 replies; 3+ messages in thread
From: Mohammed Anees @ 2024-10-22  6:42 UTC (permalink / raw)
  To: angelogioacchino.delregno
  Cc: linux-arm-kernel, linux-kernel, linux-media, linux-mediatek,
	matthias.bgg, mchehab, moudy.ho, pvmohammedanees2003, ribalda,
	sebastian.fricke

> This should've been [PATCH v2], because this *is* a version 2: even if you
> have changed the title a bit, it's still "the same" patch ;-)

Oh okay!! I didn’t know that one should have marked it as v2. My apologies 
for that! Thanks for being lenient this time, I really appreciate it. 
I’ll make sure this doesn’t happen again.

> Next time, please version your patches correctly.
Absolutely!
>
> Anyway, apart from this not being declared as v2, this time I'll let you
> get my
>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>
> ...because the patch is good, and because it's only the first time that I warn
> you about this :-)
>
>Keep up the good work!

Thanks!


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

end of thread, other threads:[~2024-10-22  6:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 20:16 [PATCH] media: platform: mtk-mdp3: cmdq: Remove duplicated platforms checks Mohammed Anees
2024-10-21 12:30 ` AngeloGioacchino Del Regno
2024-10-22  6:42   ` Mohammed Anees

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).