summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2004-01-31 11:56:17 +0000
committerMichael Hunold <devnull@localhost>2004-01-31 11:56:17 +0000
commit156d99cc54a5b0ae2358d202ad8866aec98679e8 (patch)
tree4c6befa9145f899234b5f920c10ae6308bf3b307 /linux/drivers/media
parentaddda418ec6c46e0d9f16fa51d70ff19e6b63ec0 (diff)
downloadmediapointer-dvb-s2-156d99cc54a5b0ae2358d202ad8866aec98679e8.tar.gz
mediapointer-dvb-s2-156d99cc54a5b0ae2358d202ad8866aec98679e8.tar.bz2
- replace usage of sleep_on_...() here, too
(tested with 2.4, needs testing with 2.6)
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index ddc962391..fdcc5aca5 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -426,6 +426,7 @@ static int dvb_frontend_is_exiting (struct dvb_frontend_data *fe)
static int dvb_frontend_thread (void *data)
{
struct dvb_frontend_data *fe = (struct dvb_frontend_data *) data;
+ unsigned long timeout;
char name [15];
int quality = 0, delay = 3*HZ;
fe_status_t s;
@@ -442,12 +443,14 @@ static int dvb_frontend_thread (void *data)
dvb_call_frontend_notifiers (fe, 0);
dvb_frontend_init (fe);
- while (!dvb_frontend_is_exiting (fe)) {
+ while (1) {
up (&fe->sem); /* is locked when we enter the thread... */
- interruptible_sleep_on_timeout (&fe->wait_queue, delay);
- if (signal_pending(current))
+ timeout = wait_event_interruptible_timeout(fe->wait_queue,0 != dvb_frontend_is_exiting (fe), 5*HZ);
+ if (-ERESTARTSYS == timeout || 0 != dvb_frontend_is_exiting (fe)) {
+ /* got signal or quitting */
break;
+ }
if (down_interruptible (&fe->sem))
break;
@@ -455,9 +458,6 @@ static int dvb_frontend_thread (void *data)
if (fe->lost_sync_count == -1)
continue;
- if (dvb_frontend_is_exiting (fe))
- break;
-
dvb_frontend_internal_ioctl (&fe->frontend, FE_READ_STATUS, &s);
update_delay (&quality, &delay, s & FE_HAS_LOCK);
@@ -509,6 +509,8 @@ static int dvb_frontend_thread (void *data)
static void dvb_frontend_stop (struct dvb_frontend_data *fe)
{
+ unsigned long ret;
+
dprintk ("%s\n", __FUNCTION__);
fe->exit = 1;
@@ -526,10 +528,16 @@ static void dvb_frontend_stop (struct dvb_frontend_data *fe)
return;
}
+ /* wake up the frontend thread, so it notices that fe->exit == 1 */
wake_up_interruptible(&fe->wait_queue);
- interruptible_sleep_on(&fe->wait_queue);
- /* paranoia check */
+ /* wait until the frontend thread has exited */
+ ret = wait_event_interruptible(fe->wait_queue,0 == fe->thread_pid);
+ if (-ERESTARTSYS != ret) {
+ return;
+ }
+
+ /* paranoia check in case a signal arrived */
if (fe->thread_pid)
printk("dvb_frontend_stop: warning: thread PID %d won't exit\n",
fe->thread_pid);