V4L/DVB (6043): ivtv: fix incorrect round-robin implementation
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 18 Aug 2007 14:36:09 +0000 (11:36 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 10 Oct 2007 01:05:27 +0000 (22:05 -0300)
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/ivtv/ivtv-irq.c

index 88c6f4ff5c6df09a94e0550225a9c47e83b23f00..a97d55fd227730b27f5d8e10193ef87309d4e74e 100644 (file)
@@ -859,8 +859,9 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
        }
 
        if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_DMA, &itv->i_flags)) {
+               itv->irq_rr_idx++;
                for (i = 0; i < IVTV_MAX_STREAMS; i++) {
-                       int idx = (i + itv->irq_rr_idx++) % IVTV_MAX_STREAMS;
+                       int idx = (i + itv->irq_rr_idx) % IVTV_MAX_STREAMS;
                        struct ivtv_stream *s = &itv->streams[idx];
 
                        if (!test_and_clear_bit(IVTV_F_S_DMA_PENDING, &s->s_flags))
@@ -877,8 +878,9 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
        }
 
        if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_PIO, &itv->i_flags)) {
+               itv->irq_rr_idx++;
                for (i = 0; i < IVTV_MAX_STREAMS; i++) {
-                       int idx = (i + itv->irq_rr_idx++) % IVTV_MAX_STREAMS;
+                       int idx = (i + itv->irq_rr_idx) % IVTV_MAX_STREAMS;
                        struct ivtv_stream *s = &itv->streams[idx];
 
                        if (!test_and_clear_bit(IVTV_F_S_PIO_PENDING, &s->s_flags))