diff options
author | Mike Isely <isely@pobox.com> | 2008-02-09 17:47:07 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:47 -0400 |
commit | c5317b17f6ca74531a6c707873dc5d25f1877ac3 (patch) | |
tree | e077d52de0a0bfd3274d9c481f3df597a33282d5 /drivers | |
parent | 129a2f5efd95959c44a2bfeea8ee8b7c17252db6 (diff) |
V4L/DVB (7692): pvrusb2-dvb: Further clean up dvb init/tear-down
Move pvr2_dvb_adapter usage out of the pvrusb2 driver core - it's
really private to the pvrusb2-dvb module and nothing outside of the
dvb implementation should care about it. Creation / destruction of
the pvr2_dvb_adapter instance is now contained entirely within
pvrusb2-dvb.c.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.c | 20 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.h | 2 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 3 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-main.c | 2 |
4 files changed, 13 insertions, 14 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/drivers/media/video/pvrusb2/pvrusb2-dvb.c index 177240051674..1a7c3ddace07 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.c | |||
@@ -381,12 +381,13 @@ static int pvr2_dvb_frontend_exit(struct pvr2_dvb_adapter *adap) | |||
381 | return 0; | 381 | return 0; |
382 | } | 382 | } |
383 | 383 | ||
384 | static void pvr2_dvb_done(struct pvr2_dvb_adapter *adap) | 384 | static void pvr2_dvb_destroy(struct pvr2_dvb_adapter *adap) |
385 | { | 385 | { |
386 | pvr2_dvb_stream_end(adap); | 386 | pvr2_dvb_stream_end(adap); |
387 | pvr2_dvb_frontend_exit(adap); | 387 | pvr2_dvb_frontend_exit(adap); |
388 | pvr2_dvb_adapter_exit(adap); | 388 | pvr2_dvb_adapter_exit(adap); |
389 | pvr2_channel_done(&adap->channel); | 389 | pvr2_channel_done(&adap->channel); |
390 | kfree(adap); | ||
390 | } | 391 | } |
391 | 392 | ||
392 | static void pvr2_dvb_internal_check(struct pvr2_channel *chp) | 393 | static void pvr2_dvb_internal_check(struct pvr2_channel *chp) |
@@ -394,10 +395,10 @@ static void pvr2_dvb_internal_check(struct pvr2_channel *chp) | |||
394 | struct pvr2_dvb_adapter *adap; | 395 | struct pvr2_dvb_adapter *adap; |
395 | adap = container_of(chp, struct pvr2_dvb_adapter, channel); | 396 | adap = container_of(chp, struct pvr2_dvb_adapter, channel); |
396 | if (!adap->channel.mc_head->disconnect_flag) return; | 397 | if (!adap->channel.mc_head->disconnect_flag) return; |
397 | pvr2_dvb_done(adap); | 398 | pvr2_dvb_destroy(adap); |
398 | } | 399 | } |
399 | 400 | ||
400 | int pvr2_dvb_init(struct pvr2_context *pvr) | 401 | struct pvr2_dvb_adapter *pvr2_dvb_create(struct pvr2_context *pvr) |
401 | { | 402 | { |
402 | int ret = 0; | 403 | int ret = 0; |
403 | struct pvr2_dvb_adapter *adap; | 404 | struct pvr2_dvb_adapter *adap; |
@@ -406,21 +407,22 @@ int pvr2_dvb_init(struct pvr2_context *pvr) | |||
406 | the DVB side of the driver either. For now. */ | 407 | the DVB side of the driver either. For now. */ |
407 | return 0; | 408 | return 0; |
408 | } | 409 | } |
409 | adap = &pvr->hdw->dvb; | 410 | adap = kzalloc(sizeof(*adap), GFP_KERNEL); |
411 | if (!adap) return adap; | ||
410 | pvr2_channel_init(&adap->channel, pvr); | 412 | pvr2_channel_init(&adap->channel, pvr); |
411 | adap->channel.check_func = pvr2_dvb_internal_check; | 413 | adap->channel.check_func = pvr2_dvb_internal_check; |
412 | init_waitqueue_head(&adap->buffer_wait_data); | 414 | init_waitqueue_head(&adap->buffer_wait_data); |
413 | mutex_init(&pvr->hdw->dvb.lock); | 415 | mutex_init(&adap->lock); |
414 | ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb); | 416 | ret = pvr2_dvb_adapter_init(adap); |
415 | if (ret < 0) goto fail1; | 417 | if (ret < 0) goto fail1; |
416 | ret = pvr2_dvb_frontend_init(&pvr->hdw->dvb); | 418 | ret = pvr2_dvb_frontend_init(adap); |
417 | if (ret < 0) goto fail2; | 419 | if (ret < 0) goto fail2; |
418 | return 0; | 420 | return adap; |
419 | 421 | ||
420 | fail2: | 422 | fail2: |
421 | pvr2_dvb_adapter_exit(adap); | 423 | pvr2_dvb_adapter_exit(adap); |
422 | fail1: | 424 | fail1: |
423 | pvr2_channel_done(&adap->channel); | 425 | pvr2_channel_done(&adap->channel); |
424 | return ret; | 426 | return NULL; |
425 | } | 427 | } |
426 | 428 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.h b/drivers/media/video/pvrusb2/pvrusb2-dvb.h index e37cb7bc2fc6..884ff916a352 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.h +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.h | |||
@@ -36,6 +36,6 @@ struct pvr2_dvb_props { | |||
36 | int (*tuner_attach) (struct pvr2_dvb_adapter *); | 36 | int (*tuner_attach) (struct pvr2_dvb_adapter *); |
37 | }; | 37 | }; |
38 | 38 | ||
39 | int pvr2_dvb_init(struct pvr2_context *pvr); | 39 | struct pvr2_dvb_adapter *pvr2_dvb_create(struct pvr2_context *pvr); |
40 | 40 | ||
41 | #endif /* __PVRUSB2_DVB_H__ */ | 41 | #endif /* __PVRUSB2_DVB_H__ */ |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index 6fe0a882209f..c725495826ce 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | |||
@@ -41,7 +41,6 @@ | |||
41 | #include "pvrusb2-io.h" | 41 | #include "pvrusb2-io.h" |
42 | #include <media/cx2341x.h> | 42 | #include <media/cx2341x.h> |
43 | #include "pvrusb2-devattr.h" | 43 | #include "pvrusb2-devattr.h" |
44 | #include "pvrusb2-dvb.h" | ||
45 | 44 | ||
46 | /* Legal values for PVR2_CID_HSM */ | 45 | /* Legal values for PVR2_CID_HSM */ |
47 | #define PVR2_CVAL_HSM_FAIL 0 | 46 | #define PVR2_CVAL_HSM_FAIL 0 |
@@ -374,8 +373,6 @@ struct pvr2_hdw { | |||
374 | 373 | ||
375 | struct pvr2_ctrl *controls; | 374 | struct pvr2_ctrl *controls; |
376 | unsigned int control_cnt; | 375 | unsigned int control_cnt; |
377 | |||
378 | struct pvr2_dvb_adapter dvb; | ||
379 | }; | 376 | }; |
380 | 377 | ||
381 | /* This function gets the current frequency */ | 378 | /* This function gets the current frequency */ |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c index 42b4c8d5a1ed..54d9f168d7ad 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/drivers/media/video/pvrusb2/pvrusb2-main.c | |||
@@ -62,7 +62,7 @@ static void pvr_setup_attach(struct pvr2_context *pvr) | |||
62 | pvr2_v4l2_create(pvr); | 62 | pvr2_v4l2_create(pvr); |
63 | #ifdef CONFIG_VIDEO_PVRUSB2_DVB | 63 | #ifdef CONFIG_VIDEO_PVRUSB2_DVB |
64 | /* Create association with dvb layer */ | 64 | /* Create association with dvb layer */ |
65 | pvr2_dvb_init(pvr); | 65 | pvr2_dvb_create(pvr); |
66 | #endif | 66 | #endif |
67 | #ifdef CONFIG_VIDEO_PVRUSB2_SYSFS | 67 | #ifdef CONFIG_VIDEO_PVRUSB2_SYSFS |
68 | pvr2_sysfs_create(pvr,class_ptr); | 68 | pvr2_sysfs_create(pvr,class_ptr); |