diff options
author | Michael Hunold <devnull@localhost> | 2004-01-31 11:31:34 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2004-01-31 11:31:34 +0000 |
commit | addda418ec6c46e0d9f16fa51d70ff19e6b63ec0 (patch) | |
tree | 6ca8efaec609c2674ff7ba9ff654ca0634d7bcf3 /linux | |
parent | 3e3a2ec29fa5dea15eed40cd7a67c8264f4ac614 (diff) | |
download | mediapointer-dvb-s2-addda418ec6c46e0d9f16fa51d70ff19e6b63ec0.tar.gz mediapointer-dvb-s2-addda418ec6c46e0d9f16fa51d70ff19e6b63ec0.tar.bz2 |
- add wait_event_interruptible_timeout() macro to dvb-compat.h
- replace usage of sleep_on_interruptible_timeout() with
wait_event_interruptible_timeout()
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_compat.h | 33 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.c | 9 |
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; |