Skip to content

Commit

Permalink
[PATCH] dvb: ttpci: fix bug in timeout handling
Browse files Browse the repository at this point in the history
Fix bug in timeout handling.

Signed-off-by: Johannes Stezenbach <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Johannes Stezenbach authored and Linus Torvalds committed Jul 8, 2005
1 parent c9090eb commit 7d87bc3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/media/dvb/ttpci/av7110_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,23 +352,23 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)

start = jiffies;
while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2 )) {
msleep(1);
if (time_after(jiffies, start + ARM_WAIT_FREE)) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND idle\n", __FUNCTION__);
return -ETIMEDOUT;
}
msleep(1);
}

wdebi(av7110, DEBINOSWAP, COM_IF_LOCK, 0xffff, 2);

#ifndef _NOHANDSHAKE
start = jiffies;
while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 )) {
msleep(1);
if (time_after(jiffies, start + ARM_WAIT_SHAKE)) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
return -ETIMEDOUT;
}
msleep(1);
}
#endif

Expand Down Expand Up @@ -433,14 +433,14 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)
#ifdef COM_DEBUG
start = jiffies;
while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2 )) {
msleep(1);
if (time_after(jiffies, start + ARM_WAIT_FREE)) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND %d to complete\n",
__FUNCTION__,
(buf[0] >> 8) & 0xff
);
return -ETIMEDOUT;
}
msleep(1);
}

stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
Expand Down Expand Up @@ -554,25 +554,25 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,

start = jiffies;
while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2)) {
#ifdef _NOHANDSHAKE
msleep(1);
#endif
if (time_after(jiffies, start + ARM_WAIT_FREE)) {
printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__);
up(&av7110->dcomlock);
return -ETIMEDOUT;
}
#ifdef _NOHANDSHAKE
msleep(1);
#endif
}

#ifndef _NOHANDSHAKE
start = jiffies;
while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 )) {
msleep(1);
if (time_after(jiffies, start + ARM_WAIT_SHAKE)) {
printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
up(&av7110->dcomlock);
return -ETIMEDOUT;
}
msleep(1);
}
#endif

Expand Down Expand Up @@ -712,13 +712,13 @@ static int FlushText(struct av7110 *av7110)
return -ERESTARTSYS;
start = jiffies;
while (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2)) {
msleep(1);
if (time_after(jiffies, start + ARM_WAIT_OSD)) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n",
__FUNCTION__);
up(&av7110->dcomlock);
return -ETIMEDOUT;
}
msleep(1);
}
up(&av7110->dcomlock);
return 0;
Expand All @@ -736,24 +736,24 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)

start = jiffies;
while (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2)) {
msleep(1);
if (time_after(jiffies, start + ARM_WAIT_OSD)) {
printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n",
__FUNCTION__);
up(&av7110->dcomlock);
return -ETIMEDOUT;
}
msleep(1);
}
#ifndef _NOHANDSHAKE
start = jiffies;
while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2)) {
msleep(1);
if (time_after(jiffies, start + ARM_WAIT_SHAKE)) {
printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n",
__FUNCTION__);
up(&av7110->dcomlock);
return -ETIMEDOUT;
}
msleep(1);
}
#endif
for (i = 0; i < length / 2; i++)
Expand Down

0 comments on commit 7d87bc3

Please sign in to comment.