[media] v4l2-fh: implement v4l2_priority support
authorHans Verkuil <hverkuil@xs4all.nl>
Wed, 29 Dec 2010 16:36:50 +0000 (13:36 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 22 Mar 2011 19:37:56 +0000 (16:37 -0300)
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-fh.c
include/media/v4l2-fh.h

index d78f184f40c5e67d5a9fc5a009daf156453c5d0d..78a1608a09d65010bba98f7431093c0a8e4ba99b 100644 (file)
@@ -33,6 +33,8 @@ int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
        fh->vdev = vdev;
        INIT_LIST_HEAD(&fh->list);
        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
@@ -51,6 +53,7 @@ void v4l2_fh_add(struct v4l2_fh *fh)
 {
        unsigned long flags;
 
+       v4l2_prio_open(fh->vdev->prio, &fh->prio);
        spin_lock_irqsave(&fh->vdev->fh_lock, flags);
        list_add(&fh->list, &fh->vdev->fh_list);
        spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
@@ -64,6 +67,7 @@ void v4l2_fh_del(struct v4l2_fh *fh)
        spin_lock_irqsave(&fh->vdev->fh_lock, flags);
        list_del_init(&fh->list);
        spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
+       v4l2_prio_close(fh->vdev->prio, fh->prio);
 }
 EXPORT_SYMBOL_GPL(v4l2_fh_del);
 
index 1d72dde320bf1e21501688ca14bb7833241fbdc7..5fc5ba96e1d2c0cba85300de8eedd36506b374f6 100644 (file)
@@ -35,6 +35,7 @@ struct v4l2_fh {
        struct list_head        list;
        struct video_device     *vdev;
        struct v4l2_events      *events; /* events, pending and subscribed */
+       enum v4l2_priority      prio;
 };
 
 /*