summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2006-03-30 22:14:40 -0600
committerMike Isely <isely@pobox.com>2006-03-30 22:14:40 -0600
commit376fb9365c967e7d2bb2aee61e01685595bf1111 (patch)
tree31e740bc4607c2fc0fc0b904e7365939eb761761 /linux/drivers/media/video
parentdf9faeeb73f7e2d40d144d32b07dbc8560b5e031 (diff)
downloadmediapointer-dvb-s2-376fb9365c967e7d2bb2aee61e01685595bf1111.tar.gz
mediapointer-dvb-s2-376fb9365c967e7d2bb2aee61e01685595bf1111.tar.bz2
Make parts of pvrusb2 compile-time options (sysfs and debugifc)
From: Mike Isely <isely@pobox.com> Arrange things in pvrusb2 so that the sysfs-using component doesn't have to be compiled in. Control this with new CONFIG_VIDEO_PVRUSB2_SYSFS variable. This will allow the driver to still be used even if sysfs has not been compiled into the kernel. Also arrange things similarly in pvrusb2 for the debug interface, which is something that normally should not need to be built but is valuable for bug chasing. This is controlled now with CONFIG_VIDEO_PVRUSB2_DEBUGIFC. Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-main.c10
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c14
2 files changed, 24 insertions, 0 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-main.c b/linux/drivers/media/video/pvrusb2/pvrusb2-main.c
index c070fc195..40fb6ae41 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-main.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-main.c
@@ -35,7 +35,9 @@
#include "pvrusb2-context.h"
#include "pvrusb2-debug.h"
#include "pvrusb2-v4l2.h"
+#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
#include "pvrusb2-sysfs.h"
+#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
#define DRIVER_AUTHOR "Mike Isely <isely@pobox.com>"
#define DRIVER_DESC "Hauppauge WinTV-PVR-USB2 MPEG2 Encoder/Tuner"
@@ -60,13 +62,17 @@ int pvrusb2_debug = DEFAULT_DEBUG_MASK;
module_param_named(debug,pvrusb2_debug,int,S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(debug, "Debug trace mask");
+#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
static struct pvr2_sysfs_class *class_ptr = 0;
+#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
static void pvr_setup_attach(struct pvr2_context *pvr)
{
/* Create association with v4l layer */
pvr2_v4l2_create(pvr);
+#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
pvr2_sysfs_create(pvr,class_ptr);
+#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
}
static int pvr_probe(struct usb_interface *intf,
@@ -138,7 +144,9 @@ static int __init pvr_init(void)
request_module("tda9887");
request_module("wm8775");
+#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
class_ptr = pvr2_sysfs_class_create();
+#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
ret = usb_register(&pvr_driver);
@@ -155,7 +163,9 @@ static void __exit pvr_exit(void)
pvr2_trace(PVR2_TRACE_INIT,"pvr_exit");
+#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
pvr2_sysfs_class_destroy(class_ptr);
+#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
usb_deregister(&pvr_driver);
}
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index c5d44aa6c..053c0b24c 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -26,14 +26,18 @@
#include "pvrusb2-sysfs.h"
#include "pvrusb2-hdw.h"
#include "pvrusb2-debug.h"
+#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
#include "pvrusb2-debugifc.h"
+#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
#define pvr2_sysfs_trace(...) pvr2_trace(PVR2_TRACE_SYSFS,__VA_ARGS__)
struct pvr2_sysfs {
struct pvr2_channel channel;
struct class_device *class_dev;
+#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
struct pvr2_sysfs_debugifc *debugifc;
+#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
struct pvr2_sysfs_ctl_item *item_first;
struct pvr2_sysfs_ctl_item *item_last;
struct sysfs_ops kops;
@@ -42,10 +46,12 @@ struct pvr2_sysfs {
struct class_device_attribute attr_unit_number;
};
+#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
struct pvr2_sysfs_debugifc {
struct class_device_attribute attr_debugcmd;
struct class_device_attribute attr_debuginfo;
};
+#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
struct pvr2_sysfs_ctl_item {
struct class_device_attribute attr_name;
@@ -531,6 +537,7 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id)
sysfs_create_group(&sfp->class_dev->kobj,&cip->grp);
}
+#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
static ssize_t debuginfo_show(struct class_device *,char *);
static ssize_t debugcmd_show(struct class_device *,char *);
static ssize_t debugcmd_store(struct class_device *,const char *,size_t count);
@@ -565,6 +572,7 @@ static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp)
kfree(sfp->debugifc);
sfp->debugifc = 0;
}
+#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
static void pvr2_sysfs_add_controls(struct pvr2_sysfs *sfp)
@@ -608,7 +616,9 @@ static void pvr2_sysfs_release(struct class_device *class_dev)
static void class_dev_destroy(struct pvr2_sysfs *sfp)
{
if (!sfp->class_dev) return;
+#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
pvr2_sysfs_tear_down_debugifc(sfp);
+#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
pvr2_sysfs_tear_down_controls(sfp);
class_device_remove_file(sfp->class_dev,&sfp->attr_v4l_minor_number);
class_device_remove_file(sfp->class_dev,&sfp->attr_unit_number);
@@ -684,7 +694,9 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
class_device_create_file(sfp->class_dev,&sfp->attr_unit_number);
pvr2_sysfs_add_controls(sfp);
+#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
pvr2_sysfs_add_debugifc(sfp);
+#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
}
@@ -755,6 +767,7 @@ void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *clp)
}
+#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
static ssize_t debuginfo_show(struct class_device *class_dev,char *buf)
{
struct pvr2_sysfs *sfp;
@@ -787,6 +800,7 @@ static ssize_t debugcmd_store(struct class_device *class_dev,
if (ret < 0) return ret;
return count;
}
+#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
/*