Module: xenomai-forge
Branch: master
Commit: 4698dcf7d1ce91c112a15dae0cd5cc88a0f393da
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=4698dcf7d1ce91c112a15dae0cd5cc88a0f393da

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Aug 20 12:02:27 2012 +0200

cobalt/generic: fix up for kernel 3.4 series

---

 include/asm-generic/atomic.h     |    1 -
 include/asm-generic/system.h     |    2 +-
 include/asm-generic/wrappers.h   |   39 ++++++++++++++++++++++++++++++++++++++
 kernel/cobalt/arch/generic/hal.c |    1 -
 kernel/cobalt/nucleus/pipe.c     |    1 -
 5 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 873d123..a7d05d2 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -28,7 +28,6 @@ typedef unsigned long atomic_flags_t;
 #ifdef __KERNEL__
 #include <linux/bitops.h>
 #include <asm/atomic.h>
-#include <asm/system.h>
 #include <asm/xenomai/wrappers.h>
 
 typedef atomic_long_t atomic_counter_t;
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
index 4af9f39..23dfd20 100644
--- a/include/asm-generic/system.h
+++ b/include/asm-generic/system.h
@@ -183,7 +183,7 @@ static inline int xnlock_dbg_release(struct xnlock *lock)
 typedef cpumask_t xnarch_cpumask_t;
 
 #ifdef CONFIG_SMP
-#define xnarch_cpu_online_map                  cpu_online_map
+#define xnarch_cpu_online_map                  (*cpu_online_mask)
 #else
 #define xnarch_cpu_online_map                  cpumask_of_cpu(0)
 #endif
diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index 868414b..dad33b3 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -56,4 +56,43 @@ static inline struct task_struct 
*wrap_find_task_by_pid(pid_t nr)
 #define pgprot_noncached(p) (p)
 #endif /* !pgprot_noncached */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+#include <asm/system.h>
+#define cpu_online_mask (&cpu_online_map)
+#else /* >= 3.4.0 */
+static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
+{
+        unsigned long __tmp = __fd / __NFDBITS;
+        unsigned long __rem = __fd % __NFDBITS;
+        __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
+}
+
+static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
+{
+        unsigned long __tmp = __fd / __NFDBITS;
+        unsigned long __rem = __fd % __NFDBITS;
+        __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
+}
+
+static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
+{
+        unsigned long __tmp = __fd / __NFDBITS;
+        unsigned long __rem = __fd % __NFDBITS;
+        return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
+}
+
+static inline void __FD_ZERO(__kernel_fd_set *__p)
+{
+       unsigned long *__tmp = __p->fds_bits;
+       int __i;
+
+       __i = __FDSET_LONGS;
+       while (__i) {
+               __i--;
+               *__tmp = 0;
+               __tmp++;
+       }
+}
+#endif /* >= 3.4.0 */
+
 #endif /* _XENO_ASM_GENERIC_WRAPPERS_H */
diff --git a/kernel/cobalt/arch/generic/hal.c b/kernel/cobalt/arch/generic/hal.c
index a2474e8..acd99ed 100644
--- a/kernel/cobalt/arch/generic/hal.c
+++ b/kernel/cobalt/arch/generic/hal.c
@@ -37,7 +37,6 @@
 #include <linux/bitops.h>
 #include <linux/hardirq.h>
 #include <linux/mm.h>
-#include <asm/system.h>
 #include <asm/irq.h>
 #include <asm/xenomai/hal.h>
 #ifdef CONFIG_PROC_FS
diff --git a/kernel/cobalt/nucleus/pipe.c b/kernel/cobalt/nucleus/pipe.c
index 8581cbf..ea2f9da 100644
--- a/kernel/cobalt/nucleus/pipe.c
+++ b/kernel/cobalt/nucleus/pipe.c
@@ -29,7 +29,6 @@
 #include <linux/device.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
-#include <asm/system.h>
 #include <nucleus/pod.h>
 #include <nucleus/heap.h>
 #include <nucleus/pipe.h>


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to