patch-2.1.110 linux/drivers/char/videodev.c

Next file: linux/drivers/misc/parport_arc.c
Previous file: linux/drivers/char/tuner.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.109/linux/drivers/char/videodev.c linux/drivers/char/videodev.c
@@ -27,6 +27,10 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
+#ifdef CONFIG_KMOD
+#include <linux/kmod.h>
+#endif
+
 
 #define VIDEO_NUM_DEVICES	256 
 
@@ -38,6 +42,7 @@
 
 #ifdef CONFIG_VIDEO_BT848
 extern int init_bttv_cards(struct video_init *);
+extern int i2c_tuner_init(struct video_init *);
 #endif
 #ifdef CONFIG_VIDEO_SAA5249
 extern int init_saa_5249(struct video_init *);
@@ -60,6 +65,7 @@
 
 static struct video_init video_init_list[]={
 #ifdef CONFIG_VIDEO_BT848
+	{"i2c-tuner", i2c_tuner_init},
 	{"bttv", init_bttv_cards},
 #endif	
 #ifdef CONFIG_VIDEO_SAA5249
@@ -132,8 +138,17 @@
 		return -ENODEV;
 		
 	vfl=video_device[minor];
-	if(vfl==NULL)
-		return -ENODEV;
+	if(vfl==NULL) {
+#ifdef CONFIG_KMOD
+		char modname[20];
+
+		sprintf (modname, "char-major-%d-%d", VIDEO_MAJOR, minor);
+		request_module(modname);
+		vfl=video_device[minor];
+		if (vfl==NULL)
+#endif
+			return -ENODEV;
+	}
 	if(vfl->busy)
 		return -EBUSY;
 	vfl->busy=1;		/* In case vfl->open sleeps */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov