summaryrefslogtreecommitdiff
path: root/drivers/media/common
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2005-07-07 17:58:28 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 18:24:02 -0700
commit25de192660627e1e8dc8ee6a120ff8b54d108593 (patch)
tree45e15b799e09f6b5fe478082303a8c276529edc1 /drivers/media/common
parente161f817bebecc1c1cc461dc83cce2eafbed9ee9 (diff)
downloadlinux-3.10-25de192660627e1e8dc8ee6a120ff8b54d108593.tar.gz
linux-3.10-25de192660627e1e8dc8ee6a120ff8b54d108593.tar.bz2
linux-3.10-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')
-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 77ff2291156..cd5828b5e9e 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;
}