From f1eedfa6dedb9b6f0fa33724c7072a5e82c67e16 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 27 Aug 2001 09:55:40 +0000 Subject: [PATCH] Fixes for compiling with 2.0.x --- include/asm/dma.h | 25 +++++++++++++++++++++++++ include/linux/comedidev.h | 2 ++ include/linux/fs.h | 5 +++++ include/linux/kmod.h | 17 +++++++++++++++++ include/linux/module.h | 1 + include/linux/poll.h | 17 +++++++++++++++++ include/linux/sched.h | 17 +++++++++++++++++ include/linux/spinlock.h | 21 +++++++++++++++++++++ include/linux/timer.h | 18 ++++++++++++++++++ include/linux/vmalloc.h | 17 +++++++++++++++++ 10 files changed, 140 insertions(+) create mode 100644 include/asm/dma.h create mode 100644 include/linux/kmod.h create mode 100644 include/linux/poll.h create mode 100644 include/linux/sched.h create mode 100644 include/linux/timer.h create mode 100644 include/linux/vmalloc.h diff --git a/include/asm/dma.h b/include/asm/dma.h new file mode 100644 index 00000000..60abc156 --- /dev/null +++ b/include/asm/dma.h @@ -0,0 +1,25 @@ +/* + * asm/dma.h compatibility header + */ + +#ifndef __COMPAT_ASM_DMA_H_ +#define __COMPAT_ASM_DMA_H_ + +#include + +#if LINUX_VERSION_CODE < 0x020200 +#include +static __inline__ unsigned long claim_dma_lock(void) +{ + unsigned long flags; + save_flags(flags); + cli(); + return flags; +} +#define release_dma_lock(x) restore_flags(x) +#endif + +#include_next + +#endif + diff --git a/include/linux/comedidev.h b/include/linux/comedidev.h index bf46295b..3b41c2c5 100644 --- a/include/linux/comedidev.h +++ b/include/linux/comedidev.h @@ -29,6 +29,8 @@ #include #include #include +#include + #include diff --git a/include/linux/fs.h b/include/linux/fs.h index 736b592d..7baf1314 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -7,11 +7,16 @@ #include +#if LINUX_VERSION_CODE < 0x020400 +/* no fasync */ +#define KILL_FASYNC(a,b,c) +#else #if LINUX_VERSION_CODE < 0x020400 #define KILL_FASYNC(a,b,c) kill_fasync((a),(c)) #else #define KILL_FASYNC(a,b,c) kill_fasync(&(a),(b),(c)) #endif +#endif #include_next diff --git a/include/linux/kmod.h b/include/linux/kmod.h new file mode 100644 index 00000000..f356b8fc --- /dev/null +++ b/include/linux/kmod.h @@ -0,0 +1,17 @@ +/* + * linux/kmod.h compatibility header + */ + +#ifndef __COMPAT_LINUX_KMOD_H_ +#define __COMPAT_LINUX_KMOD_H_ + +#include + +#if LINUX_VERSION_CODE < 0x020200 + +#else +#include_next +#endif + +#endif + diff --git a/include/linux/module.h b/include/linux/module.h index e7e38d13..979b365a 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -23,6 +23,7 @@ #endif #define __MOD_INC_USE_COUNT(x) ((*(long *)(x))++, (*(long *)(x)) |= MOD_VISITED) #define __MOD_DEC_USE_COUNT(x) ((*(long *)(x))--, (*(long *)(x)) |= MOD_VISITED) + #define EXPORT_SYMBOL(x) #else #ifdef MODULE #define THIS_MODULE &__this_module diff --git a/include/linux/poll.h b/include/linux/poll.h new file mode 100644 index 00000000..bafeb0a2 --- /dev/null +++ b/include/linux/poll.h @@ -0,0 +1,17 @@ +/* + * linux/poll.h compatibility header + */ + +#ifndef __COMPAT_LINUX_POLL_H_ +#define __COMPAT_LINUX_POLL_H_ + +#include + +#if LINUX_VERSION_CODE < 0x020200 + +#else +#include_next +#endif + +#endif + diff --git a/include/linux/sched.h b/include/linux/sched.h new file mode 100644 index 00000000..66d0af37 --- /dev/null +++ b/include/linux/sched.h @@ -0,0 +1,17 @@ +/* + * linux/fs.h compatibility header + */ + +#ifndef __COMPAT_LINUX_POLL_H_ +#define __COMPAT_LINUX_POLL_H_ + +#include + +#if LINUX_VERSION_CODE < 0x020200 +#define signal_pending(x) (((x)->signal) & (~(x)->blocked)) +#endif + +#include_next + +#endif + diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index aa71cbf7..8588796a 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -7,11 +7,32 @@ #include +#if LINUX_VERSION_CODE < 0x020100 +/* no spinlocks */ +typedef int spinlock_t; + +#define spin_lock_init(lock) do { } while(0) +#define spin_lock(lock) (void)(lock) /* Not "unused variable". */ +#define spin_trylock(lock) (1) +#define spin_unlock_wait(lock) do { } while(0) +#define spin_unlock(lock) do { } while(0) +#define spin_lock_irq(lock) cli() +#define spin_unlock_irq(lock) sti() + +#define spin_lock_irqsave(lock, flags) \ + do { save_flags(flags); cli(); } while (0) +#define spin_unlock_irqrestore(lock, flags) \ + restore_flags(flags) + +#define SPIN_LOCK_UNLOCKED 0 + +#else #if LINUX_VERSION_CODE < 0x020300 #include #else #include_next #endif +#endif #endif /* _COMPAT_SPINLOCK_H */ diff --git a/include/linux/timer.h b/include/linux/timer.h new file mode 100644 index 00000000..2b0f113b --- /dev/null +++ b/include/linux/timer.h @@ -0,0 +1,18 @@ +/* + * linux/timer.h compatibility header + */ + +#ifndef __COMPAT_LINUX_TIMER_H_ +#define __COMPAT_LINUX_TIMER_H_ + +#include + +#if LINUX_VERSION_CODE < 0x020200 + +#define mod_timer(a,b) do{del_timer((a));(a)->expires=(b);add_timer((a));}while(0) +#endif + +#include_next + +#endif + diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h new file mode 100644 index 00000000..def457c7 --- /dev/null +++ b/include/linux/vmalloc.h @@ -0,0 +1,17 @@ +/* + * linux/vmalloc.h compatibility header + */ + +#ifndef __COMPAT_LINUX_VMALLOC_H_ +#define __COMPAT_LINUX_VMALLOC_H_ + +#include + +#if LINUX_VERSION_CODE < 0x020200 + +#else +#include_next +#endif + +#endif + -- 2.26.2