aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/pvrusb2/pvrusb2-dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-dvb.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-dvb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/drivers/media/video/pvrusb2/pvrusb2-dvb.c
index 58ef5caba83..d82fceae468 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-dvb.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.c
@@ -41,6 +41,7 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap)
stream = adap->channel.stream->stream;
for (;;) {
+ if (adap->feed_thread_stop) break;
if (kthread_should_stop()) break;
/* Not sure about this... */
@@ -70,10 +71,12 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap)
}
- /* Wait until more buffers become available. */
+ /* Wait until more buffers become available or we're
+ told not to wait any longer. */
ret = wait_event_interruptible(
adap->buffer_wait_data,
- pvr2_stream_get_ready_count(stream) > 0);
+ (pvr2_stream_get_ready_count(stream) > 0) ||
+ adap->feed_thread_stop);
if (ret < 0) break;
}
@@ -107,6 +110,8 @@ static void pvr2_dvb_stream_end(struct pvr2_dvb_adapter *adap)
struct pvr2_stream *stream;
if (adap->thread) {
+ adap->feed_thread_stop = !0;
+ pvr2_dvb_notify(adap);
kthread_stop(adap->thread);
adap->thread = NULL;
}
@@ -177,6 +182,7 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap)
if (ret < 0) return ret;
}
+ adap->feed_thread_stop = 0;
adap->thread = kthread_run(pvr2_dvb_feed_thread, adap, "pvrusb2-dvb");
if (IS_ERR(adap->thread)) {