linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning
@ 2024-10-18 15:21 Arnd Bergmann
  2024-10-18 22:41 ` Nathan Chancellor
  2024-10-21  5:38 ` Alexandre Courbot
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2024-10-18 15:21 UTC (permalink / raw)
  To: Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Mauro Carvalho Chehab,
	Matthias Brugger, AngeloGioacchino Del Regno, Nathan Chancellor,
	Hans Verkuil, Alexandre Courbot
  Cc: Arnd Bergmann, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Fei Shao, linux-media, linux-kernel, linux-arm-kernel,
	linux-mediatek, llvm

From: Arnd Bergmann <arnd@arndb.de>

This is one of three clang warnings about incompatible enum types
in a conditional expression:

drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c:597:29: error: conditional expression between different enumeration types ('enum scp_ipi_id' and 'enum ipi_id') [-Werror,-Wenum-compare-conditional]
  597 |         inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
      |                                    ^ ~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~

The code is correct, so just rework it to avoid the warning.

Fixes: 0dc4b3286125 ("media: mtk-vcodec: venc: support SCP firmware")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../platform/mediatek/vcodec/encoder/venc/venc_h264_if.c    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
index f8145998fcaf..8522f71fc901 100644
--- a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
+++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
@@ -594,7 +594,11 @@ static int h264_enc_init(struct mtk_vcodec_enc_ctx *ctx)
 
 	inst->ctx = ctx;
 	inst->vpu_inst.ctx = ctx;
-	inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
+	if (is_ext)
+		inst->vpu_inst.id = SCP_IPI_VENC_H264;
+	else
+		inst->vpu_inst.id = IPI_VENC_H264;
+
 	inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_SYS);
 
 	ret = vpu_enc_init(&inst->vpu_inst);
-- 
2.39.5



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

* Re: [PATCH] media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning
  2024-10-18 15:21 [PATCH] media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning Arnd Bergmann
@ 2024-10-18 22:41 ` Nathan Chancellor
  2024-10-21  5:38 ` Alexandre Courbot
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2024-10-18 22:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Mauro Carvalho Chehab,
	Matthias Brugger, AngeloGioacchino Del Regno, Hans Verkuil,
	Alexandre Courbot, Arnd Bergmann, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Fei Shao, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek, llvm

On Fri, Oct 18, 2024 at 03:21:10PM +0000, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This is one of three clang warnings about incompatible enum types
> in a conditional expression:
> 
> drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c:597:29: error: conditional expression between different enumeration types ('enum scp_ipi_id' and 'enum ipi_id') [-Werror,-Wenum-compare-conditional]
>   597 |         inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
>       |                                    ^ ~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~
> 
> The code is correct, so just rework it to avoid the warning.
> 
> Fixes: 0dc4b3286125 ("media: mtk-vcodec: venc: support SCP firmware")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  .../platform/mediatek/vcodec/encoder/venc/venc_h264_if.c    | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
> index f8145998fcaf..8522f71fc901 100644
> --- a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
> +++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
> @@ -594,7 +594,11 @@ static int h264_enc_init(struct mtk_vcodec_enc_ctx *ctx)
>  
>  	inst->ctx = ctx;
>  	inst->vpu_inst.ctx = ctx;
> -	inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
> +	if (is_ext)
> +		inst->vpu_inst.id = SCP_IPI_VENC_H264;
> +	else
> +		inst->vpu_inst.id = IPI_VENC_H264;
> +
>  	inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_SYS);
>  
>  	ret = vpu_enc_init(&inst->vpu_inst);
> -- 
> 2.39.5
> 


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

* Re: [PATCH] media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning
  2024-10-18 15:21 [PATCH] media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning Arnd Bergmann
  2024-10-18 22:41 ` Nathan Chancellor
@ 2024-10-21  5:38 ` Alexandre Courbot
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2024-10-21  5:38 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Mauro Carvalho Chehab,
	Matthias Brugger, AngeloGioacchino Del Regno, Nathan Chancellor,
	Hans Verkuil, Arnd Bergmann, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Fei Shao, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek, llvm

On Sat, Oct 19, 2024 at 12:21 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> This is one of three clang warnings about incompatible enum types
> in a conditional expression:
>
> drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c:597:29: error: conditional expression between different enumeration types ('enum scp_ipi_id' and 'enum ipi_id') [-Werror,-Wenum-compare-conditional]
>   597 |         inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
>       |                                    ^ ~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~
>
> The code is correct, so just rework it to avoid the warning.
>
> Fixes: 0dc4b3286125 ("media: mtk-vcodec: venc: support SCP firmware")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Alexandre Courbot <acourbot@google.com>

> ---
>  .../platform/mediatek/vcodec/encoder/venc/venc_h264_if.c    | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
> index f8145998fcaf..8522f71fc901 100644
> --- a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
> +++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
> @@ -594,7 +594,11 @@ static int h264_enc_init(struct mtk_vcodec_enc_ctx *ctx)
>
>         inst->ctx = ctx;
>         inst->vpu_inst.ctx = ctx;
> -       inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
> +       if (is_ext)
> +               inst->vpu_inst.id = SCP_IPI_VENC_H264;
> +       else
> +               inst->vpu_inst.id = IPI_VENC_H264;
> +
>         inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_SYS);
>
>         ret = vpu_enc_init(&inst->vpu_inst);
> --
> 2.39.5
>


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

end of thread, other threads:[~2024-10-21  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 15:21 [PATCH] media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning Arnd Bergmann
2024-10-18 22:41 ` Nathan Chancellor
2024-10-21  5:38 ` Alexandre Courbot

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