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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Tue Apr 20 13:26:19 2010 +0200

debug: fix CONFIG_XENO_OPT_DEBUG_* issues

We have some #ifdef CONFIG_XENO_OPT_DEBUG_FOO, it is incompatible with
XENO_DEBUG(FOO), XENO_BUGON(FOO, ...) etc... And we also have some duplicate
initializations of CONFIG_XENO_OPT_DEBUG* symbols.

So, this commit:
- replaces these #ifdef with #if XENO_DEBUG(FOO)
- moves all the symbols initializations which were duplicated to
include/nucleus/assert.h.

We also added a script run at build-test time in order to detect such errors
in the future.

---

 include/nucleus/assert.h         |   37 ++++++++++++++--------
 include/nucleus/bheap.h          |    8 +---
 include/nucleus/heap.h           |    4 --
 include/nucleus/pod.h            |    8 ++--
 include/nucleus/queue.h          |    4 --
 include/nucleus/sched-sporadic.h |    4 --
 include/nucleus/sched.h          |    6 +---
 include/nucleus/synch.h          |   10 ++++--
 ksrc/nucleus/bufd.c              |    6 +---
 ksrc/nucleus/pod.c               |   64 ++++++++++++++++++--------------------
 ksrc/nucleus/sched.c             |   12 ++-----
 ksrc/nucleus/shadow.c            |   50 +++++++++++++----------------
 ksrc/nucleus/synch.c             |   24 ++++++--------
 src/skins/native/mutex.c         |    2 +-
 14 files changed, 107 insertions(+), 132 deletions(-)

diff --git a/include/nucleus/assert.h b/include/nucleus/assert.h
index 9cb88af..133bf74 100644
--- a/include/nucleus/assert.h
+++ b/include/nucleus/assert.h
@@ -22,20 +22,31 @@
 
 #include <nucleus/types.h>
 
