summaryrefslogtreecommitdiff
path: root/drivers/media/video/saa7164/saa7164-cmd.c
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2010-07-31 21:47:36 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 13:54:37 +0400
commit4a52be0faa014380b7bf15c5ca7e3dea7cb4ea52 (patch)
treee39d8b9a822877a7ab7048e9cc55dd6f6f522ce1 /drivers/media/video/saa7164/saa7164-cmd.c
parent91d80189fab8c473a392d81b6834b8032191c990 (diff)
downloadlinux-4a52be0faa014380b7bf15c5ca7e3dea7cb4ea52.tar.xz
[media] saa7164: command dequeue fixup to clean the bus after error
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164/saa7164-cmd.c')
-rw-r--r--drivers/media/video/saa7164/saa7164-cmd.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/media/video/saa7164/saa7164-cmd.c b/drivers/media/video/saa7164/saa7164-cmd.c
index f33c0b533841..e4ec44f5c7cc 100644
--- a/drivers/media/video/saa7164/saa7164-cmd.c
+++ b/drivers/media/video/saa7164/saa7164-cmd.c
@@ -82,9 +82,10 @@ u32 saa7164_cmd_timeout_get(struct saa7164_dev *dev, u8 seqno)
* -bus/c running buffer. */
int saa7164_irq_dequeue(struct saa7164_dev *dev)
{
- int ret = SAA_OK;
+ int ret = SAA_OK, i = 0;
u32 timeout;
wait_queue_head_t *q = 0;
+ u8 tmp[512];
dprintk(DBGLVL_CMD, "%s()\n", __func__);
/* While any outstand message on the bus exists... */
@@ -109,8 +110,22 @@ int saa7164_irq_dequeue(struct saa7164_dev *dev)
printk(KERN_ERR
"%s() found timed out command on the bus\n",
__func__);
+
+ /* Clean the bus */
+ ret = saa7164_bus_get(dev, &tRsp, &tmp, 0);
+ printk(KERN_ERR "%s() ret = %x\n", __func__, ret);
+ if (ret == SAA_ERR_EMPTY)
+ /* Someone else already fetched the response */
+ return SAA_OK;
+
+ if (ret != SAA_OK)
+ return ret;
}
- } while (0);
+
+ /* It's unlikely to have more than 4 or 5 pending messages, ensure we exit
+ * at some point regardles.
+ */
+ } while (i++ < 32);
return ret;
}