V4L/DVB: videobuf: add ext_lock argument to the queue init functions
authorHans Verkuil <hverkuil@xs4all.nl>
Mon, 20 Sep 2010 20:39:46 +0000 (17:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:06:14 +0000 (01:06 -0200)
Add an ext_lock argument to the videobuf init functions. This allows
drivers to pass the vdev->lock pointer (or any other externally held lock)
to videobuf. For now all drivers just pass NULL.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
28 files changed:
drivers/media/common/saa7146_vbi.c
drivers/media/common/saa7146_video.c
drivers/media/video/au0828/au0828-video.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/cx231xx/cx231xx-video.c
drivers/media/video/cx23885/cx23885-417.c
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx23885/cx23885-video.c
drivers/media/video/cx88/cx88-blackbird.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/s2255drv.c
drivers/media/video/saa7134/saa7134-dvb.c
drivers/media/video/saa7134/saa7134-empress.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/videobuf-core.c
drivers/media/video/videobuf-dma-contig.c
drivers/media/video/videobuf-dma-sg.c
drivers/media/video/videobuf-vmalloc.c
drivers/media/video/vivi.c
drivers/media/video/zr364xx.c
drivers/staging/cx25821/cx25821-video.c
drivers/staging/tm6000/tm6000-video.c
include/media/videobuf-core.h
include/media/videobuf-dma-contig.h
include/media/videobuf-dma-sg.h
include/media/videobuf-vmalloc.h

index 8224c301d0508c2bea379dc953b96947a2838166..2d4533ab22b7918e457f0a0bdfeccb03eb1f3bbd 100644 (file)
@@ -412,7 +412,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
                            sizeof(struct saa7146_buf),
-                           file);
+                           file, NULL);
 
        init_timer(&fh->vbi_read_timeout);
        fh->vbi_read_timeout.function = vbi_read_timeout;
index a212a91a30f081ed59f80c4c0dd68562e7bdef00..741c5732b430613ff816da949ba3116a4f23c1c9 100644 (file)
@@ -1386,7 +1386,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct saa7146_buf),
-                           file);
+                           file, NULL);
 
        return 0;
 }
index 7989a7ba7c4005ecea648bce20f396c198e1ece7..162fd5f9d4482538244885a92c78820b68a0f71c 100644 (file)
@@ -965,7 +965,7 @@ static int au0828_v4l2_open(struct file *filp)
                                    NULL, &dev->slock,
                                    V4L2_BUF_TYPE_VIDEO_CAPTURE,
                                    V4L2_FIELD_INTERLACED,
-                                   sizeof(struct au0828_buffer), fh);
+                                   sizeof(struct au0828_buffer), fh, NULL);
 
        /* VBI Setup */
        dev->vbi_width = 720;
@@ -974,7 +974,7 @@ static int au0828_v4l2_open(struct file *filp)
                                    NULL, &dev->slock,
                                    V4L2_BUF_TYPE_VBI_CAPTURE,
                                    V4L2_FIELD_SEQ_TB,
-                                   sizeof(struct au0828_buffer), fh);
+                                   sizeof(struct au0828_buffer), fh, NULL);
 
 
        return ret;
index 69a8ad24c0b360ec9b3b96d8a5fda39bfd6164ab..3da6e80e1041358e594836fbd9b8146b4dfedb7d 100644 (file)
@@ -3318,13 +3318,13 @@ static int bttv_open(struct file *file)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct bttv_buffer),
-                           fh);
+                           fh, NULL);
        videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops,
                            &btv->c.pci->dev, &btv->s_lock,
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB,
                            sizeof(struct bttv_buffer),
-                           fh);
+                           fh, NULL);
        set_tvnorm(btv,btv->tvnorm);
        set_input(btv, btv->input, btv->tvnorm);
 
index e76014561aa782d0a22b725f079dadb2ef03bf58..b638c4ed3f2eed6598f9e7e10090f94acd07d0ac 100644 (file)
@@ -2008,7 +2008,8 @@ static int cx231xx_v4l2_open(struct file *filp)
                videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_video_qops,
                                            NULL, &dev->video_mode.slock,
                                            fh->type, V4L2_FIELD_INTERLACED,
-                                           sizeof(struct cx231xx_buffer), fh);
+                                           sizeof(struct cx231xx_buffer),
+                                           fh, NULL);
        if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
                /* Set the required alternate setting  VBI interface works in
                   Bulk mode only */
@@ -2017,7 +2018,8 @@ static int cx231xx_v4l2_open(struct file *filp)
                videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_vbi_qops,
                                            NULL, &dev->vbi_mode.slock,
                                            fh->type, V4L2_FIELD_SEQ_TB,
-                                           sizeof(struct cx231xx_buffer), fh);
+                                           sizeof(struct cx231xx_buffer),
+                                           fh, NULL);
        }
 
        mutex_unlock(&dev->lock);
index abd64e89f60f4222d0910b950b825c2393adb30a..6628e07a809382e04b50a8daa001c00e5021c1b4 100644 (file)
@@ -1591,7 +1591,7 @@ static int mpeg_open(struct file *file)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct cx23885_buffer),
-                           fh);
+                           fh, NULL);
        unlock_kernel();
 
        return 0;
index 0674ea1bf863d3d0e9225af192f2a0fa46f27440..5958cb882e939db4908aa44cdefef8d8cb3948fc 100644 (file)
@@ -1071,7 +1071,7 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
                videobuf_queue_sg_init(&fe0->dvb.dvbq, &dvb_qops,
                            &dev->pci->dev, &port->slock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP,
-                           sizeof(struct cx23885_buffer), port);
+                           sizeof(struct cx23885_buffer), port, NULL);
        }
        err = dvb_register(port);
        if (err != 0)
index 5aadc1d1956e73213cb95dae7aefd16e0aa4a887..3173cc69ac611a96c45987d95ff66cfb5a512195 100644 (file)
@@ -758,7 +758,7 @@ static int video_open(struct file *file)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct cx23885_buffer),
-                           fh);
+                           fh, NULL);
 
        dprintk(1, "post videobuf_queue_init()\n");
 
index ec329958543467feca3de13dffebf48bb345dbae..ac885f49313cd90a64afd1f3a22108183ed003a4 100644 (file)
@@ -1094,7 +1094,7 @@ static int mpeg_open(struct file *file)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct cx88_buffer),
-                           fh);
+                           fh, NULL);
 
        /* FIXME: locking against other video device */
        cx88_set_scale(dev->core, dev->width, dev->height,
index e24fd8d711d8ba26599c8444758ca0e6282dbd37..a037e925ceb976fbf906c38056ca305661475cbe 100644 (file)
@@ -1576,7 +1576,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
                                    V4L2_BUF_TYPE_VIDEO_CAPTURE,
                                    V4L2_FIELD_TOP,
                                    sizeof(struct cx88_buffer),
-                                   dev);
+                                   dev, NULL);
                /* init struct videobuf_dvb */
                fe->dvb.name = dev->core->name;
        }
index 2da9117b138e7d60aca406b877de5732642422cb..19c64a7d09855eeb4d55ca141fa846e8678d3bbe 100644 (file)
@@ -793,13 +793,13 @@ static int video_open(struct file *file)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct cx88_buffer),
-                           fh);
+                           fh, NULL);
        videobuf_queue_sg_init(&fh->vbiq, &cx8800_vbi_qops,
                            &dev->pci->dev, &dev->slock,
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB,
                            sizeof(struct cx88_buffer),
-                           fh);
+                           fh, NULL);
 
        if (fh->radio) {
                dprintk(1,"video_open: setting radio device\n");
index 95a4b60a1eda496ccef9f74a38399e131b28cfa8..a0627cdb706b486ec3b0e522fce9b293dc2038d4 100644 (file)
@@ -2182,13 +2182,13 @@ static int em28xx_v4l2_open(struct file *filp)
        videobuf_queue_vmalloc_init(&fh->vb_vidq, &em28xx_video_qops,
                                    NULL, &dev->slock,
                                    V4L2_BUF_TYPE_VIDEO_CAPTURE, field,
-                                   sizeof(struct em28xx_buffer), fh);
+                                   sizeof(struct em28xx_buffer), fh, NULL);
 
        videobuf_queue_vmalloc_init(&fh->vb_vbiq, &em28xx_vbi_qops,
                                    NULL, &dev->slock,
                                    V4L2_BUF_TYPE_VBI_CAPTURE,
                                    V4L2_FIELD_SEQ_TB,
-                                   sizeof(struct em28xx_buffer), fh);
+                                   sizeof(struct em28xx_buffer), fh, NULL);
 
        mutex_unlock(&dev->lock);
 
index 8f7434182bc3f9b57b1c1e0e85d5f296ca4d5dfe..f5a46c45871713df2eab2c0f43bccff5717fc05d 100644 (file)
@@ -1817,7 +1817,7 @@ static int s2255_open(struct file *file)
                                    NULL, &dev->slock,
                                    fh->type,
                                    V4L2_FIELD_INTERLACED,
