|
@@ -2424,9 +2424,13 @@ int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
|
|
|
}
|
|
|
EXPORT_SYMBOL(v4l2_ctrl_s_ctrl);
|
|
|
|
|
|
-void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
|
|
|
- struct v4l2_subscribed_event *sev)
|
|
|
+static int v4l2_ctrl_add_event(struct v4l2_subscribed_event *sev)
|
|
|
{
|
|
|
+ struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev->fh->ctrl_handler, sev->id);
|
|
|
+
|
|
|
+ if (ctrl == NULL)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
v4l2_ctrl_lock(ctrl);
|
|
|
list_add_tail(&sev->node, &ctrl->ev_subs);
|
|
|
if (ctrl->type != V4L2_CTRL_TYPE_CTRL_CLASS &&
|
|
@@ -2440,17 +2444,40 @@ void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
|
|
|
v4l2_event_queue_fh(sev->fh, &ev);
|
|
|
}
|
|
|
v4l2_ctrl_unlock(ctrl);
|
|
|
+ return 0;
|
|
|
}
|
|
|
-EXPORT_SYMBOL(v4l2_ctrl_add_event);
|
|
|
|
|
|
-void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl,
|
|
|
- struct v4l2_subscribed_event *sev)
|
|
|
+static void v4l2_ctrl_del_event(struct v4l2_subscribed_event *sev)
|
|
|
{
|
|
|
+ struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev->fh->ctrl_handler, sev->id);
|
|
|
+
|
|
|
v4l2_ctrl_lock(ctrl);
|
|
|
list_del(&sev->node);
|
|
|
v4l2_ctrl_unlock(ctrl);
|
|
|
}
|
|
|
-EXPORT_SYMBOL(v4l2_ctrl_del_event);
|
|
|
+
|
|
|
+void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new)
|
|
|
+{
|
|
|
+ u32 old_changes = old->u.ctrl.changes;
|
|
|
+
|
|
|
+ old->u.ctrl = new->u.ctrl;
|
|
|
+ old->u.ctrl.changes |= old_changes;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(v4l2_ctrl_replace);
|
|
|
+
|
|
|
+void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new)
|
|
|
+{
|
|
|
+ new->u.ctrl.changes |= old->u.ctrl.changes;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(v4l2_ctrl_merge);
|
|
|
+
|
|
|
+const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops = {
|
|
|
+ .add = v4l2_ctrl_add_event,
|
|
|
+ .del = v4l2_ctrl_del_event,
|
|
|
+ .replace = v4l2_ctrl_replace,
|
|
|
+ .merge = v4l2_ctrl_merge,
|
|
|
+};
|
|
|
+EXPORT_SYMBOL(v4l2_ctrl_sub_ev_ops);
|
|
|
|
|
|
int v4l2_ctrl_log_status(struct file *file, void *fh)
|
|
|
{
|
|
@@ -2468,7 +2495,7 @@ int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
|
|
|
struct v4l2_event_subscription *sub)
|
|
|
{
|
|
|
if (sub->type == V4L2_EVENT_CTRL)
|
|
|
- return v4l2_event_subscribe(fh, sub, 0, NULL);
|
|
|
+ return v4l2_event_subscribe(fh, sub, 0, &v4l2_ctrl_sub_ev_ops);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
EXPORT_SYMBOL(v4l2_ctrl_subscribe_event);
|