summaryrefslogtreecommitdiff
path: root/v4l
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-02-19 16:50:52 -0800
committerTrent Piepho <xyzzy@speakeasy.org>2007-02-19 16:50:52 -0800
commitfda56953d09325bd00e7edc0292d5034e494218e (patch)
tree50bf6835af96aa19b21b569276775ff87f02f0fc /v4l
parent6414245c8fb95b7664678c441f8d84ef047d6489 (diff)
downloadmediapointer-dvb-s2-fda56953d09325bd00e7edc0292d5034e494218e.tar.gz
mediapointer-dvb-s2-fda56953d09325bd00e7edc0292d5034e494218e.tar.bz2
compat: Add -include linux/version.h to cflags
From: Trent Piepho <xyzzy@speakeasy.org> Add -include linux/version.h to the cflags. Now code can have backward compatibility test without including compat.h first. Linux headers included from compat.h are removed, so that code will get the same headers when compiling in v4l-dvb as it does in the kernel. Many drivers have compat.h moved to the end of their include list, as this lets compat.h do things it can't do at the beginning. Such as test of something is defined to include compat code, or to put a wrapper around a function without changing the function's name. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'v4l')
-rw-r--r--v4l/Makefile4
-rw-r--r--v4l/compat.h24
2 files changed, 14 insertions, 14 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index b07b592b1..f08143def 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -102,8 +102,12 @@ EXTRA_CFLAGS += -g
EXTRA_CFLAGS += $(if $(wildcard $(srctree)/.mm), -DMM_KERNEL)
+# Make sure kernel's options are overridden by v4l-dvb options
EXTRA_CFLAGS += -include $(obj)/config-compat.h
+# Allow kernel version compat tests without adding #include's
+EXTRA_CFLAGS += -include linux/version.h
+
#################################################
# Kernel 2.4/2.6 specific rules
diff --git a/v4l/compat.h b/v4l/compat.h
index ffe4e97a5..bdad519e9 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -5,23 +5,14 @@
#ifndef _COMPAT_H
#define _COMPAT_H
-#include <linux/i2c-id.h>
-#include <linux/pm.h>
-#include <linux/version.h>
-#include <linux/utsname.h>
-#include <linux/sched.h>
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
# define minor(x) MINOR(x)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include <linux/delay.h>
+# include <linux/delay.h>
# define need_resched() (current->need_resched)
-
-#define work_struct tq_struct
-#else
-#include <linux/device.h>
+# define work_struct tq_struct
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
@@ -58,6 +49,10 @@
# define PCI_D0 (0)
# define assert_spin_locked(foobar)
#endif
+
+/* Since v4l-dvb now includes it's own copy of linux/i2c-id.h these
+ are no longer necessary */
+/*
#if !defined(I2C_ALGO_SAA7134)
#define I2C_ALGO_SAA7134 I2C_HW_B_BT848
#endif
@@ -70,10 +65,10 @@
#if !defined(I2C_HW_SAA7146)
# define I2C_HW_SAA7146 I2C_ALGO_SAA7146
#endif
-
#if !defined(I2C_HW_B_EM2820)
#define I2C_HW_B_EM2820 0x99
#endif
+*/
#ifndef I2C_M_IGNORE_NAK
# define I2C_M_IGNORE_NAK 0x1000
@@ -291,7 +286,7 @@ static inline unsigned long vmalloc_to_pfn(void * vmalloc_addr)
#define mutex_trylock(a) down_trylock(a)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) && defined(_LINUX_SCHED_H)
static inline signed long __sched
schedule_timeout_interruptible(signed long timeout)
{
@@ -327,7 +322,8 @@ static inline void setup_timer(struct timer_list * timer,
turned on. We can not just include usb.h here, because there is a
lot of code which will not compile if it has usb.h included, due to
conflicts with symbol names. */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && defined(__LINUX_USB_H)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && \
+ defined(__LINUX_USB_H) && defined(_INPUT_H)
#include <linux/input.h>
/* Found in linux/usb_input.h in 2.6.13 */
/* Moved to linux/usb/input.h in 2.6.18 */