Skip to content

Commit

Permalink
media: cedrus: Add helper for determining number of elements
Browse files Browse the repository at this point in the history
Now that controls can be dynamic arrays, we need to know how many
elements are in such array. Add a helper for that.

Signed-off-by: Jernej Skrabec <[email protected]>
Reviewed-by: Ezequiel Garcia <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jernejsk authored and mchehab committed Jul 17, 2022
1 parent 0ede8c8 commit c6618d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/staging/media/sunxi/cedrus/cedrus.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ void *cedrus_find_control_data(struct cedrus_ctx *ctx, u32 id)
return NULL;
}

u32 cedrus_get_num_of_controls(struct cedrus_ctx *ctx, u32 id)
{
unsigned int i;

for (i = 0; ctx->ctrls[i]; i++)
if (ctx->ctrls[i]->id == id)
return ctx->ctrls[i]->elems;

return 0;
}

static int cedrus_init_ctrls(struct cedrus_dev *dev, struct cedrus_ctx *ctx)
{
struct v4l2_ctrl_handler *hdl = &ctx->hdl;
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/media/sunxi/cedrus/cedrus.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,6 @@ vb2_to_cedrus_buffer(const struct vb2_buffer *p)
}

void *cedrus_find_control_data(struct cedrus_ctx *ctx, u32 id);
u32 cedrus_get_num_of_controls(struct cedrus_ctx *ctx, u32 id);

#endif

0 comments on commit c6618d2

Please sign in to comment.