diff options
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.c | 31 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.h | 2 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-main.c | 3 |
3 files changed, 19 insertions, 17 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/drivers/media/video/pvrusb2/pvrusb2-dvb.c index ab608412b41..38077b2c528 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.c | |||
@@ -386,30 +386,37 @@ static int pvr2_dvb_frontend_exit(struct pvr2_dvb_adapter *adap) | |||
386 | return 0; | 386 | return 0; |
387 | } | 387 | } |
388 | 388 | ||
389 | static void pvr2_dvb_done(struct pvr2_dvb_adapter *adap) | ||
390 | { | ||
391 | pvr2_dvb_stream_end(adap); | ||
392 | pvr2_dvb_frontend_exit(adap); | ||
393 | pvr2_dvb_adapter_exit(adap); | ||
394 | pvr2_channel_done(&adap->channel); | ||
395 | } | ||
396 | |||
397 | static void pvr2_dvb_internal_check(struct pvr2_channel *chp) | ||
398 | { | ||
399 | struct pvr2_dvb_adapter *adap; | ||
400 | adap = container_of(chp, struct pvr2_dvb_adapter, channel); | ||
401 | if (!adap->channel.mc_head->disconnect_flag) return; | ||
402 | pvr2_dvb_done(adap); | ||
403 | } | ||
404 | |||
389 | int pvr2_dvb_init(struct pvr2_context *pvr) | 405 | int pvr2_dvb_init(struct pvr2_context *pvr) |
390 | { | 406 | { |
391 | int ret = 0; | 407 | int ret = 0; |
392 | struct pvr2_dvb_adapter *adap; | 408 | struct pvr2_dvb_adapter *adap; |
393 | adap = &pvr->hdw->dvb; | 409 | adap = &pvr->hdw->dvb; |
394 | adap->init = !0; | ||
395 | pvr2_channel_init(&adap->channel, pvr); | 410 | pvr2_channel_init(&adap->channel, pvr); |
411 | adap->channel.check_func = pvr2_dvb_internal_check; | ||
396 | init_waitqueue_head(&adap->buffer_wait_data); | 412 | init_waitqueue_head(&adap->buffer_wait_data); |
397 | mutex_init(&pvr->hdw->dvb.lock); | 413 | mutex_init(&pvr->hdw->dvb.lock); |
398 | ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb); | 414 | ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb); |
399 | if (ret < 0) goto fail; | 415 | if (ret < 0) goto fail; |
400 | ret = pvr2_dvb_frontend_init(&pvr->hdw->dvb); | 416 | ret = pvr2_dvb_frontend_init(&pvr->hdw->dvb); |
417 | return ret; | ||
401 | fail: | 418 | fail: |
419 | pvr2_channel_done(&adap->channel); | ||
402 | return ret; | 420 | return ret; |
403 | } | 421 | } |
404 | 422 | ||
405 | int pvr2_dvb_exit(struct pvr2_context *pvr) | ||
406 | { | ||
407 | struct pvr2_dvb_adapter *adap; | ||
408 | adap = &pvr->hdw->dvb; | ||
409 | if (!adap->init) return 0; | ||
410 | pvr2_dvb_stream_end(adap); | ||
411 | pvr2_dvb_frontend_exit(adap); | ||
412 | pvr2_dvb_adapter_exit(adap); | ||
413 | pvr2_channel_done(&adap->channel); | ||
414 | return 0; | ||
415 | } | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.h b/drivers/media/video/pvrusb2/pvrusb2-dvb.h index 651324ffab3..1326f6f455a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.h +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.h | |||
@@ -27,7 +27,6 @@ struct pvr2_dvb_adapter { | |||
27 | 27 | ||
28 | unsigned int digital_up:1; | 28 | unsigned int digital_up:1; |
29 | unsigned int stream_run:1; | 29 | unsigned int stream_run:1; |
30 | unsigned int init:1; | ||
31 | 30 | ||
32 | wait_queue_head_t buffer_wait_data; | 31 | wait_queue_head_t buffer_wait_data; |
33 | char *buffer_storage[PVR2_DVB_BUFFER_COUNT]; | 32 | char *buffer_storage[PVR2_DVB_BUFFER_COUNT]; |
@@ -39,6 +38,5 @@ struct pvr2_dvb_props { | |||
39 | }; | 38 | }; |
40 | 39 | ||
41 | int pvr2_dvb_init(struct pvr2_context *pvr); | 40 | int pvr2_dvb_init(struct pvr2_context *pvr); |
42 | int pvr2_dvb_exit(struct pvr2_context *pvr); | ||
43 | 41 | ||
44 | #endif /* __PVRUSB2_DVB_H__ */ | 42 | #endif /* __PVRUSB2_DVB_H__ */ |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c index 68f4a748073..42b4c8d5a1e 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/drivers/media/video/pvrusb2/pvrusb2-main.c | |||
@@ -99,9 +99,6 @@ static void pvr_disconnect(struct usb_interface *intf) | |||
99 | 99 | ||
100 | pvr2_trace(PVR2_TRACE_INIT,"pvr_disconnect(pvr=%p) BEGIN",pvr); | 100 | pvr2_trace(PVR2_TRACE_INIT,"pvr_disconnect(pvr=%p) BEGIN",pvr); |
101 | 101 | ||
102 | #ifdef CONFIG_VIDEO_PVRUSB2_DVB | ||
103 | pvr2_dvb_exit(pvr); | ||
104 | #endif | ||
105 | usb_set_intfdata (intf, NULL); | 102 | usb_set_intfdata (intf, NULL); |
106 | pvr2_context_disconnect(pvr); | 103 | pvr2_context_disconnect(pvr); |
107 | 104 | ||