aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Armstrong <ian@iarmst.co.uk>2008-06-21 08:25:23 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:11:09 -0400
commit464e9f3a0cabce9a7cf51f382f129d464483b0d0 (patch)
tree2f1cb5bdb035cae772954ceece9edfda4948aee0
parent0b5a30e90ddcb0095a1bfc4b44eb3fd1e8ee9f3c (diff)
V4L/DVB (8088): ivtv: yuv decoder lock fix
write() operations to the yuv device may not always 'start' the decoder. Although yuv output will be correct, some functions which should be disabled while the decoder is in use remain enabled. This can result in hardware registers being corrupted, causing problems with the mpeg decoder. This patch simply moves the existing decoder 'start' sequence to earlier in the write() handler. Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index db813e071ce6..7ec5c99f9ad1 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -582,6 +582,19 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c
582 ivtv_queue_init(&q); 582 ivtv_queue_init(&q);
583 set_bit(IVTV_F_S_APPL_IO, &s->s_flags); 583 set_bit(IVTV_F_S_APPL_IO, &s->s_flags);
584 584
585 /* Start decoder (returns 0 if already started) */
586 mutex_lock(&itv->serialize_lock);
587 rc = ivtv_start_decoding(id, itv->speed);
588 mutex_unlock(&itv->serialize_lock);
589 if (rc) {
590 IVTV_DEBUG_WARN("Failed start decode stream %s\n", s->name);
591
592 /* failure, clean up */
593 clear_bit(IVTV_F_S_STREAMING, &s->s_flags);
594 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags);
595 return rc;
596 }
597
585retry: 598retry:
586 /* If possible, just DMA the entire frame - Check the data transfer size 599 /* If possible, just DMA the entire frame - Check the data transfer size
587 since we may get here before the stream has been fully set-up */ 600 since we may get here before the stream has been fully set-up */
@@ -664,18 +677,6 @@ retry:
664 ivtv_enqueue(s, buf, &s->q_full); 677 ivtv_enqueue(s, buf, &s->q_full);
665 } 678 }
666 679
667 /* Start decoder (returns 0 if already started) */
668 mutex_lock(&itv->serialize_lock);
669 rc = ivtv_start_decoding(id, itv->speed);
670 mutex_unlock(&itv->serialize_lock);
671 if (rc) {
672 IVTV_DEBUG_WARN("Failed start decode stream %s\n", s->name);
673
674 /* failure, clean up */
675 clear_bit(IVTV_F_S_STREAMING, &s->s_flags);
676 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags);
677 return rc;
678 }
679 if (test_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags)) { 680 if (test_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags)) {
680 if (s->q_full.length >= itv->dma_data_req_size) { 681 if (s->q_full.length >= itv->dma_data_req_size) {
681 int got_sig; 682 int got_sig;