Skip to contentSkip to conversation

media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning

PATCH In review Arnd Bergmann 3 participants 3 messages Oct 18, 2024 – Oct 21, 2024

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

PATCH 1/1 media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning

From: Arnd Bergmann <[email protected]>

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")
---
 .../platform/mediatek/vcodec/encoder/venc/venc_h264_if.c    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c +5 -1
index f8145998fcaf..8522f71fc901 100644
@@ -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);
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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

Quoted 8 lines

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")
Quoted 24 lines
---
 .../platform/mediatek/vcodec/encoder/venc/venc_h264_if.c    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c +5 -1
index f8145998fcaf..8522f71fc901 100644
@@ -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);
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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

Quoted 8 lines

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")
Quoted 24 lines
---
 .../platform/mediatek/vcodec/encoder/venc/venc_h264_if.c    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c +5 -2
index f8145998fcaf..8522f71fc901 100644
@@ -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