[linux-dvb] Backwards Compatability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As of now, dvb-kernel will build on kernels 2.6.13 through 2.6.15-rc1.

I have to track down some patches in order to restore compatability with 
2.6.12 and earlier... Any help would be appreciated.

We are now welcoming patches that allow backwards compatability with 
older kernels, but please keep the following guidelines in mind:

Backwards-compatability patches must be completely separate from patches 
that add functionality and bugfixes.  This way, the patches can be 
applied to cvs separately, and it will be easier to identify 
backwards-compat patches and prevent them from being sent upstream.

#IF KERNEL_VERSION [</>] KERNEL_VERSION(X,Y,Z)  IS allowed, but still 
frowned upon, if the logic can be done in another way.  Do not include 
version.h into any source files.... Instead, include compat.h, which 
already has both version.h and utsname.h included.  The idea is to put 
as much of the backwards compatability code into compat.h as possible, 
rather than inline.

Here's an example of an upstream patch (from 2.6.15-rc1) that breaks 
compatability with 2.6.14 and earlier:

diff -u -r1.44 -r1.45
--- dvb-kernel/linux/drivers/media/dvb/dvb-core/dvbdev.c	2005/07/01 23:19:48	1.44
+++ dvb-kernel/linux/drivers/media/dvb/dvb-core/dvbdev.c	2005/11/13 07:33:19	1.45
@@ -235,7 +235,7 @@
 			S_IFCHR | S_IRUSR | S_IWUSR,
 			"dvb/adapter%d/%s%d", adap->num, dnames[type], id);
 
-	class_device_create(dvb_class, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
+	class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
 			    NULL, "dvb%d.%s%d", adap->num, dnames[type], id);
 	dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",

To make this backwards compatable, I applied the following:

diff -u -r1.1 -r1.2
--- dvb-kernel/build-2.6/compat.h	2005/10/01 17:01:45	1.1
+++ dvb-kernel/build-2.6/compat.h	2005/11/13 07:39:10	1.2
@@ -45,5 +47,8 @@
 # define BTTV_BOARD_PINNACLESAT BTTV_PINNACLESAT
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
+# define class_device_create(a, b, c, d, e, f, g, h) class_device_create(a, c, d, e, f, g, h)
+#endif
 
 #endif

diff -u -r1.26 -r1.27
--- dvb-kernel/linux/drivers/media/dvb/dvb-core/dvbdev.h	2005/03/17 03:12:43	1.26
+++ dvb-kernel/linux/drivers/media/dvb/dvb-core/dvbdev.h	2005/11/13 07:39:10	1.27
@@ -29,6 +29,7 @@
 #include <linux/list.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/smp_lock.h>
+#include "compat.h"
 
 #define DVB_MAJOR 212

Another issue to point out, for each new directory that includes 
compat.h, the following must be done to the makelinks script:

diff -u -r1.21 -r1.22
--- dvb-kernel/makelinks	2005/10/02 01:02:00	1.21
+++ dvb-kernel/makelinks	2005/11/13 07:39:10	1.22
@@ -49,3 +49,5 @@
 ln -v -f -s $PWD/build-2.6/compat.h $1/drivers/media/common/compat.h
 ln -v -f -s $1/drivers/media/video/bttv.h $1/drivers/media/common/bttv.h
 ln -v -f -s $PWD/build-2.6/compat.h $1/drivers/media/dvb/bt8xx/compat.h
+ln -v -f -s $PWD/build-2.6/compat.h $1/drivers/media/dvb/dvb-core/compat.h
+ln -v -f -s $1/drivers/media/video/bttv.h $1/drivers/media/dvb/dvb-core/bttv.h

This is somewhat of a hack, but it isn't really that bad.  This was the 
easiest way to get the compat.h magic to work under both compile methods 
(make / makelinks) ...  I had to do this in order to prevent breaking 
the makelinks compile method.   If anyone knows of a better way to make 
this work, please feel free to propose a new patch.

-Michael Krufky


[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux