]> err.no Git - linux-2.6/commitdiff
V4L/DVB (6292): videobuf_core init always require callback implementation
authorMauro Carvalho Chehab <mchehab@infradead.org>
Mon, 8 Oct 2007 15:20:02 +0000 (12:20 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 10 Oct 2007 03:03:14 +0000 (00:03 -0300)
In the past, videobuf_queue_init were used to initialize PCI DMA videobuffers.
This patch renames it, to avoid confusion with the previous kernel API, doing:
s/videobuf_queue_init/void videobuf_queue_core_init/

Also, the operations is now part of the function parameter. The function will
also add a test if this is defined, otherwise producing BUG.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/videobuf-core.c
drivers/media/video/videobuf-dma-sg.c
drivers/media/video/videobuf-vmalloc.c
include/media/videobuf-core.h

index aa402abc4b0ced8f9cc3a5f6ddef1f4ac4edb11d..f5c5ea8b6b0866f8632011b897c767507d9ebcab 100644 (file)
@@ -108,23 +108,25 @@ int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb,
 /* --------------------------------------------------------------------- */
 
 
-void videobuf_queue_init(struct videobuf_queue* q,
+void videobuf_queue_core_init(struct videobuf_queue* q,
                         struct videobuf_queue_ops *ops,
                         void *dev,
                         spinlock_t *irqlock,
                         enum v4l2_buf_type type,
                         enum v4l2_field field,
                         unsigned int msize,
-                        void *priv)
+                        void *priv,
+                        struct videobuf_qtype_ops *int_ops)
 {
        memset(q,0,sizeof(*q));
-       q->irqlock = irqlock;
-       q->dev     = dev;
-       q->type    = type;
-       q->field   = field;
-       q->msize   = msize;
-       q->ops     = ops;
+       q->irqlock   = irqlock;
+       q->dev       = dev;
+       q->type      = type;
+       q->field     = field;
+       q->msize     = msize;
+       q->ops       = ops;
        q->priv_data = priv;
+       q->int_ops   = int_ops;
 
        /* All buffer operations are mandatory */
        BUG_ON (!q->ops->buf_setup);
@@ -132,6 +134,9 @@ void videobuf_queue_init(struct videobuf_queue* q,
        BUG_ON (!q->ops->buf_queue);
        BUG_ON (!q->ops->buf_release);
 
+       /* Having implementations for abstract methods are mandatory */
+       BUG_ON (!q->int_ops);
+
        mutex_init(&q->lock);
        INIT_LIST_HEAD(&q->stream);
 }
@@ -966,7 +971,7 @@ EXPORT_SYMBOL_GPL(videobuf_iolock);
 
 EXPORT_SYMBOL_GPL(videobuf_alloc);
 
-EXPORT_SYMBOL_GPL(videobuf_queue_init);
+EXPORT_SYMBOL_GPL(videobuf_queue_core_init);
 EXPORT_SYMBOL_GPL(videobuf_queue_cancel);
 EXPORT_SYMBOL_GPL(videobuf_queue_is_busy);
 
index a38efe10feb48a6a270b5c2776cdc7a81ee32a28..8bb7fdd306d63d7c793066079a9e1ad1db9c570e 100644 (file)
@@ -695,8 +695,8 @@ void videobuf_queue_pci_init(struct videobuf_queue* q,
                         unsigned int msize,
                         void *priv)
 {
-       videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv);
-       q->int_ops=&pci_ops;
+       videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
+                                priv, &pci_ops);
 }
 
 /* --------------------------------------------------------------------- */
index c9d6ae0d3b49635659b100143c616157b0031ead..2e3689a12a28b4a150b58bedd70d346c4582e9bb 100644 (file)
@@ -333,8 +333,8 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
                         unsigned int msize,
                         void *priv)
 {
-       videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv);
-       q->int_ops=&qops;
+       videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
+                                priv, &qops);
 }
 
 EXPORT_SYMBOL_GPL(videobuf_queue_vmalloc_init);
index 9bae5a2eda66fdcd19ac19ba093310c912c91362..9fa09fb800a11d07c3913d319ac7a176a7ac8c28 100644 (file)
@@ -181,14 +181,15 @@ int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb,
 
 void *videobuf_alloc(struct videobuf_queue* q);
 
-void videobuf_queue_init(struct videobuf_queue *q,
+void videobuf_queue_core_init(struct videobuf_queue *q,
                         struct videobuf_queue_ops *ops,
                         void *dev,
                         spinlock_t *irqlock,
                         enum v4l2_buf_type type,
                         enum v4l2_field field,
                         unsigned int msize,
-                        void *priv);
+                        void *priv,
+                        struct videobuf_qtype_ops *int_ops);
 int  videobuf_queue_is_busy(struct videobuf_queue *q);
 void videobuf_queue_cancel(struct videobuf_queue *q);