-#define XENO_DEBUG(subsystem)   (CONFIG_XENO_OPT_DEBUG_##subsystem > 0)
+#define XENO_DEBUG(subsystem)                  \
+       (CONFIG_XENO_OPT_DEBUG_##subsystem > 0)
 
-#define XENO_ASSERT(subsystem,cond,action)  do { \
-    if (unlikely(CONFIG_XENO_OPT_DEBUG_##subsystem > 0 && !(cond))) { \
-        xnarch_trace_panic_freeze(); \
-        xnlogerr("assertion failed at %s:%d (%s)\n", __FILE__, __LINE__, 
(#cond)); \
-        xnarch_trace_panic_dump(); \
-        action; \
-    } \
-} while(0)
+#define XENO_ASSERT(subsystem,cond,action)  do {                       \
+               if (unlikely(XENO_DEBUG(subsystem) && !(cond))) {       \
+                       xnarch_trace_panic_freeze();                    \
+                       xnlogerr("assertion failed at %s:%d (%s)\n",    \
+                                __FILE__, __LINE__, (#cond));          \
+                       xnarch_trace_panic_dump();                      \
+                       action;                                         \
+               }                                                       \
+       } while(0)
 
-#define XENO_BUGON(subsystem,cond)  do { \
-    if (unlikely(CONFIG_XENO_OPT_DEBUG_##subsystem > 0 && (cond))) \
-        xnpod_fatal("bug at %s:%d (%s)", __FILE__, __LINE__, (#cond)); \
-} while(0)
+#define XENO_BUGON(subsystem,cond)                                     \
+       do {                                                            \
+               if (unlikely(XENO_DEBUG(subsystem) && (cond)))          \
+                       xnpod_fatal("bug at %s:%d (%s)",                \
+                                   __FILE__, __LINE__, (#cond));       \
+       } while(0)
+
+#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
+#define CONFIG_XENO_OPT_DEBUG_QUEUES 0
+#endif /* CONFIG_XENO_OPT_DEBUG_QUEUES */
+#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
+#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
+#endif /* CONFIG_XENO_OPT_DEBUG_NUCLEUS */
 
 #endif /* !_XENO_NUCLEUS_ASSERT_H */
diff --git a/include/nucleus/bheap.h b/include/nucleus/bheap.h
index 8b7798e..58ea93f 100644
--- a/include/nucleus/bheap.h
+++ b/include/nucleus/bheap.h
@@ -25,10 +25,6 @@
 /* debug support */
 #include <nucleus/assert.h>
 
-#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
-#define CONFIG_XENO_OPT_DEBUG_QUEUES 0
-#endif
-
 /* Priority queue implementation, using a binary heap. */
 
 typedef unsigned long long bheap_key_t;
@@ -44,8 +40,8 @@ typedef struct bheaph {
 #define bheaph_prio(holder) ((holder)->prio)
 #define bheaph_pos(holder)  ((holder)->pos)
 #define bheaph_lt(h1, h2)   ((long long) ((h1)->key - (h2)->key) < 0 ||        
\
-                             ((h1)->key == (h2)->key &&                        
\
-                              (h1)->prio > (h2)->prio))
+                            ((h1)->key == (h2)->key &&                 \
+                             (h1)->prio > (h2)->prio))
 
 typedef struct bheap {
        unsigned sz;
diff --git a/include/nucleus/heap.h b/include/nucleus/heap.h
index 77fefa6..fecdb79 100644
--- a/include/nucleus/heap.h
+++ b/include/nucleus/heap.h
@@ -46,10 +46,6 @@
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
 
-#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
-#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
-#endif
-
 #define XNHEAP_PAGE_SIZE       512 /* A reasonable value for the xnheap page 
size */
 #define XNHEAP_PAGE_MASK       (~(XNHEAP_PAGE_SIZE-1))
 #define XNHEAP_PAGE_ALIGN(addr)        
(((addr)+XNHEAP_PAGE_SIZE-1)&XNHEAP_PAGE_MASK)
diff --git a/include/nucleus/pod.h b/include/nucleus/pod.h
index e652a1e..8831fb5 100644
--- a/include/nucleus/pod.h
+++ b/include/nucleus/pod.h
@@ -58,7 +58,7 @@
 
 struct xnsynch;
 
-/*! 
+/*!
  * \brief Real-time pod descriptor.
  *
  * The source of all Xenomai magic.
@@ -276,14 +276,14 @@ static inline void xnpod_schedule(void)
         * context is active, or if we are caught in the middle of a
         * unlocked context switch.
         */
-#ifdef CONFIG_XENO_OPT_DEBUG_NUCLEUS
+#if XENO_DEBUG(NUCLEUS)
        if (testbits(sched->status, XNKCOUT|XNINIRQ|XNSWLOCK))
                return;
-#else /* !CONFIG_XENO_OPT_DEBUG_NUCLEUS */
+#else /* !XENO_DEBUG(NUCLEUS) */
        if (testbits(sched->status,
                     XNKCOUT|XNINIRQ|XNSWLOCK|XNRESCHED) != XNRESCHED)
                return;
-#endif /* !CONFIG_XENO_OPT_DEBUG_NUCLEUS */
+#endif /* !XENO_DEBUG(NUCLEUS) */
 
        __xnpod_schedule(sched);
 }
diff --git a/include/nucleus/queue.h b/include/nucleus/queue.h
index e243f2f..15ec537 100644
--- a/include/nucleus/queue.h
+++ b/include/nucleus/queue.h
@@ -24,10 +24,6 @@
 #include <nucleus/types.h>
 #include <nucleus/assert.h>
 
-#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
-#define CONFIG_XENO_OPT_DEBUG_QUEUES 0
-#endif
-
 /* Basic element holder */
 
 typedef struct xnholder {
diff --git a/include/nucleus/sched-sporadic.h b/include/nucleus/sched-sporadic.h
index ecebc55..dfeec76 100644
--- a/include/nucleus/sched-sporadic.h
+++ b/include/nucleus/sched-sporadic.h
@@ -29,10 +29,6 @@
 
 #ifdef CONFIG_XENO_OPT_SCHED_SPORADIC
 
-#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
-#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
-#endif
-
 #include <nucleus/heap.h>
 
 extern struct xnsched_class xnsched_class_sporadic;
diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h
index c96d65d..05dd4b1 100644
--- a/include/nucleus/sched.h
+++ b/include/nucleus/sched.h
@@ -36,10 +36,6 @@
 #include <nucleus/sched-tp.h>
 #include <nucleus/sched-sporadic.h>
 
-#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
-#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
-#endif
-
 /* Sched status flags */
 #define XNKCOUT                0x80000000      /* Sched callout context */
 #define XNHTICK                0x40000000      /* Host tick pending  */
@@ -57,7 +53,7 @@ struct xnsched_rt {
 #endif /* CONFIG_XENO_OPT_PRIOCPL */
 };
 
-/*! 
+/*!
  * \brief Scheduling information structure.
  */
 
diff --git a/include/nucleus/synch.h b/include/nucleus/synch.h
index bd9dbbc..7deae21 100644
--- a/include/nucleus/synch.h
+++ b/include/nucleus/synch.h
@@ -32,6 +32,10 @@
 #define XNSYNCH_DREORD  0x4
 #define XNSYNCH_OWNER   0x8
 
+#ifndef CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX
+#define CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX 0
+#endif /* CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX */
+
 #ifdef CONFIG_XENO_FASTSYNCH
 
 /* Fast lock API */
@@ -157,14 +161,14 @@ typedef struct xnsynch {
 extern "C" {
 #endif
 
-#ifdef CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX
+#if XENO_DEBUG(SYNCH_RELAX)
 
 void xnsynch_detect_relaxed_owner(struct xnsynch *synch,
                                  struct xnthread *sleeper);
 
 void xnsynch_detect_claimed_relax(struct xnthread *owner);
 
-#else /* !CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX */
+#else /* !XENO_DEBUG(SYNCH_RELAX) */
 
 static inline void xnsynch_detect_relaxed_owner(struct xnsynch *synch,
                                  struct xnthread *sleeper)
@@ -175,7 +179,7 @@ static inline void xnsynch_detect_claimed_relax(struct 
xnthread *owner)
 {
 }
 
-#endif /* !CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX */
+#endif /* !XENO_DEBUG(SYNCH_RELAX) */
 
 void xnsynch_init(struct xnsynch *synch, xnflags_t flags,
                  xnarch_atomic_t *fastlock);
diff --git a/ksrc/nucleus/bufd.c b/ksrc/nucleus/bufd.c
index 8dd655c..d7a7b00 100644
--- a/ksrc/nucleus/bufd.c
+++ b/ksrc/nucleus/bufd.c
@@ -58,7 +58,7 @@
  *
  *       ret = this_may_fail();
  *       if (ret)
- *            xnbufd_invalidate(bufd);
+ *            xnbufd_invalidate(bufd);
  *
  *       return ret;
  *   }
@@ -146,10 +146,6 @@
 #include <nucleus/bufd.h>
 #include <nucleus/assert.h>
 
-#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
-#define CONFIG_XENO_OPT_DEBUG_NUCLEUS  0
-#endif
-
 #ifdef CONFIG_XENO_OPT_PERVASIVE
 
 #include <asm/xenomai/syscall.h>
diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 93713f2..3ffd548 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -46,10 +46,6 @@
 #include <nucleus/select.h>
 #include <asm/xenomai/bits/pod.h>
 
-#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
-#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
-#endif
-
 /*
  * NOTE: We need to initialize the globals; remember that this code
  * also runs over the simulator in user-space.
@@ -318,7 +314,7 @@ static void xnpod_flush_stackpool(xnheap_t *heap,
 }
 #endif
 
-/*! 
+/*!
  * \fn int xnpod_init(void)
  * \brief Initialize the core pod.
  *
@@ -438,7 +434,7 @@ int xnpod_init(void)
 }
 EXPORT_SYMBOL_GPL(xnpod_init);
 
-/*! 
+/*!
  * \fn void xnpod_shutdown(int xtype)
  * \brief Shutdown the current pod.
  *
@@ -543,7 +539,7 @@ void xnpod_fire_callouts(xnqueue_t *hookq, xnthread_t 
*thread)
        __clrbits(sched->status, XNKCOUT);
 }
 
-/*! 
+/*!
  * \fn void xnpod_init_thread(struct xnthread *thread,const struct 
xnthread_init_attr *attr,struct xnsched_class *sched_class,const union 
xnsched_policy_param *sched_param)
  * \brief Initialize a new thread.
  *
@@ -665,7 +661,7 @@ int xnpod_init_thread(struct xnthread *thread,
 }
 EXPORT_SYMBOL_GPL(xnpod_init_thread);
 
-/*! 
+/*!
  * \fn int xnpod_start_thread(struct xnthread *thread,const struct 
xnthread_start_attr *attr)
  * \brief Initial start of a newly created thread.
  *
@@ -824,7 +820,7 @@ unlock_and_exit:
 }
 EXPORT_SYMBOL_GPL(xnpod_start_thread);
 
-/*! 
+/*!
  * @internal
  * \fn void __xnpod_reset_thread(struct xnthread *thread, int unlock)
  * \brief Reset the thread.
@@ -861,7 +857,7 @@ void __xnpod_reset_thread(struct xnthread *thread)
        }
 }
 
-/*! 
+/*!
  * \fn void xnpod_stop_thread(xnthread_t *thread)
  *
  * \brief Stop a thread.
@@ -907,7 +903,7 @@ void xnpod_stop_thread(struct xnthread *thread)
 }
 EXPORT_SYMBOL_GPL(xnpod_stop_thread);
 
-/*! 
+/*!
  * \fn void xnpod_restart_thread(xnthread_t *thread)
  *
  * \brief Restart a thread.
@@ -968,7 +964,7 @@ void xnpod_restart_thread(xnthread_t *thread)
 }
 EXPORT_SYMBOL_GPL(xnpod_restart_thread);
 
-/*! 
+/*!
  * \fn void xnpod_set_thread_mode(xnthread_t *thread,xnflags_t 
clrmask,xnflags_t setmask)
  * \brief Change a thread's control mode.
  *
@@ -1043,7 +1039,7 @@ xnflags_t xnpod_set_thread_mode(xnthread_t *thread,
 }
 EXPORT_SYMBOL_GPL(xnpod_set_thread_mode);
 
-/*! 
+/*!
  * \fn void xnpod_delete_thread(xnthread_t *thread)
  *
  * \brief Delete a thread.
@@ -1247,7 +1243,7 @@ void xnpod_delete_thread(xnthread_t *thread)
 }
 EXPORT_SYMBOL_GPL(xnpod_delete_thread);
 
-/*! 
+/*!
  * \fn void xnpod_abort_thread(xnthread_t *thread)
  *
  * \brief Abort a thread.
@@ -1408,9 +1404,9 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t 
mask,
                 * the wakeup call pending for that task in the root
                 * context, to collect and act upon the pending Linux
                 * signal.
-                */
-               if ((mask & XNRELAX) == 0 
-                   && (xnthread_sigpending(thread) 
+                */
+               if ((mask & XNRELAX) == 0
+                   && (xnthread_sigpending(thread)
                        || xnthread_test_info(thread, XNKICKED))) {
                        xnthread_clear_info(thread, XNRMID | XNTIMEO);
                        xnthread_set_info(thread, XNBREAK);
@@ -1495,7 +1491,7 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t 
mask,
         * those. So there is no need to deal specifically with the
         * relax+suspend issue when the about to be suspended thread
         * is current, since it must not be relaxed anyway.
-        * 
+        *
         * - among all blocking bits (XNTHREAD_BLOCK_BITS), only
         * XNSUSP, XNDELAY, XNDORMANT and XNHELD may be applied by the
         * current thread to a non-current thread. XNPEND is always
@@ -1900,16 +1896,16 @@ unlock_and_exit:
        return ret;
 }
 
-/** 
+/**
  * \fn int xnpod_migrate_thread(int cpu)
  *
  * \brief Migrate the current thread.
  *
  * This call makes the current thread migrate to another CPU if its
  * affinity allows it.
- * 
+ *
  * @param cpu The destination CPU.
- * 
+ *
  * @retval 0 if the thread could migrate ;
  * @retval -EPERM if the calling context is asynchronous, or the
  * current thread affinity forbids this migration ;
@@ -1971,7 +1967,7 @@ int xnpod_migrate_thread(int cpu)
 }
 EXPORT_SYMBOL_GPL(xnpod_migrate_thread);
 
-/*! 
+/*!
  * @internal
  * \fn void xnpod_dispatch_signals(void)
  * \brief Deliver pending asynchronous signals to the running thread.
@@ -2079,7 +2075,7 @@ static inline void xnpod_switch_to(xnsched_t *sched,
                         xnthread_archtcb(next));
 }
 
-/*! 
+/*!
  * \fn void xnpod_schedule(void)
  * \brief Rescheduling procedure entry point.
  *
@@ -2133,7 +2129,7 @@ static inline void xnpod_switch_to(xnsched_t *sched,
  * context switch has taken place. This behaviour can be disabled by
  * setting the XNASDI flag in the thread's status mask by calling
  * xnpod_set_thread_mode().
- * 
+ *
  * Environments:
  *
  * This service can be called from:
@@ -2149,7 +2145,7 @@ static inline void xnpod_switch_to(xnsched_t *sched,
 static inline int __xnpod_test_resched(struct xnsched *sched)
 {
        int cpu = xnsched_cpu(sched), resched;
-       
+
        resched = xnarch_cpu_isset(cpu, sched->resched);
        xnarch_cpu_clear(cpu, sched->resched);
 #ifdef CONFIG_SMP
@@ -2181,10 +2177,10 @@ void __xnpod_schedule(struct xnsched *sched)
                         xnthread_current_priority(curr));
 
        need_resched = __xnpod_test_resched(sched);
-#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
+#if !XENO_DEBUG(NUCLEUS)
        if (!need_resched)
                goto signal_unlock_and_exit;
-#endif /* !CONFIG_XENO_OPT_DEBUG_NUCLEUS */
+#endif /* !XENO_DEBUG(NUCLEUS) */
        zombie = xnthread_test_state(curr, XNZOMBIE);
 
        next = xnsched_pick_next(sched);
@@ -2293,7 +2289,7 @@ void __xnpod_schedule(struct xnsched *sched)
        {
                spl_t ignored;
 
-               /* Shadow on entry and root without shadow extension on exit? 
+               /* Shadow on entry and root without shadow extension on exit?
                   Mmmm... This must be the user-space mate of a deleted 
real-time
                   shadow we've just rescheduled in the Linux domain to have it
                   exit properly.  Reap it now. */
@@ -2348,7 +2344,7 @@ void xnpod_unlock_sched(void)
 }
 EXPORT_SYMBOL_GPL(xnpod_unlock_sched);
 
-/*! 
+/*!
  * \fn int xnpod_add_hook(int type,void (*routine)(xnthread_t *))
  * \brief Install a nucleus hook.
  *
@@ -2441,7 +2437,7 @@ int xnpod_add_hook(int type, void (*routine) (xnthread_t 
*))
 }
 EXPORT_SYMBOL_GPL(xnpod_add_hook);
 
-/*! 
+/*!
  * \fn int xnpod_remove_hook(int type,void (*routine)(xnthread_t *))
  * \brief Remove a nucleus hook.
  *
@@ -2518,7 +2514,7 @@ int xnpod_remove_hook(int type, void (*routine) 
(xnthread_t *))
 }
 EXPORT_SYMBOL_GPL(xnpod_remove_hook);
 
-/*! 
+/*!
  * \fn void xnpod_trap_fault(xnarch_fltinfo_t *fltinfo);
  * \brief Default fault handler.
  *
@@ -2609,7 +2605,7 @@ int xnpod_trap_fault(xnarch_fltinfo_t *fltinfo)
 }
 EXPORT_SYMBOL_GPL(xnpod_trap_fault);
 
-/*! 
+/*!
  * \fn int xnpod_enable_timesource(void)
  * \brief Activate the core time source.
  *
@@ -2750,7 +2746,7 @@ int xnpod_enable_timesource(void)
 }
 EXPORT_SYMBOL_GPL(xnpod_enable_timesource);
 
-/*! 
+/*!
  * \fn void xnpod_disable_timesource(void)
  * \brief Stop the core time source.
  *
@@ -3055,7 +3051,7 @@ int xnpod_set_thread_tslice(struct xnthread *thread, 
xnticks_t quantum)
        unsigned long oldmode;
        int aperiodic;
        spl_t s;
-       
+
        if (thread->base_class->sched_tick == NULL)
                return -EINVAL;
 
diff --git a/ksrc/nucleus/sched.c b/ksrc/nucleus/sched.c
index 4ec0013..0b737a3 100644
--- a/ksrc/nucleus/sched.c
+++ b/ksrc/nucleus/sched.c
@@ -66,7 +66,7 @@ static u_long wd_timeout_arg = 
CONFIG_XENO_OPT_WATCHDOG_TIMEOUT;
 module_param_named(watchdog_timeout, wd_timeout_arg, ulong, 0644);
 MODULE_PARM_DESC(watchdog_timeout, "Watchdog timeout (s)");
 
-/*! 
+/*!
  * @internal
  * \fn void xnsched_watchdog_handler(struct xntimer *timer)
  * \brief Process watchdog ticks.
@@ -307,7 +307,7 @@ struct xnthread *xnsched_peek_rpi(struct xnsched *sched)
 #endif /* CONFIG_XENO_OPT_SCHED_CLASSES */
 }
 
-/*! 
+/*!
  * @internal
  * \fn void xnsched_renice_root(struct xnsched *sched, struct xnthread *target)
  * \brief Change the root thread priority.
@@ -529,10 +529,6 @@ void xnsched_migrate_passive(struct xnthread *thread, 
struct xnsched *sched)
 
 #ifdef CONFIG_XENO_OPT_SCALABLE_SCHED
 
-#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
-#define CONFIG_XENO_OPT_DEBUG_QUEUES 0
-#endif
-
 void initmlq(struct xnsched_mlq *q, int loprio, int hiprio)
 {
        int prio;
@@ -546,7 +542,7 @@ void initmlq(struct xnsched_mlq *q, int loprio, int hiprio)
        for (prio = 0; prio < XNSCHED_MLQ_LEVELS; prio++)
                initq(&q->queue[prio]);
 
-       XENO_ASSERT(QUEUES, 
+       XENO_ASSERT(QUEUES,
                    hiprio - loprio + 1 < XNSCHED_MLQ_LEVELS,
                    xnpod_fatal("priority range [%d..%d] is beyond multi-level "
                                "queue indexing capabilities",
@@ -706,7 +702,7 @@ struct sched_seq_iterator {
                int cprio;
                int dnprio;
                int periodic;
-               xnticks_t timeout;
+               xnticks_t timeout;
                xnflags_t state;
        } sched_info[1];
 };
diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 539d952..872c37f 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -55,10 +55,6 @@
 #include <asm/xenomai/syscall.h>
 #include <asm/xenomai/bits/shadow.h>
 
-#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
-#define CONFIG_XENO_OPT_DEBUG_NUCLEUS  0
-#endif
-
 static int xn_gid_arg = -1;
 module_param_named(xenomai_gid, xn_gid_arg, int, 0644);
 MODULE_PARM_DESC(xenomai_gid, "GID of the group with access to Xenomai 
services");
@@ -179,7 +175,7 @@ static struct xnthread *rpi_next(struct xnsched *sched, 
spl_t s)
        struct xnthread *thread;
 
        thread = xnsched_peek_rpi(sched);
-       while (thread && 
+       while (thread &&
               xnthread_user_task(thread)->state != TASK_RUNNING &&
               !xnthread_test_info(thread, XNATOMIC)) {
                /*
@@ -458,7 +454,7 @@ static inline void rpi_switch(struct task_struct *next_task)
                        next->rpi = sched;
                        xnlock_put_irqrestore(&sched->rpilock, s);
                        xnlock_get_irqsave(&nklock, s);
-                       xnsched_resume_rpi(next);
+                       xnsched_resume_rpi(next);
                        xnlock_put_irqrestore(&nklock, s);
                }
        } else if (unlikely(next->rpi != sched))
@@ -500,17 +496,17 @@ void xnshadow_rpi_check(void)
        struct xnsched *sched = xnpod_current_sched();
        struct xnthread *top;
        spl_t s;
- 
-       xnlock_get_irqsave(&sched->rpilock, s);
-       top = rpi_next(sched, s);
-       xnlock_put_irqrestore(&sched->rpilock, s);
+
+       xnlock_get_irqsave(&sched->rpilock, s);
+       top = rpi_next(sched, s);
+       xnlock_put_irqrestore(&sched->rpilock, s);
 
        if (top == NULL && xnsched_root_class(sched) != &xnsched_class_idle)
                xnsched_renice_root(sched, NULL);
 }
 
 #endif /* CONFIG_SMP */
- 
+
 #else
 
 #define rpi_p(t)               (0)
@@ -660,14 +656,14 @@ static inline void ppd_remove_mm(struct mm_struct *mm,
        xnlock_put_irqrestore(&nklock, s);
 }
 
-/** 
+/**
  * Mark the per-thread per-skin signal condition for the skin whose
  * muxid is @a muxid.
- * 
+ *
  * @param thread the target thread;
  * @param muxid the muxid of the skin for which the signal is marked
  * pending.
- * 
+ *
  * @return whether rescheduling is needed.
  */
 int xnshadow_mark_sig(xnthread_t *thread, unsigned muxid)
@@ -687,13 +683,13 @@ int xnshadow_mark_sig(xnthread_t *thread, unsigned muxid)
 }
 EXPORT_SYMBOL_GPL(xnshadow_mark_sig);
 
-/** 
+/**
  * Clear the per-thrad per-skin signal condition.
- * 
+ *
  * Called with nklock locked irqs off.
  *
  * @param thread the target thrad
- * @param muxid 
+ * @param muxid
  */
 void xnshadow_clear_sig(xnthread_t *thread, unsigned muxid)
 {
@@ -754,7 +750,7 @@ static inline void handle_rt_signals(xnthread_t *thread,
 /* In the case when we are going to handle linux signals, do not let
    the kernel handle the syscall restart to give a chance to the
    xenomai handlers to be executed. */
-       if (__xn_interrupted_p(regs) 
+       if (__xn_interrupted_p(regs)
            || __xn_reg_rval(regs) == -ERESTARTSYS
            || __xn_reg_rval(regs) == -ERESTARTNOHAND)
                __xn_error_return(regs, ((sysflags & __xn_exec_norestart)
@@ -902,7 +898,7 @@ static void schedule_linux_call(int type, struct 
task_struct *p, int arg)
        rq->req[reqnum].type = type;
        rq->req[reqnum].task = p;
        rq->req[reqnum].arg = arg;
-       
+
        splexit(s);
 
        rthal_apc_schedule(lostage_apc);
@@ -979,7 +975,7 @@ static int gatekeeper_thread(void *data)
        return 0;
 }
 
-/*! 
+/*!
  * @internal
  * \fn int xnshadow_harden(void);
  * \brief Migrate a Linux task to the Xenomai domain.
@@ -1111,7 +1107,7 @@ redo:
 }
 EXPORT_SYMBOL_GPL(xnshadow_harden);
 
-/*! 
+/*!
  * @internal
  * \fn void xnshadow_relax(int notify, int reason);
  * \brief Switch a shadow thread back to the Linux domain.
@@ -1280,7 +1276,7 @@ void xnshadow_exit(void)
  *
  * This service can be called from:
  *
- * - Regular user-space process. 
+ * - Regular user-space process.
  *
  * Rescheduling: always.
  *
@@ -1365,10 +1361,10 @@ int xnshadow_map(xnthread_t *thread, xncompletion_t 
__user *u_completion,
                 */
                xnshadow_renice(thread);
 
-               /*
+               /*
                 * We still have the XNDORMANT bit set, so we can't
-                * link to the RPI queue which only links _runnable_
-                * relaxed shadow.
+                * link to the RPI queue which only links _runnable_
+                * relaxed shadow.
                 */
                xnshadow_signal_completion(u_completion, 0);
                return 0;
@@ -1994,7 +1990,7 @@ static xnsysent_t __systab[] = {
        [__xn_sys_current] = {&xnshadow_sys_current, __xn_exec_any},
        [__xn_sys_current_info] =
                {&xnshadow_sys_current_info, __xn_exec_shadow},
-       [__xn_sys_get_next_sigs] = 
+       [__xn_sys_get_next_sigs] =
                {&xnshadow_sys_get_next_sigs, __xn_exec_conforming},
        [__xn_sys_drop_u_mode] =
                {&xnshadow_sys_drop_u_mode, __xn_exec_shadow},
@@ -2748,7 +2744,7 @@ EXPORT_SYMBOL_GPL(xnshadow_unregister_interface);
  *
  * @return the per-process data if the current context is a user-space process;
  * @return NULL otherwise.
- * 
+ *
  */
 xnshadow_ppd_t *xnshadow_ppd_get(unsigned muxid)
 {
diff --git a/ksrc/nucleus/synch.c b/ksrc/nucleus/synch.c
index 619929e..d57f7cd 100644
--- a/ksrc/nucleus/synch.c
+++ b/ksrc/nucleus/synch.c
@@ -36,14 +36,10 @@
 #include <nucleus/thread.h>
 #include <nucleus/module.h>
 
-#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
-#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
-#endif
-
 #define w_bprio(t)     xnsched_weighted_bprio(t)
 #define w_cprio(t)     xnsched_weighted_cprio(t)
 
-/*! 
+/*!
  * \fn void xnsynch_init(struct xnsynch *synch, xnflags_t flags,
  *                       xnarch_atomic_t *fastlock)
  *
@@ -360,7 +356,7 @@ static void xnsynch_renice_thread(struct xnthread *thread,
 #endif /* CONFIG_XENO_OPT_PERVASIVE */
 }
 
-/*! 
+/*!
  * \fn xnflags_t xnsynch_acquire(struct xnsynch *synch, xnticks_t timeout,
  *                               xntmode_t timeout_mode);
  * \brief Acquire the ownership of a synchronization object.
@@ -561,7 +557,7 @@ xnflags_t xnsynch_acquire(struct xnsynch *synch, xnticks_t 
timeout,
 }
 EXPORT_SYMBOL_GPL(xnsynch_acquire);
 
-/*! 
+/*!
  * @internal
  * \fn void xnsynch_clear_boost(struct xnsynch *synch, struct xnthread *owner);
  * \brief Clear the priority boost.
@@ -609,7 +605,7 @@ static void xnsynch_clear_boost(struct xnsynch *synch,
                xnsynch_renice_thread(owner, target);
 }
 
-/*! 
+/*!
  * @internal
  * \fn void xnsynch_requeue_sleeper(struct xnthread *thread);
  * \brief Change a sleeper's priority.
@@ -761,7 +757,7 @@ struct xnthread *xnsynch_release(struct xnsynch *synch)
 }
 EXPORT_SYMBOL_GPL(xnsynch_release);
 
-/*! 
+/*!
  * \fn struct xnthread *xnsynch_peek_pendq(struct xnsynch *synch);
  * \brief Access the thread leading a synch object wait queue.
  *
@@ -800,7 +796,7 @@ struct xnthread *xnsynch_peek_pendq(struct xnsynch *synch)
 }
 EXPORT_SYMBOL_GPL(xnsynch_peek_pendq);
 
-/*! 
+/*!
  * \fn void xnsynch_flush(struct xnsynch *synch, xnflags_t reason);
  * \brief Unblock all waiters pending on a resource.
  *
@@ -882,7 +878,7 @@ int xnsynch_flush(struct xnsynch *synch, xnflags_t reason)
 }
 EXPORT_SYMBOL_GPL(xnsynch_flush);
 
-/*! 
+/*!
  * @internal
  * \fn void xnsynch_forget_sleeper(struct xnthread *thread);
  * \brief Abort a wait for a resource.
@@ -947,7 +943,7 @@ void xnsynch_forget_sleeper(struct xnthread *thread)
 }
 EXPORT_SYMBOL_GPL(xnsynch_forget_sleeper);
 
-/*! 
+/*!
  * @internal
  * \fn void xnsynch_release_all_ownerships(struct xnthread *thread);
  * \brief Release all ownerships.
@@ -981,7 +977,7 @@ void xnsynch_release_all_ownerships(struct xnthread *thread)
 }
 EXPORT_SYMBOL_GPL(xnsynch_release_all_ownerships);
 
-#ifdef CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX
+#if XENO_DEBUG(SYNCH_RELAX)
 
 /*
  * Detect when a thread is about to sleep on a synchronization
@@ -1025,7 +1021,7 @@ void xnsynch_detect_claimed_relax(struct xnthread *owner)
        }
 }
 
-#endif /* CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX */
+#endif /* XENO_DEBUG(SYNCH_RELAX) */
 
 
 /*...@}*/
diff --git a/src/skins/native/mutex.c b/src/skins/native/mutex.c
index 98844ef..55d502f 100644
--- a/src/skins/native/mutex.c
+++ b/src/skins/native/mutex.c
@@ -103,7 +103,7 @@ static int rt_mutex_acquire_inner(RT_MUTEX *mutex, RTIME 
timeout, xntmode_t mode
                 * mutex state consistent.
                 *
                 * We make no efforts to migrate or warn here. There is
-                * CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX to catch such bugs.
+                * XENO_DEBUG(SYNCH_RELAX) to catch such bugs.
                 */
                if (mutex->lockcnt == UINT_MAX)
                        return -EAGAIN;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to