summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_compat.h33
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110.c9
2 files changed, 40 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_compat.h b/linux/drivers/media/dvb/dvb-core/dvb_compat.h
index 5f25ec5b3..a390dfcea 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_compat.h
+++ b/linux/drivers/media/dvb/dvb-core/dvb_compat.h
@@ -8,6 +8,39 @@
#include <linux/fs.h>
#include <linux/devfs_fs_kernel.h>
+#ifndef wait_event_interruptible_timeout
+#define __wait_event_interruptible_timeout(wq, condition, ret) \
+do { \
+ wait_queue_t __wait; \
+ init_waitqueue_entry(&__wait, current); \
+ \
+ add_wait_queue(&wq, &__wait); \
+ for (;;) { \
+ set_current_state(TASK_INTERRUPTIBLE); \
+ if (condition) \
+ break; \
+ if (!signal_pending(current)) { \
+ ret = schedule_timeout(ret); \
+ if (!ret) \
+ break; \
+ continue; \
+ } \
+ ret = -ERESTARTSYS; \
+ break; \
+ } \
+ current->state = TASK_RUNNING; \
+ remove_wait_queue(&wq, &__wait); \
+} while (0)
+
+#define wait_event_interruptible_timeout(wq, condition, timeout) \
+({ \
+ long __ret = timeout; \
+ if (!(condition)) \
+ __wait_event_interruptible_timeout(wq, condition, __ret); \
+ __ret; \
+})
+#endif
+
#ifndef VIDEO_AUDIO_BALANCE
#define VIDEO_AUDIO_BALANCE 32
#endif
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c
index 082172bba..e4c9e6744 100644
--- a/linux/drivers/media/dvb/ttpci/av7110.c
+++ b/linux/drivers/media/dvb/ttpci/av7110.c
@@ -108,6 +108,7 @@ static void arm_error(struct av7110 *av7110)
static int arm_thread(void *data)
{
struct av7110 *av7110 = data;
+ unsigned long timeout;
u16 newloops = 0;
DEB_EE(("av7110: %p\n",av7110));
@@ -115,8 +116,12 @@ static int arm_thread(void *data)
dvb_kernel_thread_setup("arm_mon");
av7110->arm_thread = current;
- while (!av7110->arm_rmmod && !signal_pending(current)) {
- interruptible_sleep_on_timeout(&av7110->arm_wait, 5*HZ);
+ while (1) {
+ timeout = wait_event_interruptible_timeout(av7110->arm_wait,0 != av7110->arm_rmmod, 5*HZ);
+ if (-ERESTARTSYS == timeout || 0 != av7110->arm_rmmod) {
+ /* got signal or told to quit*/
+ break;
+ }
if (!av7110->arm_ready)
continue;