aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-10-08 11:20:02 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 23:03:14 -0400
commitd4cae5a50021271b9ef4e5e39e71e177d12fa8cb (patch)
tree75f3def69e6b35fc02e46af5661bb45aa006ba9d
parentd5f1b01644b6fd5e9eb480a4762cd6b569cb1246 (diff)
V4L/DVB (6292): videobuf_core init always require callback implementation
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>
-rw-r--r--drivers/media/video/videobuf-core.c23
-rw-r--r--drivers/media/video/videobuf-dma-sg.c4
-rw-r--r--drivers/media/video/videobuf-vmalloc.c4
-rw-r--r--include/media/videobuf-core.h5
4 files changed, 21 insertions, 15 deletions
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index aa402abc4b0c..f5c5ea8b6b08 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -108,23 +108,25 @@ int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb,
108/* --------------------------------------------------------------------- */ 108/* --------------------------------------------------------------------- */
109 109
110 110
111void videobuf_queue_init(struct videobuf_queue* q, 111void videobuf_queue_core_init(struct videobuf_queue* q,
112 struct videobuf_queue_ops *ops, 112 struct videobuf_queue_ops *ops,
113 void *dev, 113 void *dev,
114 spinlock_t *irqlock, 114 spinlock_t *irqlock,
115 enum v4l2_buf_type type, 115 enum v4l2_buf_type type,
116 enum v4l2_field field, 116 enum v4l2_field field,
117 unsigned int msize, 117 unsigned int msize,
118 void *priv) 118 void *priv,
119 struct videobuf_qtype_ops *int_ops)
119{ 120{
120 memset(q,0,sizeof(*q)); 121 memset(q,0,sizeof(*q));
121 q->irqlock = irqlock; 122 q->irqlock = irqlock;
122 q->dev = dev; 123 q->dev = dev;
123 q->type = type; 124 q->type = type;
124 q->field = field; 125 q->field = field;
125 q->msize = msize; 126 q->msize = msize;
126 q->ops = ops; 127 q->ops = ops;
127 q->priv_data = priv; 128 q->priv_data = priv;
129 q->int_ops = int_ops;
128 130
129 /* All buffer operations are mandatory */ 131 /* All buffer operations are mandatory */
130 BUG_ON (!q->ops->buf_setup); 132 BUG_ON (!q->ops->buf_setup);
@@ -132,6 +134,9 @@ void videobuf_queue_init(struct videobuf_queue* q,
132 BUG_ON (!q->ops->buf_queue); 134 BUG_ON (!q->ops->buf_queue);
133 BUG_ON (!q->ops->buf_release); 135 BUG_ON (!q->ops->buf_release);
134 136
137 /* Having implementations for abstract methods are mandatory */
138 BUG_ON (!q->int_ops);
139
135 mutex_init(&q->lock); 140 mutex_init(&q->lock);
136 INIT_LIST_HEAD(&q->stream); 141 INIT_LIST_HEAD(&q->stream);
137} 142}
@@ -966,7 +971,7 @@ EXPORT_SYMBOL_GPL(videobuf_iolock);
966 971
967EXPORT_SYMBOL_GPL(videobuf_alloc); 972EXPORT_SYMBOL_GPL(videobuf_alloc);
968 973
969EXPORT_SYMBOL_GPL(videobuf_queue_init); 974EXPORT_SYMBOL_GPL(videobuf_queue_core_init);
970EXPORT_SYMBOL_GPL(videobuf_queue_cancel); 975EXPORT_SYMBOL_GPL(videobuf_queue_cancel);
971EXPORT_SYMBOL_GPL(videobuf_queue_is_busy); 976EXPORT_SYMBOL_GPL(videobuf_queue_is_busy);
972 977
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index a38efe10feb4..8bb7fdd306d6 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -695,8 +695,8 @@ void videobuf_queue_pci_init(struct videobuf_queue* q,
695 unsigned int msize, 695 unsigned int msize,
696 void *priv) 696 void *priv)
697{ 697{
698 videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv); 698 videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
699 q->int_ops=&pci_ops; 699 priv, &pci_ops);
700} 700}
701 701
702/* --------------------------------------------------------------------- */ 702/* --------------------------------------------------------------------- */
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c
index c9d6ae0d3b49..2e3689a12a28 100644
--- a/drivers/media/video/videobuf-vmalloc.c
+++ b/drivers/media/video/videobuf-vmalloc.c
@@ -333,8 +333,8 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
333 unsigned int msize, 333 unsigned int msize,
334 void *priv) 334 void *priv)
335{ 335{
336 videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv); 336 videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize,
337 q->int_ops=&qops; 337 priv, &qops);
338} 338}
339 339
340EXPORT_SYMBOL_GPL(videobuf_queue_vmalloc_init); 340EXPORT_SYMBOL_GPL(videobuf_queue_vmalloc_init);
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 9bae5a2eda66..9fa09fb800a1 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -181,14 +181,15 @@ int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb,
181 181
182void *videobuf_alloc(struct videobuf_queue* q); 182void *videobuf_alloc(struct videobuf_queue* q);
183 183
184void videobuf_queue_init(struct videobuf_queue *q, 184void videobuf_queue_core_init(struct videobuf_queue *q,
185 struct videobuf_queue_ops *ops, 185 struct videobuf_queue_ops *ops,
186 void *dev, 186 void *dev,
187 spinlock_t *irqlock, 187 spinlock_t *irqlock,
188 enum v4l2_buf_type type, 188 enum v4l2_buf_type type,
189 enum v4l2_field field, 189 enum v4l2_field field,
190 unsigned int msize, 190 unsigned int msize,
191 void *priv); 191 void *priv,
192 struct videobuf_qtype_ops *int_ops);
192int videobuf_queue_is_busy(struct videobuf_queue *q); 193int videobuf_queue_is_busy(struct videobuf_queue *q);
193void videobuf_queue_cancel(struct videobuf_queue *q); 194void videobuf_queue_cancel(struct videobuf_queue *q);
194 195