Commit 13e027a8 authored by Mike Isely's avatar Mike Isely Committed by Mauro Carvalho Chehab

V4L/DVB (7713): pvrusb2: Implement cleaner DVB kernel thread shutdown

Earlier fix to handle DVB feed thread aborts was overly-aggressive.
We can take better advantage of what kthread_stop() can do.  This
change simplifies things.
Signed-off-by: default avatarMike Isely <isely@pobox.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 97f26ff6
...@@ -41,7 +41,6 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap) ...@@ -41,7 +41,6 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap)
stream = adap->channel.stream->stream; stream = adap->channel.stream->stream;
for (;;) { for (;;) {
if (adap->feed_thread_stop) break;
if (kthread_should_stop()) break; if (kthread_should_stop()) break;
/* Not sure about this... */ /* Not sure about this... */
...@@ -76,7 +75,7 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap) ...@@ -76,7 +75,7 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap)
ret = wait_event_interruptible( ret = wait_event_interruptible(
adap->buffer_wait_data, adap->buffer_wait_data,
(pvr2_stream_get_ready_count(stream) > 0) || (pvr2_stream_get_ready_count(stream) > 0) ||
adap->feed_thread_stop); kthread_should_stop());
if (ret < 0) break; if (ret < 0) break;
} }
...@@ -110,8 +109,6 @@ static void pvr2_dvb_stream_end(struct pvr2_dvb_adapter *adap) ...@@ -110,8 +109,6 @@ static void pvr2_dvb_stream_end(struct pvr2_dvb_adapter *adap)
struct pvr2_stream *stream; struct pvr2_stream *stream;
if (adap->thread) { if (adap->thread) {
adap->feed_thread_stop = !0;
pvr2_dvb_notify(adap);
kthread_stop(adap->thread); kthread_stop(adap->thread);
adap->thread = NULL; adap->thread = NULL;
} }
...@@ -182,7 +179,6 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap) ...@@ -182,7 +179,6 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap)
if (ret < 0) return ret; if (ret < 0) return ret;
} }
adap->feed_thread_stop = 0;
adap->thread = kthread_run(pvr2_dvb_feed_thread, adap, "pvrusb2-dvb"); adap->thread = kthread_run(pvr2_dvb_feed_thread, adap, "pvrusb2-dvb");
if (IS_ERR(adap->thread)) { if (IS_ERR(adap->thread)) {
......
...@@ -28,7 +28,6 @@ struct pvr2_dvb_adapter { ...@@ -28,7 +28,6 @@ struct pvr2_dvb_adapter {
unsigned int stream_run:1; unsigned int stream_run:1;
wait_queue_head_t buffer_wait_data; wait_queue_head_t buffer_wait_data;
int feed_thread_stop;
char *buffer_storage[PVR2_DVB_BUFFER_COUNT]; char *buffer_storage[PVR2_DVB_BUFFER_COUNT];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment