Commit 9d01ccfc authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] dvb: Update saa7146 driver core

From: Michael Hunold <hunold@linuxtv.org>

- saa7146: fix timeout bug on AMD64 in saa7146_wait_for_debi_done()

- saa7146: release resources for video overlay properly, don't
  (incorrectly) rely on VIDIOC_OVERLAY(0)
parent bf26bd16
...@@ -69,14 +69,14 @@ void saa7146_set_gpio(struct saa7146_dev *dev, u8 pin, u8 data) ...@@ -69,14 +69,14 @@ void saa7146_set_gpio(struct saa7146_dev *dev, u8 pin, u8 data)
/* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */ /* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */
int saa7146_wait_for_debi_done(struct saa7146_dev *dev) int saa7146_wait_for_debi_done(struct saa7146_dev *dev)
{ {
int start; unsigned long start;
/* wait for registers to be programmed */ /* wait for registers to be programmed */
start = jiffies; start = jiffies;
while (1) { while (1) {
if (saa7146_read(dev, MC2) & 2) if (saa7146_read(dev, MC2) & 2)
break; break;
if (jiffies-start > HZ/20) { if (time_after(jiffies, start + HZ/20)) {
DEB_S(("timed out while waiting for registers getting programmed\n")); DEB_S(("timed out while waiting for registers getting programmed\n"));
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -88,7 +88,7 @@ int saa7146_wait_for_debi_done(struct saa7146_dev *dev) ...@@ -88,7 +88,7 @@ int saa7146_wait_for_debi_done(struct saa7146_dev *dev)
if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
break; break;
saa7146_read(dev, MC2); saa7146_read(dev, MC2);
if (jiffies-start > HZ/4) { if (time_after(jiffies, start + HZ/4)) {
DEB_S(("timed out while waiting for transfer completion\n")); DEB_S(("timed out while waiting for transfer completion\n"));
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
...@@ -1413,6 +1413,7 @@ static void video_close(struct saa7146_dev *dev, struct file *file) ...@@ -1413,6 +1413,7 @@ static void video_close(struct saa7146_dev *dev, struct file *file)
spin_lock_irqsave(&dev->slock,flags); spin_lock_irqsave(&dev->slock,flags);
saa7146_stop_preview(fh); saa7146_stop_preview(fh);
spin_unlock_irqrestore(&dev->slock,flags); spin_unlock_irqrestore(&dev->slock,flags);
saa7146_res_free(fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment