diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.c | 10 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/drivers/media/video/pvrusb2/pvrusb2-dvb.c index 58ef5caba83a..d82fceae4689 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) | |||
41 | stream = adap->channel.stream->stream; | 41 | stream = adap->channel.stream->stream; |
42 | 42 | ||
43 | for (;;) { | 43 | for (;;) { |
44 | if (adap->feed_thread_stop) break; | ||
44 | if (kthread_should_stop()) break; | 45 | if (kthread_should_stop()) break; |
45 | 46 | ||
46 | /* Not sure about this... */ | 47 | /* Not sure about this... */ |
@@ -70,10 +71,12 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap) | |||
70 | } | 71 | } |
71 | 72 | ||
72 | 73 | ||
73 | /* Wait until more buffers become available. */ | 74 | /* Wait until more buffers become available or we're |
75 | told not to wait any longer. */ | ||
74 | ret = wait_event_interruptible( | 76 | ret = wait_event_interruptible( |
75 | adap->buffer_wait_data, | 77 | adap->buffer_wait_data, |
76 | pvr2_stream_get_ready_count(stream) > 0); | 78 | (pvr2_stream_get_ready_count(stream) > 0) || |
79 | adap->feed_thread_stop); | ||
77 | if (ret < 0) break; | 80 | if (ret < 0) break; |
78 | } | 81 | } |
79 | 82 | ||
@@ -107,6 +110,8 @@ static void pvr2_dvb_stream_end(struct pvr2_dvb_adapter *adap) | |||
107 | struct pvr2_stream *stream; | 110 | struct pvr2_stream *stream; |
108 | 111 | ||
109 | if (adap->thread) { | 112 | if (adap->thread) { |
113 | adap->feed_thread_stop = !0; | ||
114 | pvr2_dvb_notify(adap); | ||
110 | kthread_stop(adap->thread); | 115 | kthread_stop(adap->thread); |
111 | adap->thread = NULL; | 116 | adap->thread = NULL; |
112 | } | 117 | } |
@@ -177,6 +182,7 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap) | |||
177 | if (ret < 0) return ret; | 182 | if (ret < 0) return ret; |
178 | } | 183 | } |
179 | 184 | ||
185 | adap->feed_thread_stop = 0; | ||
180 | adap->thread = kthread_run(pvr2_dvb_feed_thread, adap, "pvrusb2-dvb"); | 186 | adap->thread = kthread_run(pvr2_dvb_feed_thread, adap, "pvrusb2-dvb"); |
181 | 187 | ||
182 | if (IS_ERR(adap->thread)) { | 188 | if (IS_ERR(adap->thread)) { |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.h b/drivers/media/video/pvrusb2/pvrusb2-dvb.h index 884ff916a352..2dd0d4ef22a2 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.h +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.h | |||
@@ -28,6 +28,7 @@ struct pvr2_dvb_adapter { | |||
28 | unsigned int stream_run:1; | 28 | unsigned int stream_run:1; |
29 | 29 | ||
30 | wait_queue_head_t buffer_wait_data; | 30 | wait_queue_head_t buffer_wait_data; |
31 | int feed_thread_stop; | ||
31 | char *buffer_storage[PVR2_DVB_BUFFER_COUNT]; | 32 | char *buffer_storage[PVR2_DVB_BUFFER_COUNT]; |
32 | }; | 33 | }; |
33 | 34 | ||