From 50bcb4aefe382df28031867e16a0a8d1dfb39c94 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Wed, 13 May 2009 02:53:08 -0300 Subject: V4L/DVB (12933): SAA7164: Fix IRQ related system hang when firmware is not found. Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7164/saa7164-core.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'drivers') diff --git a/drivers/media/video/saa7164/saa7164-core.c b/drivers/media/video/saa7164/saa7164-core.c index 0f3ebcdef12..2fbf4204cd5 100644 --- a/drivers/media/video/saa7164/saa7164-core.c +++ b/drivers/media/video/saa7164/saa7164-core.c @@ -119,8 +119,7 @@ static irqreturn_t saa7164_irq_ts(struct saa7164_tsport *port) static irqreturn_t saa7164_irq(int irq, void *dev_id) { struct saa7164_dev *dev = dev_id; - u32 hwacc = 0, interruptid; - u32 intstat[INT_SIZE/4]; + u32 intid, intstat[INT_SIZE/4]; int i, handled = 0, bit; if (dev == 0) { @@ -140,15 +139,11 @@ static irqreturn_t saa7164_irq(int irq, void *dev_id) /* Read the 4 hardware interrupt registers */ intstat[i] = saa7164_readl(dev->int_status + (i * 4)); - if (intstat[i] != 0xffffffff) - hwacc = 1; + if (intstat[i]) + handled = 1; } - if (hwacc == 0) { - handled = 0; + if (handled == 0) goto out; - } - - handled = 1; /* For each of the HW interrupt registers */ for (i = 0; i < INT_SIZE/4; i++) { @@ -165,17 +160,17 @@ static irqreturn_t saa7164_irq(int irq, void *dev_id) /* Calculate the interrupt id (0x00 to 0x7f) */ - interruptid = (i * 32) + bit; - if (interruptid == dev->intfdesc.bInterruptId) { + intid = (i * 32) + bit; + if (intid == dev->intfdesc.bInterruptId) { /* A response to an cmd/api call */ schedule_work(&dev->workcmd); - } else if (interruptid == + } else if (intid == dev->ts1.hwcfg.interruptid) { /* Transport path 1 */ saa7164_irq_ts(&dev->ts1); - } else if (interruptid == + } else if (intid == dev->ts2.hwcfg.interruptid) { /* Transport path 2 */ @@ -187,7 +182,7 @@ static irqreturn_t saa7164_irq(int irq, void *dev_id) "%s() unhandled interrupt " "reg 0x%x bit 0x%x " "intid = 0x%x\n", - __func__, i, bit, interruptid); + __func__, i, bit, intid); } } @@ -598,8 +593,9 @@ static int __devinit saa7164_initdev(struct pci_dev *pci_dev, err = saa7164_downloadfirmware(dev); if (err < 0) { printk(KERN_ERR - "Failed to boot firmware, cannot continue\n"); - goto fail_irq; + "Failed to boot firmware, no features " + "registered\n"); + goto fail_fw; } saa7164_get_descriptors(dev); @@ -666,6 +662,7 @@ static int __devinit saa7164_initdev(struct pci_dev *pci_dev, printk(KERN_ERR "%s() Unsupported board detected, " "registering without firmware\n", __func__); +fail_fw: return 0; fail_irq: -- cgit v1.2.3