diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-12-13 11:30:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:03:38 -0500 |
commit | 6c2f990105acd360e83b95b41c60ed8bf25e67fe (patch) | |
tree | 709368e838293be4bd1465692fa5ab6174ac3212 | |
parent | 1fe934ddfc8e6e5663c0308ae216219be87b8d4f (diff) |
V4L/DVB (6815): Fix vivi internal debug messages
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/vivi.c | 109 |
1 files changed, 67 insertions, 42 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 889e6611e039..0346d1af3e62 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -54,7 +54,6 @@ | |||
54 | 54 | ||
55 | /* Declare static vars that will be used as parameters */ | 55 | /* Declare static vars that will be used as parameters */ |
56 | static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ | 56 | static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ |
57 | static struct video_device vivi; /* Video device */ | ||
58 | static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ | 57 | static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ |
59 | static int n_devs = 1; /* Number of virtual devices */ | 58 | static int n_devs = 1; /* Number of virtual devices */ |
60 | 59 | ||
@@ -110,9 +109,9 @@ static struct v4l2_queryctrl vivi_qctrl[] = { | |||
110 | 109 | ||
111 | static int qctl_regs[ARRAY_SIZE(vivi_qctrl)]; | 110 | static int qctl_regs[ARRAY_SIZE(vivi_qctrl)]; |
112 | 111 | ||
113 | #define dprintk(level, fmt, arg...) \ | 112 | #define dprintk(dev, level, fmt, arg...) \ |
114 | do { \ | 113 | do { \ |
115 | if (vivi.debug >= (level)) \ | 114 | if (dev->vfd->debug >= (level)) \ |
116 | printk(KERN_DEBUG "vivi: " fmt , ## arg); \ | 115 | printk(KERN_DEBUG "vivi: " fmt , ## arg); \ |
117 | } while (0) | 116 | } while (0) |
118 | 117 | ||
@@ -338,7 +337,7 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf) | |||
338 | dev->timestr); | 337 | dev->timestr); |
339 | /* FIXME: replacing to __copy_to_user */ | 338 | /* FIXME: replacing to __copy_to_user */ |
340 | if (copy_to_user(vbuf + pos, tmpbuf, wmax * 2) != 0) | 339 | if (copy_to_user(vbuf + pos, tmpbuf, wmax * 2) != 0) |
341 | dprintk(2, "vivifill copy_to_user failed.\n"); | 340 | dprintk(dev, 2, "vivifill copy_to_user failed.\n"); |
342 | pos += wmax*2; | 341 | pos += wmax*2; |
343 | } | 342 | } |
344 | 343 | ||
@@ -367,8 +366,8 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf) | |||
367 | sprintf(dev->timestr, "%02d:%02d:%02d:%03d", | 366 | sprintf(dev->timestr, "%02d:%02d:%02d:%03d", |
368 | dev->h, dev->m, dev->s, (dev->us + 500) / 1000); | 367 | dev->h, dev->m, dev->s, (dev->us + 500) / 1000); |
369 | 368 | ||
370 | dprintk(2, "vivifill at %s: Buffer 0x%08lx size= %d\n", dev->timestr, | 369 | dprintk(dev, 2, "vivifill at %s: Buffer 0x%08lx size= %d\n", |
371 | (unsigned long)tmpbuf, pos); | 370 | dev->timestr, (unsigned long)tmpbuf, pos); |
372 | 371 | ||
373 | /* Advice that buffer was filled */ | 372 | /* Advice that buffer was filled */ |
374 | buf->vb.state = VIDEOBUF_DONE; | 373 | buf->vb.state = VIDEOBUF_DONE; |
@@ -392,7 +391,7 @@ static void vivi_thread_tick(struct vivi_dmaqueue *dma_q) | |||
392 | /* Announces videobuf that all went ok */ | 391 | /* Announces videobuf that all went ok */ |
393 | for (bc = 0;; bc++) { | 392 | for (bc = 0;; bc++) { |
394 | if (list_empty(&dma_q->active)) { | 393 | if (list_empty(&dma_q->active)) { |
395 | dprintk(1, "No active queue to serve\n"); | 394 | dprintk(dev, 1, "No active queue to serve\n"); |
396 | break; | 395 | break; |
397 | } | 396 | } |
398 | 397 | ||
@@ -406,7 +405,7 @@ static void vivi_thread_tick(struct vivi_dmaqueue *dma_q) | |||
406 | } | 405 | } |
407 | 406 | ||
408 | do_gettimeofday(&buf->vb.ts); | 407 | do_gettimeofday(&buf->vb.ts); |
409 | dprintk(2, "[%p/%d] wakeup\n", buf, buf->vb. i); | 408 | dprintk(dev, 2, "[%p/%d] wakeup\n", buf, buf->vb. i); |
410 | 409 | ||
411 | /* Fill buffer */ | 410 | /* Fill buffer */ |
412 | vivi_fillbuff(dev, buf); | 411 | vivi_fillbuff(dev, buf); |
@@ -418,16 +417,18 @@ static void vivi_thread_tick(struct vivi_dmaqueue *dma_q) | |||
418 | } | 417 | } |
419 | } | 418 | } |
420 | if (bc != 1) | 419 | if (bc != 1) |
421 | dprintk(1, "%s: %d buffers handled (should be 1)\n", | 420 | dprintk(dev, 1, "%s: %d buffers handled (should be 1)\n", |
422 | __FUNCTION__, bc); | 421 | __FUNCTION__, bc); |
423 | } | 422 | } |
424 | 423 | ||
425 | static void vivi_sleep(struct vivi_dmaqueue *dma_q) | 424 | static void vivi_sleep(struct vivi_dmaqueue *dma_q) |
426 | { | 425 | { |
426 | struct vivi_dev *dev = container_of(dma_q, struct vivi_dev, vidq); | ||
427 | int timeout; | 427 | int timeout; |
428 | DECLARE_WAITQUEUE(wait, current); | 428 | DECLARE_WAITQUEUE(wait, current); |
429 | 429 | ||
430 | dprintk(1, "%s dma_q=0x%08lx\n", __FUNCTION__, (unsigned long)dma_q); | 430 | dprintk(dev, 1, "%s dma_q=0x%08lx\n", __FUNCTION__, |
431 | (unsigned long)dma_q); | ||
431 | 432 | ||
432 | add_wait_queue(&dma_q->wq, &wait); | 433 | add_wait_queue(&dma_q->wq, &wait); |
433 | if (!kthread_should_stop()) { | 434 | if (!kthread_should_stop()) { |
@@ -450,11 +451,12 @@ static void vivi_sleep(struct vivi_dmaqueue *dma_q) | |||
450 | WAKE_NUMERATOR * 1000) | 451 | WAKE_NUMERATOR * 1000) |
451 | / WAKE_DENOMINATOR) - jiffies; | 452 | / WAKE_DENOMINATOR) - jiffies; |
452 | 453 | ||
453 | dprintk(1, "underrun, losed %d frames. " | 454 | dprintk(dev, 1, "underrun, losed %d frames. " |
454 | "Now, frame is %d. Waking on %d jiffies\n", | 455 | "Now, frame is %d. Waking on %d jiffies\n", |
455 | dma_q->frame-old, dma_q->frame, timeout); | 456 | dma_q->frame-old, dma_q->frame, timeout); |
456 | } else | 457 | } else |
457 | dprintk(1, "will sleep for %i jiffies\n", timeout); | 458 | dprintk(dev, 1, "will sleep for %i jiffies\n", |
459 | timeout); | ||
458 | 460 | ||
459 | vivi_thread_tick(dma_q); | 461 | vivi_thread_tick(dma_q); |
460 | 462 | ||
@@ -468,8 +470,9 @@ static void vivi_sleep(struct vivi_dmaqueue *dma_q) | |||
468 | static int vivi_thread(void *data) | 470 | static int vivi_thread(void *data) |
469 | { | 471 | { |
470 | struct vivi_dmaqueue *dma_q = data; | 472 | struct vivi_dmaqueue *dma_q = data; |
473 | struct vivi_dev *dev = container_of(dma_q, struct vivi_dev, vidq); | ||
471 | 474 | ||
472 | dprintk(1, "thread started\n"); | 475 | dprintk(dev, 1, "thread started\n"); |
473 | 476 | ||
474 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | 477 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); |
475 | set_freezable(); | 478 | set_freezable(); |
@@ -480,16 +483,18 @@ static int vivi_thread(void *data) | |||
480 | if (kthread_should_stop()) | 483 | if (kthread_should_stop()) |
481 | break; | 484 | break; |
482 | } | 485 | } |
483 | dprintk(1, "thread: exit\n"); | 486 | dprintk(dev, 1, "thread: exit\n"); |
484 | return 0; | 487 | return 0; |
485 | } | 488 | } |
486 | 489 | ||
487 | static int vivi_start_thread(struct vivi_dmaqueue *dma_q) | 490 | static int vivi_start_thread(struct vivi_dmaqueue *dma_q) |
488 | { | 491 | { |
492 | struct vivi_dev *dev = container_of(dma_q, struct vivi_dev, vidq); | ||
493 | |||
489 | dma_q->frame = 0; | 494 | dma_q->frame = 0; |
490 | dma_q->ini_jiffies = jiffies; | 495 | dma_q->ini_jiffies = jiffies; |
491 | 496 | ||
492 | dprintk(1, "%s\n", __FUNCTION__); | 497 | dprintk(dev, 1, "%s\n", __FUNCTION__); |
493 | 498 | ||
494 | dma_q->kthread = kthread_run(vivi_thread, dma_q, "vivi"); | 499 | dma_q->kthread = kthread_run(vivi_thread, dma_q, "vivi"); |
495 | 500 | ||
@@ -500,13 +505,15 @@ static int vivi_start_thread(struct vivi_dmaqueue *dma_q) | |||
500 | /* Wakes thread */ | 505 | /* Wakes thread */ |
501 | wake_up_interruptible(&dma_q->wq); | 506 | wake_up_interruptible(&dma_q->wq); |
502 | 507 | ||
503 | dprintk(1, "returning from %s\n", __FUNCTION__); | 508 | dprintk(dev, 1, "returning from %s\n", __FUNCTION__); |
504 | return 0; | 509 | return 0; |
505 | } | 510 | } |
506 | 511 | ||
507 | static void vivi_stop_thread(struct vivi_dmaqueue *dma_q) | 512 | static void vivi_stop_thread(struct vivi_dmaqueue *dma_q) |
508 | { | 513 | { |
509 | dprintk(1, "%s\n", __FUNCTION__); | 514 | struct vivi_dev *dev = container_of(dma_q, struct vivi_dev, vidq); |
515 | |||
516 | dprintk(dev, 1, "%s\n", __FUNCTION__); | ||
510 | /* shutdown control thread */ | 517 | /* shutdown control thread */ |
511 | if (dma_q->kthread) { | 518 | if (dma_q->kthread) { |
512 | kthread_stop(dma_q->kthread); | 519 | kthread_stop(dma_q->kthread); |
@@ -516,17 +523,19 @@ static void vivi_stop_thread(struct vivi_dmaqueue *dma_q) | |||
516 | 523 | ||
517 | static int restart_video_queue(struct vivi_dmaqueue *dma_q) | 524 | static int restart_video_queue(struct vivi_dmaqueue *dma_q) |
518 | { | 525 | { |
526 | struct vivi_dev *dev = container_of(dma_q, struct vivi_dev, vidq); | ||
519 | struct vivi_buffer *buf, *prev; | 527 | struct vivi_buffer *buf, *prev; |
520 | 528 | ||
521 | dprintk(1, "%s dma_q=0x%08lx\n", __FUNCTION__, (unsigned long)dma_q); | 529 | dprintk(dev, 1, "%s dma_q=0x%08lx\n", __FUNCTION__, |
530 | (unsigned long)dma_q); | ||
522 | 531 | ||
523 | if (!list_empty(&dma_q->active)) { | 532 | if (!list_empty(&dma_q->active)) { |
524 | buf = list_entry(dma_q->active.next, | 533 | buf = list_entry(dma_q->active.next, |
525 | struct vivi_buffer, vb.queue); | 534 | struct vivi_buffer, vb.queue); |
526 | dprintk(2, "restart_queue [%p/%d]: restart dma\n", | 535 | dprintk(dev, 2, "restart_queue [%p/%d]: restart dma\n", |
527 | buf, buf->vb.i); | 536 | buf, buf->vb.i); |
528 | 537 | ||
529 | dprintk(1, "Restarting video dma\n"); | 538 | dprintk(dev, 1, "Restarting video dma\n"); |
530 | vivi_stop_thread(dma_q); | 539 | vivi_stop_thread(dma_q); |
531 | 540 | ||
532 | /* cancel all outstanding capture / vbi requests */ | 541 | /* cancel all outstanding capture / vbi requests */ |
@@ -550,13 +559,14 @@ static int restart_video_queue(struct vivi_dmaqueue *dma_q) | |||
550 | list_del(&buf->vb.queue); | 559 | list_del(&buf->vb.queue); |
551 | list_add_tail(&buf->vb.queue, &dma_q->active); | 560 | list_add_tail(&buf->vb.queue, &dma_q->active); |
552 | 561 | ||
553 | dprintk(1, "Restarting video dma\n"); | 562 | dprintk(dev, 1, "Restarting video dma\n"); |
554 | vivi_stop_thread(dma_q); | 563 | vivi_stop_thread(dma_q); |
555 | vivi_start_thread(dma_q); | 564 | vivi_start_thread(dma_q); |
556 | 565 | ||
557 | buf->vb.state = VIDEOBUF_ACTIVE; | 566 | buf->vb.state = VIDEOBUF_ACTIVE; |
558 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | 567 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); |
559 | dprintk(2, "[%p/%d] restart_queue - first active\n", | 568 | dprintk(dev, 2, |
569 | "[%p/%d] restart_queue - first active\n", | ||
560 | buf, buf->vb.i); | 570 | buf, buf->vb.i); |
561 | 571 | ||
562 | } else if (prev->vb.width == buf->vb.width && | 572 | } else if (prev->vb.width == buf->vb.width && |
@@ -565,7 +575,8 @@ static int restart_video_queue(struct vivi_dmaqueue *dma_q) | |||
565 | list_del(&buf->vb.queue); | 575 | list_del(&buf->vb.queue); |
566 | list_add_tail(&buf->vb.queue, &dma_q->active); | 576 | list_add_tail(&buf->vb.queue, &dma_q->active); |
567 | buf->vb.state = VIDEOBUF_ACTIVE; | 577 | buf->vb.state = VIDEOBUF_ACTIVE; |
568 | dprintk(2, "[%p/%d] restart_queue - move to active\n", | 578 | dprintk(dev, 2, |
579 | "[%p/%d] restart_queue - move to active\n", | ||
569 | buf, buf->vb.i); | 580 | buf, buf->vb.i); |
570 | } else { | 581 | } else { |
571 | return 0; | 582 | return 0; |
@@ -598,7 +609,8 @@ static void vivi_vid_timeout(unsigned long data) | |||
598 | static int | 609 | static int |
599 | buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) | 610 | buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) |
600 | { | 611 | { |
601 | struct vivi_fh *fh = vq->priv_data; | 612 | struct vivi_fh *fh = vq->priv_data; |
613 | struct vivi_dev *dev = fh->dev; | ||
602 | 614 | ||
603 | *size = fh->width*fh->height*2; | 615 | *size = fh->width*fh->height*2; |
604 | 616 | ||
@@ -608,14 +620,18 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) | |||
608 | while (*size * *count > vid_limit * 1024 * 1024) | 620 | while (*size * *count > vid_limit * 1024 * 1024) |
609 | (*count)--; | 621 | (*count)--; |
610 | 622 | ||
611 | dprintk(1, "%s, count=%d, size=%d\n", __FUNCTION__, *count, *size); | 623 | dprintk(dev, 1, "%s, count=%d, size=%d\n", __FUNCTION__, |
624 | *count, *size); | ||
612 | 625 | ||
613 | return 0; | 626 | return 0; |
614 | } | 627 | } |
615 | 628 | ||
616 | static void free_buffer(struct videobuf_queue *vq, struct vivi_buffer *buf) | 629 | static void free_buffer(struct videobuf_queue *vq, struct vivi_buffer *buf) |
617 | { | 630 | { |
618 | dprintk(1, "%s\n", __FUNCTION__); | 631 | struct vivi_fh *fh = vq->priv_data; |
632 | struct vivi_dev *dev = fh->dev; | ||
633 | |||
634 | dprintk(dev, 1, "%s\n", __FUNCTION__); | ||
619 | 635 | ||
620 | if (in_interrupt()) | 636 | if (in_interrupt()) |
621 | BUG(); | 637 | BUG(); |
@@ -632,10 +648,11 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
632 | enum v4l2_field field) | 648 | enum v4l2_field field) |
633 | { | 649 | { |
634 | struct vivi_fh *fh = vq->priv_data; | 650 | struct vivi_fh *fh = vq->priv_data; |
651 | struct vivi_dev *dev = fh->dev; | ||
635 | struct vivi_buffer *buf = container_of(vb, struct vivi_buffer, vb); | 652 | struct vivi_buffer *buf = container_of(vb, struct vivi_buffer, vb); |
636 | int rc, init_buffer = 0; | 653 | int rc, init_buffer = 0; |
637 | 654 | ||
638 | dprintk(1, "%s, field=%d\n", __FUNCTION__, field); | 655 | dprintk(dev, 1, "%s, field=%d\n", __FUNCTION__, field); |
639 | 656 | ||
640 | BUG_ON(NULL == fh->fmt); | 657 | BUG_ON(NULL == fh->fmt); |
641 | if (fh->width < 48 || fh->width > norm_maxw() || | 658 | if (fh->width < 48 || fh->width > norm_maxw() || |
@@ -681,18 +698,18 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
681 | struct vivi_buffer *prev; | 698 | struct vivi_buffer *prev; |
682 | 699 | ||
683 | if (!list_empty(&vidq->queued)) { | 700 | if (!list_empty(&vidq->queued)) { |
684 | dprintk(1, "adding vb queue=0x%08lx\n", | 701 | dprintk(dev, 1, "adding vb queue=0x%08lx\n", |
685 | (unsigned long)&buf->vb.queue); | 702 | (unsigned long)&buf->vb.queue); |
686 | list_add_tail(&buf->vb.queue, &vidq->queued); | 703 | list_add_tail(&buf->vb.queue, &vidq->queued); |
687 | buf->vb.state = VIDEOBUF_QUEUED; | 704 | buf->vb.state = VIDEOBUF_QUEUED; |
688 | dprintk(2, "[%p/%d] buffer_queue - append to queued\n", | 705 | dprintk(dev, 2, "[%p/%d] buffer_queue - append to queued\n", |
689 | buf, buf->vb.i); | 706 | buf, buf->vb.i); |
690 | } else if (list_empty(&vidq->active)) { | 707 | } else if (list_empty(&vidq->active)) { |
691 | list_add_tail(&buf->vb.queue, &vidq->active); | 708 | list_add_tail(&buf->vb.queue, &vidq->active); |
692 | 709 | ||
693 | buf->vb.state = VIDEOBUF_ACTIVE; | 710 | buf->vb.state = VIDEOBUF_ACTIVE; |
694 | mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT); | 711 | mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT); |
695 | dprintk(2, "[%p/%d] buffer_queue - first active\n", | 712 | dprintk(dev, 2, "[%p/%d] buffer_queue - first active\n", |
696 | buf, buf->vb.i); | 713 | buf, buf->vb.i); |
697 | 714 | ||
698 | vivi_start_thread(vidq); | 715 | vivi_start_thread(vidq); |
@@ -704,13 +721,15 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
704 | prev->fmt == buf->fmt) { | 721 | prev->fmt == buf->fmt) { |
705 | list_add_tail(&buf->vb.queue, &vidq->active); | 722 | list_add_tail(&buf->vb.queue, &vidq->active); |
706 | buf->vb.state = VIDEOBUF_ACTIVE; | 723 | buf->vb.state = VIDEOBUF_ACTIVE; |
707 | dprintk(2, "[%p/%d] buffer_queue - append to active\n", | 724 | dprintk(dev, 2, |
725 | "[%p/%d] buffer_queue - append to active\n", | ||
708 | buf, buf->vb.i); | 726 | buf, buf->vb.i); |
709 | 727 | ||
710 | } else { | 728 | } else { |
711 | list_add_tail(&buf->vb.queue, &vidq->queued); | 729 | list_add_tail(&buf->vb.queue, &vidq->queued); |
712 | buf->vb.state = VIDEOBUF_QUEUED; | 730 | buf->vb.state = VIDEOBUF_QUEUED; |
713 | dprintk(2, "[%p/%d] buffer_queue - first queued\n", | 731 | dprintk(dev, 2, |
732 | "[%p/%d] buffer_queue - first queued\n", | ||
714 | buf, buf->vb.i); | 733 | buf, buf->vb.i); |
715 | } | 734 | } |
716 | } | 735 | } |
@@ -724,7 +743,7 @@ static void buffer_release(struct videobuf_queue *vq, | |||
724 | struct vivi_dev *dev = (struct vivi_dev *)fh->dev; | 743 | struct vivi_dev *dev = (struct vivi_dev *)fh->dev; |
725 | struct vivi_dmaqueue *vidq = &dev->vidq; | 744 | struct vivi_dmaqueue *vidq = &dev->vidq; |
726 | 745 | ||
727 | dprintk(1, "%s\n", __FUNCTION__); | 746 | dprintk(dev, 1, "%s\n", __FUNCTION__); |
728 | 747 | ||
729 | vivi_stop_thread(vidq); | 748 | vivi_stop_thread(vidq); |
730 | 749 | ||
@@ -784,13 +803,16 @@ static int vidioc_g_fmt_cap(struct file *file, void *priv, | |||
784 | static int vidioc_try_fmt_cap(struct file *file, void *priv, | 803 | static int vidioc_try_fmt_cap(struct file *file, void *priv, |
785 | struct v4l2_format *f) | 804 | struct v4l2_format *f) |
786 | { | 805 | { |
806 | struct vivi_fh *fh = priv; | ||
807 | struct vivi_dev *dev = fh->dev; | ||
787 | struct vivi_fmt *fmt; | 808 | struct vivi_fmt *fmt; |
788 | enum v4l2_field field; | 809 | enum v4l2_field field; |
789 | unsigned int maxw, maxh; | 810 | unsigned int maxw, maxh; |
790 | 811 | ||
791 | if (format.fourcc != f->fmt.pix.pixelformat) { | 812 | if (format.fourcc != f->fmt.pix.pixelformat) { |
792 | dprintk(1, "Fourcc format (0x%08x) invalid. Driver accepts " | 813 | dprintk(dev, 1, "Fourcc format (0x%08x) invalid. " |
793 | "only 0x%08x\n", f->fmt.pix.pixelformat, format.fourcc); | 814 | "Driver accepts only 0x%08x\n", |
815 | f->fmt.pix.pixelformat, format.fourcc); | ||
794 | return -EINVAL; | 816 | return -EINVAL; |
795 | } | 817 | } |
796 | fmt = &format; | 818 | fmt = &format; |
@@ -800,7 +822,7 @@ static int vidioc_try_fmt_cap(struct file *file, void *priv, | |||
800 | if (field == V4L2_FIELD_ANY) { | 822 | if (field == V4L2_FIELD_ANY) { |
801 | field = V4L2_FIELD_INTERLACED; | 823 | field = V4L2_FIELD_INTERLACED; |
802 | } else if (V4L2_FIELD_INTERLACED != field) { | 824 | } else if (V4L2_FIELD_INTERLACED != field) { |
803 | dprintk(1, "Field type invalid.\n"); | 825 | dprintk(dev, 1, "Field type invalid.\n"); |
804 | return -EINVAL; | 826 | return -EINVAL; |
805 | } | 827 | } |
806 | 828 | ||
@@ -1009,7 +1031,7 @@ found: | |||
1009 | /* If more than one user, mutex should be added */ | 1031 | /* If more than one user, mutex should be added */ |
1010 | dev->users++; | 1032 | dev->users++; |
1011 | 1033 | ||
1012 | dprintk(1, "open minor=%d type=%s users=%d\n", minor, | 1034 | dprintk(dev, 1, "open minor=%d type=%s users=%d\n", minor, |
1013 | v4l2_type_names[V4L2_BUF_TYPE_VIDEO_CAPTURE], dev->users); | 1035 | v4l2_type_names[V4L2_BUF_TYPE_VIDEO_CAPTURE], dev->users); |
1014 | 1036 | ||
1015 | /* allocate + initialize per filehandle data */ | 1037 | /* allocate + initialize per filehandle data */ |
@@ -1064,9 +1086,10 @@ static unsigned int | |||
1064 | vivi_poll(struct file *file, struct poll_table_struct *wait) | 1086 | vivi_poll(struct file *file, struct poll_table_struct *wait) |
1065 | { | 1087 | { |
1066 | struct vivi_fh *fh = file->private_data; | 1088 | struct vivi_fh *fh = file->private_data; |
1089 | struct vivi_dev *dev = fh->dev; | ||
1067 | struct videobuf_queue *q = &fh->vb_vidq; | 1090 | struct videobuf_queue *q = &fh->vb_vidq; |
1068 | 1091 | ||
1069 | dprintk(1, "%s\n", __FUNCTION__); | 1092 | dprintk(dev, 1, "%s\n", __FUNCTION__); |
1070 | 1093 | ||
1071 | if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) | 1094 | if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) |
1072 | return POLLERR; | 1095 | return POLLERR; |
@@ -1090,7 +1113,8 @@ static int vivi_close(struct inode *inode, struct file *file) | |||
1090 | 1113 | ||
1091 | dev->users--; | 1114 | dev->users--; |
1092 | 1115 | ||
1093 | dprintk(1, "close called (minor=%d, users=%d)\n", minor, dev->users); | 1116 | dprintk(dev, 1, "close called (minor=%d, users=%d)\n", |
1117 | minor, dev->users); | ||
1094 | 1118 | ||
1095 | return 0; | 1119 | return 0; |
1096 | } | 1120 | } |
@@ -1118,14 +1142,15 @@ static int vivi_release(void) | |||
1118 | 1142 | ||
1119 | static int vivi_mmap(struct file *file, struct vm_area_struct *vma) | 1143 | static int vivi_mmap(struct file *file, struct vm_area_struct *vma) |
1120 | { | 1144 | { |
1121 | struct vivi_fh *fh = file->private_data; | 1145 | struct vivi_fh *fh = file->private_data; |
1146 | struct vivi_dev *dev = fh->dev; | ||
1122 | int ret; | 1147 | int ret; |
1123 | 1148 | ||
1124 | dprintk(1, "mmap called, vma=0x%08lx\n", (unsigned long)vma); | 1149 | dprintk(dev, 1, "mmap called, vma=0x%08lx\n", (unsigned long)vma); |
1125 | 1150 | ||
1126 | ret = videobuf_mmap_mapper(&fh->vb_vidq, vma); | 1151 | ret = videobuf_mmap_mapper(&fh->vb_vidq, vma); |
1127 | 1152 | ||
1128 | dprintk(1, "vma start=0x%08lx, size=%ld, ret=%d\n", | 1153 | dprintk(dev, 1, "vma start=0x%08lx, size=%ld, ret=%d\n", |
1129 | (unsigned long)vma->vm_start, | 1154 | (unsigned long)vma->vm_start, |
1130 | (unsigned long)vma->vm_end-(unsigned long)vma->vm_start, | 1155 | (unsigned long)vma->vm_end-(unsigned long)vma->vm_start, |
1131 | ret); | 1156 | ret); |