提交 fc5602be 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

[media] v4l2-fh: implement v4l2_priority support

Signed-off-by: NHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 0f62fd6a
...@@ -33,6 +33,8 @@ int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) ...@@ -33,6 +33,8 @@ int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
fh->vdev = vdev; fh->vdev = vdev;
INIT_LIST_HEAD(&fh->list); INIT_LIST_HEAD(&fh->list);
set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags);
fh->prio = V4L2_PRIORITY_UNSET;
BUG_ON(vdev->prio == NULL);
/* /*
* fh->events only needs to be initialized if the driver * fh->events only needs to be initialized if the driver
...@@ -51,6 +53,7 @@ void v4l2_fh_add(struct v4l2_fh *fh) ...@@ -51,6 +53,7 @@ void v4l2_fh_add(struct v4l2_fh *fh)
{ {
unsigned long flags; unsigned long flags;
v4l2_prio_open(fh->vdev->prio, &fh->prio);
spin_lock_irqsave(&fh->vdev->fh_lock, flags); spin_lock_irqsave(&fh->vdev->fh_lock, flags);
list_add(&fh->list, &fh->vdev->fh_list); list_add(&fh->list, &fh->vdev->fh_list);
spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
...@@ -64,6 +67,7 @@ void v4l2_fh_del(struct v4l2_fh *fh) ...@@ -64,6 +67,7 @@ void v4l2_fh_del(struct v4l2_fh *fh)
spin_lock_irqsave(&fh->vdev->fh_lock, flags); spin_lock_irqsave(&fh->vdev->fh_lock, flags);
list_del_init(&fh->list); list_del_init(&fh->list);
spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
v4l2_prio_close(fh->vdev->prio, fh->prio);
} }
EXPORT_SYMBOL_GPL(v4l2_fh_del); EXPORT_SYMBOL_GPL(v4l2_fh_del);
......
...@@ -35,6 +35,7 @@ struct v4l2_fh { ...@@ -35,6 +35,7 @@ struct v4l2_fh {
struct list_head list; struct list_head list;
struct video_device *vdev; struct video_device *vdev;
struct v4l2_events *events; /* events, pending and subscribed */ struct v4l2_events *events; /* events, pending and subscribed */
enum v4l2_priority prio;
}; };
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册