Commit a28d9cf5 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/kernel: always use explicit preprocessor conditionals

Testing debug switches using '#if XENO_DEBUG(<feat>)' may confuse the
build system's dependency tracker, breaking the build, or even
producing a non-bootable kernel in extreme cases. Typically, turning
on/off the lock debugging code - usually in absence of any other
change - may cause the following error to pop up at the link stage:
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent e45c5f23
......@@ -63,7 +63,7 @@
#define realtime_cpu_only() XENO_BUG_ON(CONTEXT, !xnsched_supported_cpu(ipipe_processor_id()))
#define thread_only() XENO_BUG_ON(CONTEXT, xnsched_interrupt_p())
#define irqoff_only() XENO_BUG_ON(CONTEXT, hard_irqs_disabled() == 0)
#if XENO_DEBUG(LOCKING)
#ifdef CONFIG_XENO_OPT_DEBUG_LOCKING
#define atomic_only() XENO_BUG_ON(CONTEXT, (xnlock_is_owner(&nklock) && hard_irqs_disabled()) == 0)
#define preemptible_only() XENO_BUG_ON(CONTEXT, xnlock_is_owner(&nklock) || hard_irqs_disabled())
#else
......
......@@ -63,7 +63,7 @@ typedef unsigned long spl_t;
*/
#define spltest() ipipe_test_head()
#if XENO_DEBUG(LOCKING)
#ifdef CONFIG_XENO_OPT_DEBUG_LOCKING
struct xnlock {
unsigned owner;
......@@ -152,7 +152,7 @@ static inline int xnlock_dbg_release(struct xnlock *lock)
#endif /* !XENO_DEBUG(LOCKING) */
#if defined(CONFIG_SMP) || XENO_DEBUG(LOCKING)
#if defined(CONFIG_SMP) || defined(CONFIG_XENO_OPT_DEBUG_LOCKING)
#define xnlock_get(lock) __xnlock_get(lock XNLOCK_DBG_CONTEXT)
#define xnlock_put(lock) __xnlock_put(lock XNLOCK_DBG_CONTEXT)
......@@ -209,7 +209,7 @@ int ___xnlock_get(struct xnlock *lock /*, */ XNLOCK_DBG_CONTEXT_ARGS);
void ___xnlock_put(struct xnlock *lock /*, */ XNLOCK_DBG_CONTEXT_ARGS);
#endif /* out of line xnlock */
#if XENO_DEBUG(LOCKING)
#ifdef CONFIG_XENO_OPT_DEBUG_LOCKING
/* Disable UP-over-SMP kernel optimization in debug mode. */
#define __locking_active__ 1
#else
......
......@@ -56,7 +56,7 @@ struct xnsched_sporadic_data {
};
struct xnsched_sporadic {
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
unsigned long drop_retries;
#endif
};
......
......@@ -101,7 +101,7 @@ static inline struct xnthread *xnsynch_owner(struct xnsynch *synch)
#define xnsynch_owner_check(synch, thread) \
xnsynch_fast_owner_check((synch)->fastlock, thread->handle)
#if XENO_DEBUG(MUTEX_RELAXED)
#ifdef CONFIG_XENO_OPT_DEBUG_MUTEX_RELAXED
void xnsynch_detect_relaxed_owner(struct xnsynch *synch,
struct xnthread *sleeper);
......
......@@ -83,7 +83,7 @@ struct xnid *xnid_fetch(struct rb_root *t, xnkey_t key)
static inline int xnid_remove(struct rb_root *t, struct xnid *xnid)
{
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
if (xnid_fetch(t, xnid->key) != xnid)
return -ENOENT;
#endif
......
......@@ -493,7 +493,7 @@ ssize_t xnbufd_unmap_uread(struct xnbufd *bufd)
{
preemptible_only();
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
bufd->b_ptr = (caddr_t)-1;
#endif
return bufd->b_off;
......@@ -551,7 +551,7 @@ ssize_t xnbufd_unmap_uwrite(struct xnbufd *bufd)
if (bufd->b_len > sizeof(bufd->b_buf))
xnfree(bufd->b_carry);
done:
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
bufd->b_ptr = (caddr_t)-1;
#endif
return ret ?: (ssize_t)len;
......@@ -592,7 +592,7 @@ EXPORT_SYMBOL_GPL(xnbufd_unmap_uwrite);
*/
void xnbufd_invalidate(struct xnbufd *bufd)
{
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
bufd->b_ptr = (caddr_t)-1;
#endif
if (bufd->b_carry) {
......@@ -620,7 +620,7 @@ EXPORT_SYMBOL_GPL(xnbufd_invalidate);
*/
ssize_t xnbufd_unmap_kread(struct xnbufd *bufd)
{
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
bufd->b_ptr = (caddr_t)-1;
#endif
return bufd->b_off;
......@@ -643,7 +643,7 @@ EXPORT_SYMBOL_GPL(xnbufd_unmap_kread);
*/
ssize_t xnbufd_unmap_kwrite(struct xnbufd *bufd)
{
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
bufd->b_ptr = (caddr_t)-1;
#endif
return bufd->b_off;
......
......@@ -549,7 +549,7 @@ static inline void init_thread_relax_trace(struct xnthread *thread)
#endif /* !XENO_OPT_DEBUG_TRACE_RELAX */
#if XENO_DEBUG(LOCKING)
#ifdef CONFIG_XENO_OPT_DEBUG_LOCKING
void xnlock_dbg_prepare_acquire(unsigned long long *start)
{
......
......@@ -531,7 +531,7 @@ static inline void xnintr_irq_detach(struct xnintr *intr)
#else /* !CONFIG_XENO_OPT_SHIRQ */
struct xnintr_vector {
#if defined(CONFIG_SMP) || XENO_DEBUG(LOCKING)
#if defined(CONFIG_SMP) || defined(CONFIG_XENO_OPT_DEBUG_LOCKING)
DECLARE_XNLOCK(lock);
#endif /* CONFIG_SMP || XENO_DEBUG(LOCKING) */
} ____cacheline_aligned_in_smp;
......
......@@ -751,7 +751,7 @@ static inline int handle_exception(struct ipipe_trap_data *d)
* running in primary mode, move it to the Linux domain,
* leaving the kernel process the exception.
*/
#if XENO_DEBUG(COBALT) || XENO_DEBUG(USER)
#if defined(CONFIG_XENO_OPT_DEBUG_COBALT) || defined(CONFIG_XENO_OPT_DEBUG_USER)
if (!user_mode(d->regs)) {
xntrace_panic_freeze();
printk(XENO_WARNING
......
......@@ -27,7 +27,7 @@
#include <xenomai/version.h>
#include "debug.h"
#if XENO_DEBUG(LOCKING)
#ifdef CONFIG_XENO_OPT_DEBUG_LOCKING
static int lock_vfile_show(struct xnvfile_regular_iterator *it, void *data)
{
......
......@@ -24,7 +24,7 @@
static void sporadic_post_recharge(struct xnthread *thread, xnticks_t budget);
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
static inline void sporadic_note_late_drop(struct xnsched *sched)
{
......@@ -236,7 +236,7 @@ static void xnsched_sporadic_init(struct xnsched *sched)
* share the same priority scale, with the addition of budget
* management for the sporadic ones.
*/
#if XENO_DEBUG(COBALT)
#ifdef CONFIG_XENO_OPT_DEBUG_COBALT
sched->pss.drop_retries = 0;
#endif
}
......
......@@ -902,7 +902,7 @@ void xnsynch_release_all_ownerships(struct xnthread *thread)
}
EXPORT_SYMBOL_GPL(xnsynch_release_all_ownerships);
#if XENO_DEBUG(MUTEX_RELAXED)
#ifdef CONFIG_XENO_OPT_DEBUG_MUTEX_RELAXED
/*
* Detect when a thread is about to sleep on a synchronization
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment