Erik Walthinsen wrote:
>
> On Tue, 26 Jun 2001, Michele Slocovich wrote:
>
> > v4l2 for 2.4.x kernels replaces videodev.h so that my kernel wont compile
> > anymore (either patched with new 2.6.0 i2c or not)
> > sorry for my bloathed ignorance but may I ask whether this is by design ?
> > and for my curiosity why so ? *maybe for v4l2 drivers to compile against it
> > ?*
>
> I stated a long time ago that I believe that calling the v4l2 header
> videodev.h in direct conflict with v4l's videodev.h is a major flaw in
> v4l2. As the kernel progresses, it's getting harder and harder to bodily
> yank all of v4l out so you can safely insert v4l2. Changing the header
> name to videodev2.h to match the 'version' of the API is natural, simple,
> and correct, IMO. It's called 'versioning', and lack of it is the
> fundamental reason why Windoze sucks so much. Highly incompatible headers
> by the same name is the absolute worst possible case.
>
> My $0.02,
> Omega
videodevX is no longer v4l1 or v4l2, but both, containing all the
functionality of both. Unfortunately, this means that videodevX needs
to track changes made to the kernel v4l1 driver, and this got a bit out
of synch. The attached patch should fix this problem. Please test it
(insmod/rmmod drivers a couple of times, and see if you don't get any
errors), and let us know.
Thanks,
-justin
diff -urN videodevX/videodev.h videodevX-243/videodev.h
--- videodevX/videodev.h Thu Jun 14 07:45:23 2001
+++ videodevX-243/videodev.h Wed Jun 27 10:49:21 2001
@@ -1297,6 +1297,9 @@
struct video_device
{
+#if LINUX_VERSION_CODE >= 0x020403
+ struct module *owner;
+#endif
char name[32];
int type;
int hardware;
diff -urN videodevX/videodevX.c videodevX-243/videodevX.c
--- videodevX/videodevX.c Thu Jun 14 07:45:23 2001
+++ videodevX-243/videodevX.c Wed Jun 27 10:53:31 2001
@@ -346,6 +346,11 @@
goto error_out;
}
vfl->busy=1; /* In case vfl->open sleeps */
+
+#if LINUX_VERSION_CODE >= 0x020403
+ if(vfl->owner)
+ __MOD_INC_USE_COUNT(vfl->owner);
+#endif
unlock_kernel();
if(vfl->open)
@@ -354,6 +359,10 @@
if(err)
{
vfl->busy=0;
+#if LINUX_VERSION_CODE >= 0x020403
+ if(vfl->owner)
+ __MOD_DEC_USE_COUNT(vfl->owner);
+#endif
return err;
}
}
@@ -384,6 +393,10 @@
if(vfl->close)
vfl->close(vfl);
vfl->busy=0;
+#if LINUX_VERSION_CODE >= 0x020403
+ if(vfl->owner)
+ __MOD_DEC_USE_COUNT(vfl->owner);
+#endif
unlock_kernel();
return 0;
}
@@ -1304,6 +1317,9 @@
static struct file_operations video_fops =
{
+#if LINUX_VERSION_CODE >= 0x020403
+ owner: THIS_MODULE,
+#endif
llseek: v4l2_video_llseek,
read: video_read,
write: video_write,