-                                   sizeof(struct s2255_buffer), fh);
+                                   sizeof(struct s2255_buffer), fh, NULL);
        return 0;
 }
 
index f26fe7661a1df31a1ee0a7a6b67de864d5c111ad..beb95e21d1096937051823df0d88af1415dad933 100644 (file)
@@ -1111,7 +1111,7 @@ static int dvb_init(struct saa7134_dev *dev)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_ALTERNATE,
                            sizeof(struct saa7134_buf),
-                           dev);
+                           dev, NULL);
 
        switch (dev->board) {
        case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
index e763f9fd0133f06c1ebed3f4add1ac82dc30f166..1467a30a434fe29d677d3289d322e6d34a940cff 100644 (file)
@@ -542,7 +542,7 @@ static int empress_init(struct saa7134_dev *dev)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_ALTERNATE,
                            sizeof(struct saa7134_buf),
-                           dev);
+                           dev, NULL);
 
        empress_signal_update(&dev->empress_workqueue);
        return 0;
index 645224cfd887afed25cc949511d3e591cba88a31..fae5e97a3eb286c37623cb8ac75b2a9b28929806 100644 (file)
@@ -1366,13 +1366,13 @@ static int video_open(struct file *file)
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct saa7134_buf),
-                           fh);
+                           fh, NULL);
        videobuf_queue_sg_init(&fh->vbi, &saa7134_vbi_qops,
                            &dev->pci->dev, &dev->slock,
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB,
                            sizeof(struct saa7134_buf),
-                           fh);
+                           fh, NULL);
        saa7134_pgtable_alloc(dev->pci,&fh->pt_cap);
        saa7134_pgtable_alloc(dev->pci,&fh->pt_vbi);
 
index 2930665910b7a348096cdd92ae1d8ea4f3ca5d2b..a32ef8eafc0176669d1bd3f8644714b709bdbe7d 100644 (file)
@@ -125,11 +125,13 @@ void videobuf_queue_core_init(struct videobuf_queue *q,
                         enum v4l2_field field,
                         unsigned int msize,
                         void *priv,
-                        struct videobuf_qtype_ops *int_ops)
+                        struct videobuf_qtype_ops *int_ops,
+                        struct mutex *ext_lock)
 {
        BUG_ON(!q);
        memset(q, 0, sizeof(*q));
        q->irqlock   = irqlock;
+       q->ext_lock  = ext_lock;
        q->dev       = dev;
        q->type      = type;
        q->field     = field;
index 047054f79601427bf8cf549c5dda315e83f6431b..4d0a723b744b40be446f1ae6ee56b2fc22b48df7 100644 (file)
@@ -349,10 +349,11 @@ void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
                                    enum v4l2_buf_type type,
                                    enum v4l2_field field,
                                    unsigned int msize,
-                                   void *priv)
+                                   void *priv,
+                                   struct mutex *ext_lock)
 {
        videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
-                                priv, &qops);
+                                priv, &qops, ext_lock);
 }
 EXPORT_SYMBOL_GPL(videobuf_queue_dma_contig_init);
 
index 515ae887ffcf645c8d10d7c80acc7648f1d2a280..359f2f3fdc7779d307812a53c2694ed9e0be1bed 100644 (file)
@@ -654,10 +654,11 @@ void videobuf_queue_sg_init(struct videobuf_queue *q,
                         enum v4l2_buf_type type,
                         enum v4l2_field field,
                         unsigned int msize,
-                        void *priv)
+                        void *priv,
+                        struct mutex *ext_lock)
 {
        videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
-                                priv, &sg_ops);
+                                priv, &sg_ops, ext_lock);
 }
 EXPORT_SYMBOL_GPL(videobuf_queue_sg_init);
 
index 91348b3170ffaa35135b29ca3e398f97c1d4fcd9..df142580e44cfac0b9451411a43bcd461f572de0 100644 (file)
@@ -304,10 +304,11 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
                         enum v4l2_buf_type type,
                         enum v4l2_field field,
                         unsigned int msize,
-                        void *priv)
+                        void *priv,
+                        struct mutex *ext_lock)
 {
        videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
-                                priv, &qops);
+                                priv, &qops, ext_lock);
 }
 EXPORT_SYMBOL_GPL(videobuf_queue_vmalloc_init);
 
index e17b6fee046bb9ee616aadbade77dcbbfe32d315..547f5e546c9c66a5293e03a212c5103c89730f87 100644 (file)
@@ -1176,7 +1176,7 @@ static int __init vivi_create_instance(int inst)
        videobuf_queue_vmalloc_init(&dev->vb_vidq, &vivi_video_qops,
                        NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
                        V4L2_FIELD_INTERLACED,
-                       sizeof(struct vivi_buffer), dev);
+                       sizeof(struct vivi_buffer), dev, NULL);
 
        /* init video dma queues */
        INIT_LIST_HEAD(&dev->vidq.active);
index 616c61fb3493bd6ae7cfe761a50f1b5ed915ff40..7dfb01e9930ed1a67720e5ce8e33c1f580d4ec3e 100644 (file)
@@ -1304,7 +1304,7 @@ static int zr364xx_open(struct file *file)
                                    NULL, &cam->slock,
                                    cam->type,
                                    V4L2_FIELD_NONE,
-                                   sizeof(struct zr364xx_buffer), cam);
+                                   sizeof(struct zr364xx_buffer), cam, NULL);
 
        /* Added some delay here, since opening/closing the camera quickly,
         * like Ekiga does during its startup, can crash the webcam
index 6fff985358a6274afac71ce06e68679b45da9b2b..e7f1d5778cec3f7b4044d5675caddfb0ecd10f54 100644 (file)
@@ -856,7 +856,7 @@ static int video_open(struct file *file)
                              &dev->pci->dev, &dev->slock,
                              V4L2_BUF_TYPE_VIDEO_CAPTURE,
                              V4L2_FIELD_INTERLACED,
-                             sizeof(struct cx25821_buffer), fh);
+                             sizeof(struct cx25821_buffer), fh, NULL);
 
        dprintk(1, "post videobuf_queue_init()\n");
        unlock_kernel();
index ce0a089a07717a5ee5ce24ddeecd0c0789e4a8da..4c22c658494009ed197d4ca5891fd8e3078e5346 100644 (file)
@@ -1300,7 +1300,7 @@ static int tm6000_open(struct file *file)
                        NULL, &dev->slock,
                        fh->type,
                        V4L2_FIELD_INTERLACED,
-                       sizeof(struct tm6000_buffer),fh);
+                       sizeof(struct tm6000_buffer), fh, NULL);
 
        return 0;
 }
index f5eb2cbf300239166a1c5d4f35ea7ac402cc6715..9a4194557e4a499cdcefe0c6143825b54984d0c2 100644 (file)
@@ -198,7 +198,8 @@ void videobuf_queue_core_init(struct videobuf_queue *q,
                         enum v4l2_field field,
                         unsigned int msize,
                         void *priv,
-                        struct videobuf_qtype_ops *int_ops);
+                        struct videobuf_qtype_ops *int_ops,
+                        struct mutex *ext_lock);
 int  videobuf_queue_is_busy(struct videobuf_queue *q);
 void videobuf_queue_cancel(struct videobuf_queue *q);
 
index ebaa9bc1ee8d54666e577463c660d1dd81837253..f0ed82543d9fd41abcf6beb3091f87d53d66cab2 100644 (file)
@@ -23,7 +23,8 @@ void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
                                    enum v4l2_buf_type type,
                                    enum v4l2_field field,
                                    unsigned int msize,
-                                   void *priv);
+                                   void *priv,
+                                   struct mutex *ext_lock);
 
 dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf);
 void videobuf_dma_contig_free(struct videobuf_queue *q,
index aa4ebb42a5652b2261b1a2dbbbe133cbd5fbfe51..1c647e8148c48d9b208bb4e9218adb2f141785c8 100644 (file)
@@ -103,7 +103,8 @@ void videobuf_queue_sg_init(struct videobuf_queue *q,
                         enum v4l2_buf_type type,
                         enum v4l2_field field,
                         unsigned int msize,
-                        void *priv);
+                        void *priv,
+                        struct mutex *ext_lock);
 
 #endif /* _VIDEOBUF_DMA_SG_H */
 
index e19403c18dae59574b46a2dfd6952e78f2dcc56e..486a97efdb56e5024733ac244d1e9fd926ae6736 100644 (file)
@@ -36,7 +36,8 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
                         enum v4l2_buf_type type,
                         enum v4l2_field field,
                         unsigned int msize,
-                        void *priv);
+                        void *priv,
+                        struct mutex *ext_lock);
 
 void *videobuf_to_vmalloc(struct videobuf_buffer *buf);