summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2019-06-25 10:13:20 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-06-27 07:36:06 -0400
commitf81cbfc4f82a75ca0a2dc181a9c93b88f0e6509d (patch)
treef18f3201bd2fa2636f1a715c311d31ffe18c05fd
parent46fb4749788159412622c5bb9d087a217cc00152 (diff)
media: allegro: use new v4l2_m2m_ioctl_try_encoder_cmd funcs
As the try_encoder_cmd is identical for many drivers, there are now helpers for this function in the mem2mem core. Use the helper in allegro. This fixes the v4l2-compliance test regarding V4L2_ENC_CMD_STOP, because the allegro-specific function rejected invalid flags. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--drivers/staging/media/allegro-dvt/allegro-core.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c
index 20b38b737869..f050c7347fd5 100644
--- a/drivers/staging/media/allegro-dvt/allegro-core.c
+++ b/drivers/staging/media/allegro-dvt/allegro-core.c
@@ -2508,24 +2508,6 @@ static int allegro_s_fmt_vid_out(struct file *file, void *fh,
return 0;
}
-static int allegro_try_encoder_cmd(struct file *file, void *fh,
- struct v4l2_encoder_cmd *cmd)
-{
- switch (cmd->cmd) {
- case V4L2_ENC_CMD_START:
- cmd->flags = 0;
- break;
- case V4L2_ENC_CMD_STOP:
- if (cmd->flags)
- return -EINVAL;
- break;
- default:
- return -EINVAL;
- }
-
- return 0;
-}
-
static int allegro_channel_cmd_stop(struct allegro_channel *channel)
{
struct allegro_dev *dev = channel->dev;
@@ -2594,7 +2576,7 @@ static int allegro_encoder_cmd(struct file *file, void *fh,
struct allegro_channel *channel = fh_to_channel(fh);
int err;
- err = allegro_try_encoder_cmd(file, fh, cmd);
+ err = v4l2_m2m_ioctl_try_encoder_cmd(file, fh, cmd);
if (err)
return err;
@@ -2688,7 +2670,7 @@ static const struct v4l2_ioctl_ops allegro_ioctl_ops = {
.vidioc_streamon = allegro_ioctl_streamon,
.vidioc_streamoff = v4l2_m2m_ioctl_streamoff,
- .vidioc_try_encoder_cmd = allegro_try_encoder_cmd,
+ .vidioc_try_encoder_cmd = v4l2_m2m_ioctl_try_encoder_cmd,
.vidioc_encoder_cmd = allegro_encoder_cmd,
.vidioc_enum_framesizes = allegro_enum_framesizes,