From: nshmyrev@yandex.ru <nshmyrev@yandex.ru>
Date: Wed, 9 Nov 2005 05:37:41 +0000 (-0800)
Subject: [PATCH] v4l: 797: more intellect on clearing in bits on irq lock
X-Git-Tag: firefly_0821_release~40339
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c58c21c7a2ef7d1eb45231d5c1bb24d88a9666b8;p=firefly-linux-kernel-4.4.55.git

[PATCH] v4l: 797: more intellect on clearing in bits on irq lock

- More intellect on clearing in bits on irq lock.

Signed-off-by: Nickolay V. Shmyrev <<nshmyrev@yandex.ru>>
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---

diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 504d717b1158..058b923b4b13 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -3736,10 +3736,22 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
 
 		count++;
 		if (count > 4) {
-			btwrite(0, BT848_INT_MASK);
-			printk(KERN_ERR
-			       "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr);
+
+			if (count > 8 || !(astat & BT848_INT_GPINT)) {
+	 			btwrite(0, BT848_INT_MASK);
+
+				printk(KERN_ERR
+					   "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr);
+			} else {
+				printk(KERN_ERR
+					   "bttv%d: IRQ lockup, clearing GPINT from int mask [", btv->c.nr);
+
+				btwrite(btread(BT848_INT_MASK) & (-1 ^ BT848_INT_GPINT),
+						BT848_INT_MASK);
+			};
+
 			bttv_print_irqbits(stat,astat);
+
 			printk("]\n");
 		}
 	}