summaryrefslogtreecommitdiffstats
path: root/drivers/media/common/saa7146_core.c
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2005-07-08 02:58:28 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-08 03:24:02 +0200
commit25de192660627e1e8dc8ee6a120ff8b54d108593 (patch)
tree45e15b799e09f6b5fe478082303a8c276529edc1 /drivers/media/common/saa7146_core.c
parent[PATCH] dvb: usb: dont use HZ for timeouts (diff)
downloadlinux-25de192660627e1e8dc8ee6a120ff8b54d108593.tar.xz
linux-25de192660627e1e8dc8ee6a120ff8b54d108593.zip
[PATCH] dvb: ttpci: fix timeout handling to be save with PREEMPT
Timeout handling fixed, especially for preemtible kernels and/or high system load. Signed-off-by: Oliver Endriss <o.endriss@gmx.de> 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/media/common/saa7146_core.c')
-rw-r--r--drivers/media/common/saa7146_core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 77ff22911566..cd5828b5e9e3 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -62,13 +62,15 @@ void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data)
int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop)
{
unsigned long start;
+ int err;
/* wait for registers to be programmed */
start = jiffies;
while (1) {
- if (saa7146_read(dev, MC2) & 2)
- break;
- if (time_after(jiffies, start + HZ/20)) {
+ err = time_after(jiffies, start + HZ/20);
+ if (saa7146_read(dev, MC2) & 2)
+ break;
+ if (err) {
DEB_S(("timed out while waiting for registers getting programmed\n"));
return -ETIMEDOUT;
}
@@ -79,10 +81,11 @@ int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop)
/* wait for transfer to complete */
start = jiffies;
while (1) {
+ err = time_after(jiffies, start + HZ/4);
if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
break;
saa7146_read(dev, MC2);
- if (time_after(jiffies, start + HZ/4)) {
+ if (err) {
DEB_S(("timed out while waiting for transfer completion\n"));
return -ETIMEDOUT;
}