@@ -16,8 +16,8 @@
static const union v4l2_ctrl_ptr ptr_null;
-static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl,
- u32 changes)
+void v4l2_ctrl_fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl,
+ u32 changes)
{
memset(ev, 0, sizeof(*ev));
ev->type = V4L2_EVENT_CTRL;
@@ -38,6 +38,7 @@ static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl,
ev->u.ctrl.step = ctrl->step;
ev->u.ctrl.default_value = ctrl->default_value;
}
+EXPORT_SYMBOL(v4l2_ctrl_fill_event);
void send_initial_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl)
{
@@ -46,7 +47,7 @@ void send_initial_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl)
if (!(ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY))
changes |= V4L2_EVENT_CTRL_CH_VALUE;
- fill_event(&ev, ctrl, changes);
+ v4l2_ctrl_fill_event(&ev, ctrl, changes);
v4l2_event_queue_fh(fh, &ev);
}
@@ -57,7 +58,7 @@ void send_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 changes)
if (list_empty(&ctrl->ev_subs))
return;
- fill_event(&ev, ctrl, changes);
+ v4l2_ctrl_fill_event(&ev, ctrl, changes);
list_for_each_entry(sev, &ctrl->ev_subs, node)
if (sev->fh != fh ||
@@ -847,6 +847,18 @@ void v4l2_ctrl_auto_cluster(unsigned int ncontrols,
*/
struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
+/**
+ * v4l2_ctrl_fill_event() - Fill the v4l2 event for a control.
+ *
+ * @ev: The event to fill.
+ * @ctrl: The struct v4l2_ctrl for the control event.
+ * @changes: A bitmask that tells what has changed.
+ *
+ * This function assumes that the control handler is locked.
+ */
+void v4l2_ctrl_fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl,
+ u32 changes);
+
/**
* v4l2_ctrl_activate() - Make the control active or inactive.
* @ctrl: The control to (de)activate.
Rename fill_event() to v4l2_ctrl_fill_event() and expose it to drivers. Signed-off-by: Yunke Cao <yunkec@chromium.org> --- drivers/media/v4l2-core/v4l2-ctrls-core.c | 9 +++++---- include/media/v4l2-ctrls.h | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-)