[media] em28xx: convert to v4l2_fh, fix priority handling
authorHans Verkuil <hans.verkuil@cisco.com>
Fri, 7 Sep 2012 08:52:40 +0000 (05:52 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Jan 2013 02:51:28 +0000 (00:51 -0200)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/em28xx/em28xx-video.c
drivers/media/usb/em28xx/em28xx.h

index ebbf775fcaba03dbf50bf28b3249078aa44684e3..c67ff8d96d22dd68b7da772804b53d14faece8b8 100644 (file)
@@ -1735,6 +1735,7 @@ static int em28xx_v4l2_open(struct file *filp)
                mutex_unlock(&dev->lock);
                return -ENOMEM;
        }
+       v4l2_fh_init(&fh->fh, vdev);
        fh->dev = dev;
        fh->radio = radio;
        fh->type = fh_type;
@@ -1774,6 +1775,7 @@ static int em28xx_v4l2_open(struct file *filp)
                                    V4L2_FIELD_SEQ_TB,
                                    sizeof(struct em28xx_buffer), fh, &dev->lock);
        mutex_unlock(&dev->lock);
+       v4l2_fh_add(&fh->fh);
 
        return errCode;
 }
@@ -1867,6 +1869,8 @@ static int em28xx_v4l2_close(struct file *filp)
                                        "0 (error=%i)\n", errCode);
                }
        }
+       v4l2_fh_del(&fh->fh);
+       v4l2_fh_exit(&fh->fh);
 
        videobuf_mmap_free(&fh->vb_vidq);
        videobuf_mmap_free(&fh->vb_vbiq);
@@ -2088,6 +2092,7 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
        vfd->release    = video_device_release;
        vfd->debug      = video_debug;
        vfd->lock       = &dev->lock;
+       set_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
 
        snprintf(vfd->name, sizeof(vfd->name), "%s %s",
                 dev->name, type_name);
index 707319eabe2d7e476c396a173c73936026731b9f..7432be483c22a8f428039457d77355f770e1838a 100644 (file)
@@ -34,6 +34,7 @@
 #include <media/videobuf-vmalloc.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
+#include <media/v4l2-fh.h>
 #include <media/ir-kbd-i2c.h>
 #include <media/rc-core.h>
 #if defined(CONFIG_VIDEO_EM28XX_DVB) || defined(CONFIG_VIDEO_EM28XX_DVB_MODULE)
@@ -477,6 +478,7 @@ struct em28xx_audio {
 struct em28xx;
 
 struct em28xx_fh {
+       struct v4l2_fh fh;
        struct em28xx *dev;
        int           radio;
        unsigned int  resources;