[linux-dvb] RE : Compile error, bug in compat.h with kernel 2.6.27.9 ?

Thierry Lelegard thierry.lelegard at tv-numeric.com
Wed Dec 31 09:45:22 CET 2008


De : BOUWSMA Barry [mailto:freebeer.bouwsma at gmail.com] 
> 
> On Tue, 30 Dec 2008, Thierry Lelegard wrote:
> 
> > OK, looking into the source RPM for the latest Fedora 10 update
> > kernel (kernel-2.6.27.9-159.fc10.src.rpm), it appears that
> > the definition of pci_ioremap_bar in pci.h was introduced by
> > linux-2.6.27.7-alsa-driver-fixups.patch
> > 
> > I assume that this is a Fedora-specific patch (or more 
> generally Red Hat),
> > back-porting 2.6.28 stuff.
> 
> There may be hope for a dirty hack...
> 
> As part of this, I also see
> --- a/include/linux/input.h
> +++ b/include/linux/input.h
> @@ -644,6 +644,7 @@ struct input_absinfo {
>  #define SW_RADIO               SW_RFKILL_ALL   /* deprecated */
>  #define SW_MICROPHONE_INSERT   0x04  /* set = inserted */
>  #define SW_DOCK                        0x05  /* set = 
> plugged into dock */
> +#define SW_LINEOUT_INSERT      0x06  /* set = plugged into dock 
> */
> 
> which is not yet in my latest 2.6.28 git kernel...
> 
> These both seem to be present since -r1.1 through HEAD,
> so I would guess you can special-case this check into
> a 2.6.27 version test.

Good idea. After some more checks, it seems reasonable. I consequently
propose the following patch:

====[CUT HERE]====
--- v4l-dvb.1/v4l/compat.h	2008-12-31 09:16:32.000000000 +0100
+++ v4l-dvb.2/v4l/compat.h	2008-12-31 09:30:08.000000000 +0100
@@ -31,6 +31,11 @@
 #include <linux/i2c.h>
 #endif
 
+/* To validate cpp test before pci_ioremap_bar */
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 27)
+#include <linux/input.h>
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
 #define set_freezable()
 #define cancel_delayed_work_sync cancel_rearming_delayed_work
@@ -268,7 +273,7 @@
 })
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) || (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 27) && !defined
(SW_LINEOUT_INSERT))
 #define snd_BUG_ON(cond)	WARN((cond), "BUG? (%s)\n", __stringify(cond))
 
 #define pci_ioremap_bar(pci, a)				\
====[CUT HERE]====

Quite dirty indeed, but isn't it the exact purpose of the compat.h file,
being the dirty glue to compile latest kernel code inside older kernels ?

I think this would help all Fedora users to have this little path committed
into the linuxtv.org repository.

Thanks Barry for your idea.
-Thierry




More information about the linux-dvb mailing list