summaryrefslogtreecommitdiff
path: root/v4l/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/compat.h')
-rw-r--r--v4l/compat.h49
1 files changed, 35 insertions, 14 deletions
diff --git a/v4l/compat.h b/v4l/compat.h
index 6ba49e825..2b2de93a7 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,15 +65,21 @@
#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
#endif
+/* v4l-dvb uses an out of kernel copy of i2c-id.h, which does not have
+ some stuff that previous versions of i2c-id.h defined. */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) && defined(LINUX_I2C_ID_H)
+# define I2C_ALGO_BIT 0x010000
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
#define __le32 __u32
#endif
@@ -223,6 +224,16 @@ static inline unsigned long vmalloc_to_pfn(void * vmalloc_addr)
#endif
+/* vm_insert_page() was added in 2.6.15 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) && defined(_LINUX_MM_H)
+static inline int vm_insert_page(struct vm_area_struct *vma,
+ unsigned long addr, struct page *page)
+{
+ return remap_pfn_range(vma, addr, page_to_pfn(page), PAGE_SIZE,
+ vma->vm_page_prot);
+}
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
#ifndef kcalloc
#define kcalloc(n,size,flags) \
@@ -236,6 +247,15 @@ static inline unsigned long vmalloc_to_pfn(void * vmalloc_addr)
#endif
#endif
+/* try_to_freeze() lost its argument. Must appear after linux/sched.h */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && defined(_LINUX_SCHED_H)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define try_to_freeze() try_to_freeze(PF_FREEZE)
+# else
+# define try_to_freeze() (0)
+# endif
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
#ifndef kzalloc
#define kzalloc(size, flags) \
@@ -282,7 +302,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)
{
@@ -318,7 +338,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 */