lkml.org 
[lkml]   [2005]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[DVB patch 20/54] frontend: cx24110: clean up timeout handling.
Clean up timeout handling.

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

drivers/media/dvb/frontends/cx24110.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

--- linux-2.6.13-git4.orig/drivers/media/dvb/frontends/cx24110.c 2005-09-04 22:28:10.000000000 +0200
+++ linux-2.6.13-git4/drivers/media/dvb/frontends/cx24110.c 2005-09-04 22:28:11.000000000 +0200
@@ -387,8 +387,9 @@ static int cx24110_set_voltage (struct d

static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst)
{
- int rv, bit, i;
+ int rv, bit;
struct cx24110_state *state = fe->demodulator_priv;
+ unsigned long timeout;

if (burst == SEC_MINI_A)
bit = 0x00;
@@ -403,8 +404,9 @@ static int cx24110_diseqc_send_burst(str

rv = cx24110_readreg(state, 0x76);
cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40 | bit));
- for (i = 500; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40) ; )
- ; /* wait for LNB ready */
+ timeout = jiffies + msecs_to_jiffies(100);
+ while (!time_after(jiffies, timeout) && !(cx24110_readreg(state, 0x76) & 0x40))
+ ; /* wait for LNB ready */

return 0;
}
@@ -414,6 +416,7 @@ static int cx24110_send_diseqc_msg(struc
{
int i, rv;
struct cx24110_state *state = fe->demodulator_priv;
+ unsigned long timeout;

for (i = 0; i < cmd->msg_len; i++)
cx24110_writereg(state, 0x79 + i, cmd->msg[i]);
@@ -427,8 +430,9 @@ static int cx24110_send_diseqc_msg(struc
rv = cx24110_readreg(state, 0x76);

cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40) | ((cmd->msg_len-3) & 3));
- for (i=100; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40);)
- msleep(1); /* wait for LNB ready */
+ timeout = jiffies + msecs_to_jiffies(100);
+ while (!time_after(jiffies, timeout) && !(cx24110_readreg(state, 0x76) & 0x40))
+ ; /* wait for LNB ready */

return 0;
}
--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-05 01:52    [W:0.218 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site