aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Stezenbach <js@linuxtv.org>2005-09-09 16:02:37 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:39 -0400
commitc589ebfce79834a9617c44d7ec0f608fa70eb42d (patch)
treead8045f252829df5191f2e722c8141bb76a1e04d /drivers
parent296c786a0d2122b1e47c80ca717d8a8ac36402c1 (diff)
[PATCH] dvb: frontend: cx24110: clean up timeout handling.
Clean up timeout handling. Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/cx24110.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c
index eb4833ee72be..d4b97989e3ed 100644
--- a/drivers/media/dvb/frontends/cx24110.c
+++ b/drivers/media/dvb/frontends/cx24110.c
@@ -387,8 +387,9 @@ static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag
387 387
388static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) 388static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst)
389{ 389{
390 int rv, bit, i; 390 int rv, bit;
391 struct cx24110_state *state = fe->demodulator_priv; 391 struct cx24110_state *state = fe->demodulator_priv;
392 unsigned long timeout;
392 393
393 if (burst == SEC_MINI_A) 394 if (burst == SEC_MINI_A)
394 bit = 0x00; 395 bit = 0x00;
@@ -403,8 +404,9 @@ static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t
403 404
404 rv = cx24110_readreg(state, 0x76); 405 rv = cx24110_readreg(state, 0x76);
405 cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40 | bit)); 406 cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40 | bit));
406 for (i = 500; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40) ; ) 407 timeout = jiffies + msecs_to_jiffies(100);
407 ; /* wait for LNB ready */ 408 while (!time_after(jiffies, timeout) && !(cx24110_readreg(state, 0x76) & 0x40))
409 ; /* wait for LNB ready */
408 410
409 return 0; 411 return 0;
410} 412}
@@ -414,6 +416,7 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe,
414{ 416{
415 int i, rv; 417 int i, rv;
416 struct cx24110_state *state = fe->demodulator_priv; 418 struct cx24110_state *state = fe->demodulator_priv;
419 unsigned long timeout;
417 420
418 for (i = 0; i < cmd->msg_len; i++) 421 for (i = 0; i < cmd->msg_len; i++)
419 cx24110_writereg(state, 0x79 + i, cmd->msg[i]); 422 cx24110_writereg(state, 0x79 + i, cmd->msg[i]);
@@ -427,8 +430,9 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe,
427 rv = cx24110_readreg(state, 0x76); 430 rv = cx24110_readreg(state, 0x76);
428 431
429 cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40) | ((cmd->msg_len-3) & 3)); 432 cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40) | ((cmd->msg_len-3) & 3));
430 for (i=100; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40);) 433 timeout = jiffies + msecs_to_jiffies(100);
431 msleep(1); /* wait for LNB ready */ 434 while (!time_after(jiffies, timeout) && !(cx24110_readreg(state, 0x76) & 0x40))
435 ; /* wait for LNB ready */
432 436
433 return 0; 437 return 0;
434} 438}