summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-02-09 13:47:07 -0600
committerMike Isely <isely@pobox.com>2008-02-09 13:47:07 -0600
commit18227ab4c1b20e24a6893029ca4156c1da3876d0 (patch)
tree52ff0751223847c12c350fc18e2ed1187c050ada /linux/drivers/media/video/pvrusb2
parent5097f23fd0dd7f3b82f9ebe424274041ad184b2b (diff)
downloadmediapointer-dvb-s2-18227ab4c1b20e24a6893029ca4156c1da3876d0.tar.gz
mediapointer-dvb-s2-18227ab4c1b20e24a6893029ca4156c1da3876d0.tar.bz2
pvrusb2-dvb: Further clean up dvb init/tear-down
From: Mike Isely <isely@pobox.com> 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>
Diffstat (limited to 'linux/drivers/media/video/pvrusb2')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c20
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-dvb.h2
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h3
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-main.c2
4 files changed, 13 insertions, 14 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c
index 0b3eb6d84..3fe7fcf9f 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.c
@@ -399,12 +399,13 @@ static int pvr2_dvb_frontend_exit(struct pvr2_dvb_adapter *adap)
return 0;
}
-static void pvr2_dvb_done(struct pvr2_dvb_adapter *adap)
+static void pvr2_dvb_destroy(struct pvr2_dvb_adapter *adap)
{
pvr2_dvb_stream_end(adap);
pvr2_dvb_frontend_exit(adap);
pvr2_dvb_adapter_exit(adap);
pvr2_channel_done(&adap->channel);
+ kfree(adap);
}
static void pvr2_dvb_internal_check(struct pvr2_channel *chp)
@@ -412,10 +413,10 @@ static void pvr2_dvb_internal_check(struct pvr2_channel *chp)
struct pvr2_dvb_adapter *adap;
adap = container_of(chp, struct pvr2_dvb_adapter, channel);
if (!adap->channel.mc_head->disconnect_flag) return;
- pvr2_dvb_done(adap);
+ pvr2_dvb_destroy(adap);
}
-int pvr2_dvb_init(struct pvr2_context *pvr)
+struct pvr2_dvb_adapter *pvr2_dvb_create(struct pvr2_context *pvr)
{
int ret = 0;
struct pvr2_dvb_adapter *adap;
@@ -424,21 +425,22 @@ int pvr2_dvb_init(struct pvr2_context *pvr)
the DVB side of the driver either. For now. */
return 0;
}
- adap = &pvr->hdw->dvb;
+ adap = kzalloc(sizeof(*adap), GFP_KERNEL);
+ if (!adap) return adap;
pvr2_channel_init(&adap->channel, pvr);
adap->channel.check_func = pvr2_dvb_internal_check;
init_waitqueue_head(&adap->buffer_wait_data);
- mutex_init(&pvr->hdw->dvb.lock);
- ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb);
+ mutex_init(&adap->lock);
+ ret = pvr2_dvb_adapter_init(adap);
if (ret < 0) goto fail1;
- ret = pvr2_dvb_frontend_init(&pvr->hdw->dvb);
+ ret = pvr2_dvb_frontend_init(adap);
if (ret < 0) goto fail2;
- return 0;
+ return adap;
fail2:
pvr2_dvb_adapter_exit(adap);
fail1:
pvr2_channel_done(&adap->channel);
- return ret;
+ return NULL;
}
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.h b/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.h
index f6b8199a5..04209db87 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.h
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-dvb.h
@@ -40,7 +40,7 @@ struct pvr2_dvb_props {
int (*tuner_attach) (struct pvr2_dvb_adapter *);
};
-int pvr2_dvb_init(struct pvr2_context *pvr);
+struct pvr2_dvb_adapter *pvr2_dvb_create(struct pvr2_context *pvr);
#endif /* __PVRUSB2_DVB_H__ */
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index cdfe11c74..631973652 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -45,7 +45,6 @@
#include "pvrusb2-io.h"
#include <media/cx2341x.h>
#include "pvrusb2-devattr.h"
-#include "pvrusb2-dvb.h"
/* Legal values for PVR2_CID_HSM */
#define PVR2_CVAL_HSM_FAIL 0
@@ -390,8 +389,6 @@ struct pvr2_hdw {
struct pvr2_ctrl *controls;
unsigned int control_cnt;
-
- struct pvr2_dvb_adapter dvb;
};
/* This function gets the current frequency */
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-main.c b/linux/drivers/media/video/pvrusb2/pvrusb2-main.c
index 94ff261f8..3830f3c92 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-main.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-main.c
@@ -63,7 +63,7 @@ static void pvr_setup_attach(struct pvr2_context *pvr)
pvr2_v4l2_create(pvr);
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
/* Create association with dvb layer */
- pvr2_dvb_init(pvr);
+ pvr2_dvb_create(pvr);
#endif
#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
pvr2_sysfs_create(pvr,class_ptr);