summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common/saa7146_core.c
diff options
context:
space:
mode:
authorOliver Endriss <devnull@localhost>2005-06-26 21:53:02 +0000
committerOliver Endriss <devnull@localhost>2005-06-26 21:53:02 +0000
commitb1c58172e20695bb6934d9a1402b63dae0d25bb6 (patch)
tree5b7f24ef5f6ef3992db8f1490183e73691a84e27 /linux/drivers/media/common/saa7146_core.c
parent95d1e3c6e7757312d8260bdf482dcce2e69afb35 (diff)
downloadmediapointer-dvb-s2-b1c58172e20695bb6934d9a1402b63dae0d25bb6.tar.gz
mediapointer-dvb-s2-b1c58172e20695bb6934d9a1402b63dae0d25bb6.tar.bz2
timeout handling fixed, especially for preemtible kernels and/or high system load
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Diffstat (limited to 'linux/drivers/media/common/saa7146_core.c')
-rw-r--r--linux/drivers/media/common/saa7146_core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c
index 77ff22911..cd5828b5e 100644
--- a/linux/drivers/media/common/saa7146_core.c
+++ b/linux/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;
}