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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Feb 28 10:46:35 2015 +0100

cobalt: fixups for kernel 3.18

---

 include/cobalt/kernel/apc.h                          |    2 +-
 include/cobalt/kernel/sched.h                        |    2 +-
 include/cobalt/kernel/stat.h                         |    2 +-
 include/cobalt/kernel/timer.h                        |    2 +-
 kernel/cobalt/apc.c                                  |    4 ++--
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h |    7 +++++++
 kernel/cobalt/intr.c                                 |    4 ++--
 kernel/cobalt/posix/process.c                        |    2 +-
 8 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/include/cobalt/kernel/apc.h b/include/cobalt/kernel/apc.h
index 1009c2d..7075ad0 100644
--- a/include/cobalt/kernel/apc.h
+++ b/include/cobalt/kernel/apc.h
@@ -35,7 +35,7 @@ void xnapc_free(int apc);
 
 static inline void __xnapc_schedule(int apc)
 {
-       unsigned long *p = 
&__this_cpu_ptr(&cobalt_machine_cpudata)->apc_pending;
+       unsigned long *p = &raw_cpu_ptr(&cobalt_machine_cpudata)->apc_pending;
 
        if (!__test_and_set_bit(apc, p))
                ipipe_post_irq_root(cobalt_pipeline.apc_virq);
diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index c9b86fb..1a2c6eb 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -190,7 +190,7 @@ static inline struct xnsched *xnsched_struct(int cpu)
 static inline struct xnsched *xnsched_current(void)
 {
        /* IRQs off */
-       return __this_cpu_ptr(&nksched);
+       return raw_cpu_ptr(&nksched);
 }
 
 static inline struct xnthread *xnsched_current_thread(void)
diff --git a/include/cobalt/kernel/stat.h b/include/cobalt/kernel/stat.h
index 713ade4..2e06514 100644
--- a/include/cobalt/kernel/stat.h
+++ b/include/cobalt/kernel/stat.h
@@ -37,7 +37,7 @@ typedef struct xnstat_exectime {
 
 } xnstat_exectime_t;
 
-#define xnstat_percpu_data                                     
__this_cpu_ptr(nktimer.stats)
+#define xnstat_percpu_data     raw_cpu_ptr(nktimer.stats)
 
 /* Return current date which can be passed to other xnstat services for
    immediate or lazy accounting. */
diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index f7a80ab..60f900b 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -185,7 +185,7 @@ xnclock_percpu_timerdata(struct xnclock *clock, int cpu)
 static inline struct xntimerdata *
 xnclock_this_timerdata(struct xnclock *clock)
 {
-       return __this_cpu_ptr(clock->timerdata);
+       return raw_cpu_ptr(clock->timerdata);
 }
 
 struct xntimer {
diff --git a/kernel/cobalt/apc.c b/kernel/cobalt/apc.c
index 3fb337a..3383a26 100644
--- a/kernel/cobalt/apc.c
+++ b/kernel/cobalt/apc.c
@@ -58,13 +58,13 @@ void apc_dispatch(unsigned int virq, void *arg)
        spin_lock(&apc_lock);
 
        /* This is atomic linux context (non-threaded IRQ). */
-       p = &__this_cpu_ptr(&cobalt_machine_cpudata)->apc_pending;
+       p = &raw_cpu_ptr(&cobalt_machine_cpudata)->apc_pending;
        while (*p) {
                apc = ffnz(*p);
                clear_bit(apc, p);
                handler = cobalt_pipeline.apc_table[apc].handler;
                cookie = cobalt_pipeline.apc_table[apc].cookie;
-               __this_cpu_ptr(&cobalt_machine_cpudata)->apc_shots[apc]++;
+               raw_cpu_ptr(&cobalt_machine_cpudata)->apc_shots[apc]++;
                spin_unlock(&apc_lock);
                handler(cookie);
                spin_lock(&apc_lock);
diff --git a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h 
b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
index efba9b0..2a2172d 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
@@ -34,6 +34,9 @@
  * - keep the conditional structure flat, no nesting (e.g. do not nest
  *   the pre-3.11 conditions into the pre-3.14 ones).
  * - group all wrappers which share the same condition.
+ * - identify the first kernel release for which the wrapper should
+ *   be defined, instead of testing the existence of a preprocessor
+ *   symbol, so that obsolete wrappers can be spotted.
  */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
@@ -48,6 +51,10 @@
 #define get_current_uuid() from_kuid_munged(current_user_ns(), current_uid())
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
+#define raw_cpu_ptr(v) __this_cpu_ptr(v)
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
 #define smp_mb__before_atomic()  smp_mb()
 #define smp_mb__after_atomic()   smp_mb()
diff --git a/kernel/cobalt/intr.c b/kernel/cobalt/intr.c
index 19fcc2c..50ff595 100644
--- a/kernel/cobalt/intr.c
+++ b/kernel/cobalt/intr.c
@@ -118,7 +118,7 @@ static void inc_irqstats(struct xnintr *intr, struct 
xnsched *sched, xnticks_t s
 {
        struct xnirqstat *statp;
 
-       statp = __this_cpu_ptr(intr->stats);
+       statp = raw_cpu_ptr(intr->stats);
        xnstat_counter_inc(&statp->hits);
        xnstat_exectime_lazy_switch(sched, &statp->account, start);
 }
@@ -127,7 +127,7 @@ static inline void switch_irqstats(struct xnintr *intr, 
struct xnsched *sched)
 {
        struct xnirqstat *statp;
 
-       statp = __this_cpu_ptr(intr->stats);
+       statp = raw_cpu_ptr(intr->stats);
        xnstat_exectime_switch(sched, &statp->account);
 }
 
diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index 7fedf43..dfcce4c 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -775,7 +775,7 @@ int ipipe_trap_hook(struct ipipe_trap_data *data)
         * No migration is possible on behalf of the head domain, so
         * the following access is safe.
         */
-       __this_cpu_ptr(&cobalt_machine_cpudata)->faults[data->exception]++;
+       raw_cpu_ptr(&cobalt_machine_cpudata)->faults[data->exception]++;
 
        if (handle_exception(data))
                return KEVENT_STOP;


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

Reply via email to