Commit 2addee7a authored by Michael Tretter's avatar Michael Tretter Committed by Hans Verkuil

media: rockchip: rga: use macros for testing buffer type

Use the provided V4L2_TYPE_IS_{OUTPUT,CAPTURE} macros to check if the
buffer or queue is OUTPUT or CAPTURE. The macros work also work for the
_MPLANE buffer and queue types and make it easier to switch to the
multi-planar API.
Signed-off-by: default avatarMichael Tretter <m.tretter@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 4e4dd24e
...@@ -344,14 +344,11 @@ static struct rga_frame def_frame = { ...@@ -344,14 +344,11 @@ static struct rga_frame def_frame = {
struct rga_frame *rga_get_frame(struct rga_ctx *ctx, enum v4l2_buf_type type) struct rga_frame *rga_get_frame(struct rga_ctx *ctx, enum v4l2_buf_type type)
{ {
switch (type) { if (V4L2_TYPE_IS_OUTPUT(type))
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
return &ctx->in; return &ctx->in;
case V4L2_BUF_TYPE_VIDEO_CAPTURE: if (V4L2_TYPE_IS_CAPTURE(type))
return &ctx->out; return &ctx->out;
default: return ERR_PTR(-EINVAL);
return ERR_PTR(-EINVAL);
}
} }
static int rga_open(struct file *file) static int rga_open(struct file *file)
...@@ -559,21 +556,21 @@ static int vidioc_g_selection(struct file *file, void *prv, ...@@ -559,21 +556,21 @@ static int vidioc_g_selection(struct file *file, void *prv,
switch (s->target) { switch (s->target) {
case V4L2_SEL_TGT_COMPOSE_DEFAULT: case V4L2_SEL_TGT_COMPOSE_DEFAULT:
case V4L2_SEL_TGT_COMPOSE_BOUNDS: case V4L2_SEL_TGT_COMPOSE_BOUNDS:
if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (!V4L2_TYPE_IS_CAPTURE(s->type))
return -EINVAL; return -EINVAL;
break; break;
case V4L2_SEL_TGT_CROP_DEFAULT: case V4L2_SEL_TGT_CROP_DEFAULT:
case V4L2_SEL_TGT_CROP_BOUNDS: case V4L2_SEL_TGT_CROP_BOUNDS:
if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) if (!V4L2_TYPE_IS_OUTPUT(s->type))
return -EINVAL; return -EINVAL;
break; break;
case V4L2_SEL_TGT_COMPOSE: case V4L2_SEL_TGT_COMPOSE:
if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (!V4L2_TYPE_IS_CAPTURE(s->type))
return -EINVAL; return -EINVAL;
use_frame = true; use_frame = true;
break; break;
case V4L2_SEL_TGT_CROP: case V4L2_SEL_TGT_CROP:
if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) if (!V4L2_TYPE_IS_OUTPUT(s->type))
return -EINVAL; return -EINVAL;
use_frame = true; use_frame = true;
break; break;
...@@ -611,7 +608,7 @@ static int vidioc_s_selection(struct file *file, void *prv, ...@@ -611,7 +608,7 @@ static int vidioc_s_selection(struct file *file, void *prv,
* COMPOSE target is only valid for capture buffer type, return * COMPOSE target is only valid for capture buffer type, return
* error for output buffer type * error for output buffer type
*/ */
if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (!V4L2_TYPE_IS_CAPTURE(s->type))
return -EINVAL; return -EINVAL;
break; break;
case V4L2_SEL_TGT_CROP: case V4L2_SEL_TGT_CROP:
...@@ -619,7 +616,7 @@ static int vidioc_s_selection(struct file *file, void *prv, ...@@ -619,7 +616,7 @@ static int vidioc_s_selection(struct file *file, void *prv,
* CROP target is only valid for output buffer type, return * CROP target is only valid for output buffer type, return
* error for capture buffer type * error for capture buffer type
*/ */
if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) if (!V4L2_TYPE_IS_OUTPUT(s->type))
return -EINVAL; return -EINVAL;
break; break;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment