media: mtk-vcodec: vdec: use helpers in VIDIOC_(TRY_)DECODER_CMD
authorAlexandre Courbot <acourbot@chromium.org>
Fri, 6 Aug 2021 04:15:18 +0000 (06:15 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 30 Sep 2021 08:07:41 +0000 (10:07 +0200)
Let's use the dedicated helpers to make sure we get the expected
behavior and remove redundant code.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c

index 8df8bcf..1a633b4 100644 (file)
@@ -484,18 +484,7 @@ static void mtk_vdec_worker(struct work_struct *work)
 static int vidioc_try_decoder_cmd(struct file *file, void *priv,
                                struct v4l2_decoder_cmd *cmd)
 {
-       switch (cmd->cmd) {
-       case V4L2_DEC_CMD_STOP:
-       case V4L2_DEC_CMD_START:
-               if (cmd->flags != 0) {
-                       mtk_v4l2_err("cmd->flags=%u", cmd->flags);
-                       return -EINVAL;
-               }
-               break;
-       default:
-               return -EINVAL;
-       }
-       return 0;
+       return v4l2_m2m_ioctl_try_decoder_cmd(file, priv, cmd);
 }