aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-03-28 06:54:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:57:50 -0400
commit53aaf07637baae8f53c33b803bbc96047d8da1c4 (patch)
treee620ce3c28dae607e34a2b6bea0e4c0edc3cff4e /drivers/media/video
parent33435167e6dc9e23a97a494cec6b8ca47f8ded75 (diff)
V4L/DVB: v4l videobuf: remove mmap_free callback
Remove the mmap_free callback from struct videobuf_qtype_ops. All implementations of this callback do the same trivial check: return -EBUSY if any buffer is mmapped. That can also be tested in the videobuf core. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/videobuf-core.c10
-rw-r--r--drivers/media/video/videobuf-dma-contig.c14
-rw-r--r--drivers/media/video/videobuf-dma-sg.c15
-rw-r--r--drivers/media/video/videobuf-vmalloc.c16
4 files changed, 4 insertions, 51 deletions
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index 63d7043502d6..52bb74b18a68 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -311,20 +311,18 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
311static int __videobuf_mmap_free(struct videobuf_queue *q) 311static int __videobuf_mmap_free(struct videobuf_queue *q)
312{ 312{
313 int i; 313 int i;
314 int rc;
315 314
316 if (!q) 315 if (!q)
317 return 0; 316 return 0;
318 317
319 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); 318 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
320 319
321 rc = CALL(q, mmap_free, q); 320 for (i = 0; i < VIDEO_MAX_FRAME; i++)
321 if (q->bufs[i] && q->bufs[i]->map)
322 return -EBUSY;
322 323
323 q->is_mmapped = 0; 324 q->is_mmapped = 0;
324 325
325 if (rc < 0)
326 return rc;
327
328 for (i = 0; i < VIDEO_MAX_FRAME; i++) { 326 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
329 if (NULL == q->bufs[i]) 327 if (NULL == q->bufs[i])
330 continue; 328 continue;
@@ -333,7 +331,7 @@ static int __videobuf_mmap_free(struct videobuf_queue *q)
333 q->bufs[i] = NULL; 331 q->bufs[i] = NULL;
334 } 332 }
335 333
336 return rc; 334 return 0;
337} 335}
338 336
339int videobuf_mmap_free(struct videobuf_queue *q) 337int videobuf_mmap_free(struct videobuf_queue *q)
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c
index dce4f3aa4af1..0a32cf810c88 100644
--- a/drivers/media/video/videobuf-dma-contig.c
+++ b/drivers/media/video/videobuf-dma-contig.c
@@ -263,19 +263,6 @@ static int __videobuf_iolock(struct videobuf_queue *q,
263 return 0; 263 return 0;
264} 264}
265 265
266static int __videobuf_mmap_free(struct videobuf_queue *q)
267{
268 unsigned int i;
269
270 dev_dbg(q->dev, "%s\n", __func__);
271 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
272 if (q->bufs[i] && q->bufs[i]->map)
273 return -EBUSY;
274 }
275
276 return 0;
277}
278
279static int __videobuf_mmap_mapper(struct videobuf_queue *q, 266static int __videobuf_mmap_mapper(struct videobuf_queue *q,
280 struct vm_area_struct *vma) 267 struct vm_area_struct *vma)
281{ 268{
@@ -424,7 +411,6 @@ static struct videobuf_qtype_ops qops = {
424 411
425 .alloc = __videobuf_alloc, 412 .alloc = __videobuf_alloc,
426 .iolock = __videobuf_iolock, 413 .iolock = __videobuf_iolock,
427 .mmap_free = __videobuf_mmap_free,
428 .mmap_mapper = __videobuf_mmap_mapper, 414 .mmap_mapper = __videobuf_mmap_mapper,
429 .video_copy_to_user = __videobuf_copy_to_user, 415 .video_copy_to_user = __videobuf_copy_to_user,
430 .copy_stream = __videobuf_copy_stream, 416 .copy_stream = __videobuf_copy_stream,
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index c9d946a388e8..7ff275e30092 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -548,20 +548,6 @@ static int __videobuf_sync(struct videobuf_queue *q,
548 return videobuf_dma_sync(q, &mem->dma); 548 return videobuf_dma_sync(q, &mem->dma);
549} 549}
550 550
551static int __videobuf_mmap_free(struct videobuf_queue *q)
552{
553 int i;
554
555 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
556 if (q->bufs[i]) {
557 if (q->bufs[i]->map)
558 return -EBUSY;
559 }
560 }
561
562 return 0;
563}
564
565static int __videobuf_mmap_mapper(struct videobuf_queue *q, 551static int __videobuf_mmap_mapper(struct videobuf_queue *q,
566 struct vm_area_struct *vma) 552 struct vm_area_struct *vma)
567{ 553{
@@ -711,7 +697,6 @@ static struct videobuf_qtype_ops sg_ops = {
711 .alloc = __videobuf_alloc, 697 .alloc = __videobuf_alloc,
712 .iolock = __videobuf_iolock, 698 .iolock = __videobuf_iolock,
713 .sync = __videobuf_sync, 699 .sync = __videobuf_sync,
714 .mmap_free = __videobuf_mmap_free,
715 .mmap_mapper = __videobuf_mmap_mapper, 700 .mmap_mapper = __videobuf_mmap_mapper,
716 .video_copy_to_user = __videobuf_copy_to_user, 701 .video_copy_to_user = __videobuf_copy_to_user,
717 .copy_stream = __videobuf_copy_stream, 702 .copy_stream = __videobuf_copy_stream,
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c
index d6a8a38dc9cb..43c92882e4c5 100644
--- a/drivers/media/video/videobuf-vmalloc.c
+++ b/drivers/media/video/videobuf-vmalloc.c
@@ -235,21 +235,6 @@ static int __videobuf_sync(struct videobuf_queue *q,
235 return 0; 235 return 0;
236} 236}
237 237
238static int __videobuf_mmap_free(struct videobuf_queue *q)
239{
240 unsigned int i;
241
242 dprintk(1, "%s\n", __func__);
243 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
244 if (q->bufs[i]) {
245 if (q->bufs[i]->map)
246 return -EBUSY;
247 }
248 }
249
250 return 0;
251}
252
253static int __videobuf_mmap_mapper(struct videobuf_queue *q, 238static int __videobuf_mmap_mapper(struct videobuf_queue *q,
254 struct vm_area_struct *vma) 239 struct vm_area_struct *vma)
255{ 240{
@@ -385,7 +370,6 @@ static struct videobuf_qtype_ops qops = {
385 .alloc = __videobuf_alloc, 370 .alloc = __videobuf_alloc,
386 .iolock = __videobuf_iolock, 371 .iolock = __videobuf_iolock,
387 .sync = __videobuf_sync, 372 .sync = __videobuf_sync,
388 .mmap_free = __videobuf_mmap_free,
389 .mmap_mapper = __videobuf_mmap_mapper, 373 .mmap_mapper = __videobuf_mmap_mapper,
390 .video_copy_to_user = __videobuf_copy_to_user, 374 .video_copy_to_user = __videobuf_copy_to_user,
391 .copy_stream = __videobuf_copy_stream, 375 .copy_stream = __videobuf_copy_stream,