Module: xenomai-forge
Branch: next
Commit: 575c762adb98c7d23eebda96bf57d13cc840f17e
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=575c762adb98c7d23eebda96bf57d13cc840f17e

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Jun 25 10:29:06 2013 +0200

cobalt/kernel: drop xnflags_t

This abstraction is overkill and logically wrong. What we want is two
mutually convertible types:

- a portable base type which is wide enough for representing a set of
  bitwise conditions/statuses. Therefore, this type still has to be
  32bit wide at most nowadays.

- another type which can be used with atomic operations on any
  platform, typically a long integer type.

We drop xnflags_t, replacing it with a basic int type in function
prototypes, or long integer type when atomic operations are involved
internally. At any rate, atomic operations will produce significant
results for us only for the first 32 LSBs of such word.

---

 include/cobalt/kernel/intr.h        |    4 ++--
 include/cobalt/kernel/pipe.h        |    2 +-
 include/cobalt/kernel/pod.h         |   12 ++++++------
 include/cobalt/kernel/sched.h       |    4 ++--
 include/cobalt/kernel/synch.h       |   18 +++++++++---------
 include/cobalt/kernel/thread.h      |   10 +++++-----
 include/cobalt/kernel/timer.h       |    2 +-
 include/cobalt/kernel/types.h       |    2 --
 kernel/cobalt/clock.c               |    2 +-
 kernel/cobalt/intr.c                |    4 ++--
 kernel/cobalt/pipe.c                |    2 +-
 kernel/cobalt/pod.c                 |   25 ++++++++++++-------------
 kernel/cobalt/posix/cond.c          |    3 +--
 kernel/cobalt/posix/event.c         |    3 +--
 kernel/cobalt/posix/monitor.c       |    6 ++----
 kernel/cobalt/posix/mutex.c         |    2 +-
 kernel/cobalt/posix/sem.c           |    3 +--
 kernel/cobalt/posix/thread.c        |    7 +++----
 kernel/cobalt/registry.c            |    6 ++----
 kernel/cobalt/sched.c               |    4 ++--
 kernel/cobalt/synch.c               |   35 +++++++++++++++--------------------
 kernel/cobalt/thread.c              |   10 ++++------
 kernel/drivers/testing/switchtest.c |    2 +-
 23 files changed, 75 insertions(+), 93 deletions(-)

diff --git a/include/cobalt/kernel/intr.h b/include/cobalt/kernel/intr.h
index 7973f19..c58128c 100644
--- a/include/cobalt/kernel/intr.h
+++ b/include/cobalt/kernel/intr.h
@@ -56,7 +56,7 @@ typedef struct xnintr {
 
     void *cookie;      /* !< User-defined cookie value. */
 
-    xnflags_t flags;   /* !< Creation flags. */
+    int flags;         /* !< Creation flags. */
 
     unsigned irq;      /* !< IRQ number. */
 
@@ -109,7 +109,7 @@ int xnintr_init(xnintr_t *intr,
                unsigned irq,
                xnisr_t isr,
                xniack_t iack,
-               xnflags_t flags);
+               int flags);
 
 int xnintr_destroy(xnintr_t *intr);
 
diff --git a/include/cobalt/kernel/pipe.h b/include/cobalt/kernel/pipe.h
index 7976f7e..5415fa6 100644
--- a/include/cobalt/kernel/pipe.h
+++ b/include/cobalt/kernel/pipe.h
@@ -90,7 +90,7 @@ struct xnpipe_state {
        void *xstate;           /* Extra state managed by caller */
 
        /* Linux kernel part */
-       xnflags_t status;
+       unsigned long status;
        struct fasync_struct *asyncq;
        wait_queue_head_t readq;        /* open/read/poll waiters */
        wait_queue_head_t syncq;        /* sync waiters */
diff --git a/include/cobalt/kernel/pod.h b/include/cobalt/kernel/pod.h
index c01cd8e..809930a 100644
--- a/include/cobalt/kernel/pod.h
+++ b/include/cobalt/kernel/pod.h
@@ -66,7 +66,7 @@ struct xnsynch;
  */
 
 struct xnpod {
-       xnflags_t status;       /*!< Status bitmask. */
+       unsigned long status;     /*!< Status bitmask. */
        xnsched_t sched[NR_CPUS];       /*!< Per-cpu scheduler slots. */
        struct list_head threadq;       /*!< All existing threads. */
        int nrthreads;
@@ -188,18 +188,18 @@ void xnpod_cancel_thread(xnthread_t *thread);
 
 void xnpod_join_thread(xnthread_t *thread);
 
-xnflags_t xnpod_set_thread_mode(xnthread_t *thread,
-                               xnflags_t clrmask,
-                               xnflags_t setmask);
+int xnpod_set_thread_mode(xnthread_t *thread,
+                         int clrmask,
+                         int setmask);
 
 void xnpod_suspend_thread(xnthread_t *thread,
-                         xnflags_t mask,
+                         int mask,
                          xnticks_t timeout,
                          xntmode_t timeout_mode,
                          struct xnsynch *wchan);
 
 void xnpod_resume_thread(xnthread_t *thread,
-                        xnflags_t mask);
+                        int mask);
 
 int xnpod_unblock_thread(xnthread_t *thread);
 
diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index 0101131..aba9794 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -60,8 +60,8 @@ struct xnsched_rt {
 
 typedef struct xnsched {
 
-       xnflags_t status;               /*!< Scheduler specific status bitmask. 
*/
-       xnflags_t lflags;               /*!< Scheduler specific local flags 
bitmask. */
+       unsigned long status;           /*!< Scheduler specific status bitmask. 
*/
+       unsigned long lflags;           /*!< Scheduler specific local flags 
bitmask. */
        int cpu;
        struct xnthread *curr;          /*!< Current thread. */
 #ifdef CONFIG_SMP
diff --git a/include/cobalt/kernel/synch.h b/include/cobalt/kernel/synch.h
index 523b6f2..f411297 100644
--- a/include/cobalt/kernel/synch.h
+++ b/include/cobalt/kernel/synch.h
@@ -99,7 +99,7 @@ struct xnsynch;
 typedef struct xnsynch {
        struct list_head link;  /** thread->claimq */
        int wprio;              /** wait prio in claimq */
-       xnflags_t status;        /** Status word */
+       unsigned long status;    /** Status word */
        struct list_head pendq;  /** Pending threads */
        struct xnthread *owner; /** Thread which owns the resource */
        atomic_long_t *fastlock; /** Pointer to fast lock word */
@@ -161,7 +161,7 @@ static inline void xnsynch_detect_claimed_relax(struct 
xnthread *owner)
 
 #endif /* !XENO_DEBUG(SYNCH_RELAX) */
 
-void xnsynch_init(struct xnsynch *synch, xnflags_t flags,
+void xnsynch_init(struct xnsynch *synch, int flags,
                  atomic_long_t *fastlock);
 
 #define xnsynch_destroy(synch) xnsynch_flush(synch, XNRMID)
@@ -178,9 +178,9 @@ static inline void xnsynch_register_cleanup(struct xnsynch 
*synch,
        synch->cleanup = handler;
 }
 
-xnflags_t xnsynch_sleep_on(struct xnsynch *synch,
-                          xnticks_t timeout,
-                          xntmode_t timeout_mode);
+int xnsynch_sleep_on(struct xnsynch *synch,
+                    xnticks_t timeout,
+                    xntmode_t timeout_mode);
 
 struct xnthread *xnsynch_wakeup_one_sleeper(struct xnsynch *synch);
 
@@ -189,13 +189,13 @@ int xnsynch_wakeup_many_sleepers(struct xnsynch *synch, 
int nr);
 void xnsynch_wakeup_this_sleeper(struct xnsynch *synch,
                                 struct xnthread *sleeper);
 
-xnflags_t xnsynch_acquire(struct xnsynch *synch,
-                         xnticks_t timeout,
-                         xntmode_t timeout_mode);
+int xnsynch_acquire(struct xnsynch *synch,
+                   xnticks_t timeout,
+                   xntmode_t timeout_mode);
 
 struct xnthread *xnsynch_peek_pendq(struct xnsynch *synch);
 
-int xnsynch_flush(struct xnsynch *synch, xnflags_t reason);
+int xnsynch_flush(struct xnsynch *synch, int reason);
 
 void xnsynch_release_all_ownerships(struct xnthread *thread);
 
diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index 81d0266..301e3e4 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -164,12 +164,12 @@ struct xnpersonality;
 
 struct xnthread_init_attr {
        struct xnpersonality *personality;
-       xnflags_t flags;
+       int flags;
        const char *name;
 };
 
 struct xnthread_start_attr {
-       xnflags_t mode;
+       int mode;
        cpumask_t affinity;
        void (*entry)(void *cookie);
        void *cookie;
@@ -183,9 +183,9 @@ typedef struct xnthread {
 
        struct xnarchtcb tcb;           /* Architecture-dependent block -- Must 
be first */
 
-       xnflags_t state;                /* Thread state flags */
+       unsigned long state;            /* Thread state flags */
 
-       xnflags_t info;                 /* Thread information flags */
+       unsigned long info;             /* Thread information flags */
 
        struct xnsched *sched;          /* Thread scheduler */
 
@@ -422,7 +422,7 @@ void xnthread_init_root_tcb(struct xnthread *thread);
 
 void xnthread_cleanup(struct xnthread *thread);
 
-char *xnthread_format_status(xnflags_t status, char *buf, int size);
+char *xnthread_format_status(unsigned long status, char *buf, int size);
 
 xnticks_t xnthread_get_timeout(struct xnthread *thread, xnticks_t tsc_ns);
 
diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index 945d96f..8ac2cc2 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -168,7 +168,7 @@ typedef struct xntimer {
 
        struct list_head adjlink;
 
-       xnflags_t status;       /* !< Timer status. */
+       unsigned long status;   /* !< Timer status. */
 
        xnticks_t interval;     /* !< Periodic interval (in ticks, 0 == one 
shot). */
 
diff --git a/include/cobalt/kernel/types.h b/include/cobalt/kernel/types.h
index 790db2f..2b8092c 100644
--- a/include/cobalt/kernel/types.h
+++ b/include/cobalt/kernel/types.h
@@ -101,8 +101,6 @@ typedef enum xntmode {
 #define __setbits(flags,mask)  do { (flags) |= (mask); } while(0)
 #define __clrbits(flags,mask)  do { (flags) &= ~(mask); } while(0)
 
-typedef atomic_flags_t xnflags_t;
-
 #ifndef NULL
 #define NULL 0
 #endif
diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 5f98fce..5189eaa 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -96,7 +96,7 @@ struct tmstat_vfile_data {
        unsigned int fired;
        xnticks_t timeout;
        xnticks_t interval;
-       xnflags_t status;
+       unsigned long status;
        char handler[12];
        char name[XNOBJECT_NAME_LEN];
 };
diff --git a/kernel/cobalt/intr.c b/kernel/cobalt/intr.c
index fbc4478..ada9455 100644
--- a/kernel/cobalt/intr.c
+++ b/kernel/cobalt/intr.c
@@ -510,7 +510,7 @@ int __init xnintr_mount(void)
 }
 
 /*!
- * \fn int xnintr_init (xnintr_t *intr,const char *name,unsigned irq,xnisr_t 
isr,xniack_t iack,xnflags_t flags)
+ * \fn int xnintr_init (xnintr_t *intr,const char *name,unsigned irq,xnisr_t 
isr,xniack_t iack,int flags)
  * \brief Initialize an interrupt object.
  *
  * Associates an interrupt object with an IRQ line.
@@ -614,7 +614,7 @@ int __init xnintr_mount(void)
 
 int xnintr_init(xnintr_t *intr,
                const char *name,
-               unsigned irq, xnisr_t isr, xniack_t iack, xnflags_t flags)
+               unsigned int irq, xnisr_t isr, xniack_t iack, int flags)
 {
        if (irq >= IPIPE_NR_IRQS)
                return -EINVAL;
diff --git a/kernel/cobalt/pipe.c b/kernel/cobalt/pipe.c
index ea3c174..3d8d247 100644
--- a/kernel/cobalt/pipe.c
+++ b/kernel/cobalt/pipe.c
@@ -522,9 +522,9 @@ ssize_t xnpipe_recv(int minor, struct xnpipe_mh **pmh, 
xnticks_t timeout)
 {
        struct xnpipe_state *state;
        struct xnpipe_mh *mh;
-       xnflags_t info;
        xntmode_t mode;
        ssize_t ret;
+       int info;
        spl_t s;
 
        if (minor < 0 || minor >= XNPIPE_NDEVS)
diff --git a/kernel/cobalt/pod.c b/kernel/cobalt/pod.c
index 0ed9986..4233cff 100644
--- a/kernel/cobalt/pod.c
+++ b/kernel/cobalt/pod.c
@@ -667,7 +667,7 @@ void xnpod_stop_thread(struct xnthread *thread)
 EXPORT_SYMBOL_GPL(xnpod_stop_thread);
 
 /*!
- * \fn void xnpod_set_thread_mode(xnthread_t *thread,xnflags_t 
clrmask,xnflags_t setmask)
+ * \fn void xnpod_set_thread_mode(xnthread_t *thread,int clrmask,int setmask)
  * \brief Change a thread's control mode.
  *
  * Change the control mode of a given thread. The control mode affects
@@ -707,17 +707,16 @@ EXPORT_SYMBOL_GPL(xnpod_stop_thread);
  * only returning the previous mode if @a mode_r is a valid address.
  */
 
-xnflags_t xnpod_set_thread_mode(xnthread_t *thread,
-                               xnflags_t clrmask, xnflags_t setmask)
+int xnpod_set_thread_mode(xnthread_t *thread, int clrmask, int setmask)
 {
-       xnthread_t *curr = xnpod_current_thread();
-       xnflags_t oldmode;
+       struct xnthread *curr = xnpod_current_thread();
+       unsigned long oldmode;
        spl_t s;
 
        xnlock_get_irqsave(&nklock, s);
 
        trace_mark(xn_nucleus, thread_setmode,
-                  "thread %p thread_name %s clrmask %lu setmask %lu",
+                  "thread %p thread_name %s clrmask 0x%x setmask 0x%x",
                   thread, xnthread_name(thread), clrmask, setmask);
 
        oldmode = xnthread_state_flags(thread) & XNTHREAD_MODE_BITS;
@@ -735,7 +734,7 @@ xnflags_t xnpod_set_thread_mode(xnthread_t *thread,
 
        xnlock_put_irqrestore(&nklock, s);
 
-       return oldmode;
+       return (int)oldmode;
 }
 EXPORT_SYMBOL_GPL(xnpod_set_thread_mode);
 
@@ -934,7 +933,7 @@ void xnpod_join_thread(struct xnthread *thread)
 EXPORT_SYMBOL_GPL(xnpod_join_thread);
 
 /*!
- * \fn void xnpod_suspend_thread(xnthread_t *thread, xnflags_t mask,
+ * \fn void xnpod_suspend_thread(xnthread_t *thread, int mask,
  *                               xnticks_t timeout, xntmode_t timeout_mode,
  *                               xnsynch_t *wchan)
  *
@@ -1003,12 +1002,12 @@ EXPORT_SYMBOL_GPL(xnpod_join_thread);
  * Rescheduling: possible if the current thread suspends itself.
  */
 
-void xnpod_suspend_thread(xnthread_t *thread, xnflags_t mask,
+void xnpod_suspend_thread(xnthread_t *thread, int mask,
                          xnticks_t timeout, xntmode_t timeout_mode,
                          xnsynch_t *wchan)
 {
+       unsigned long oldstate;
        struct xnsched *sched;
-       xnflags_t oldstate;
        spl_t s;
 
        XENO_ASSERT(NUCLEUS, !xnthread_test_state(thread, XNROOT),
@@ -1187,7 +1186,7 @@ unlock_and_exit:
 EXPORT_SYMBOL_GPL(xnpod_suspend_thread);
 
 /*!
- * \fn void xnpod_resume_thread(struct xnthread *thread,xnflags_t mask)
+ * \fn void xnpod_resume_thread(struct xnthread *thread,int mask)
  * \brief Resume a thread.
  *
  * Resumes the execution of a thread previously suspended by one or
@@ -1240,10 +1239,10 @@ EXPORT_SYMBOL_GPL(xnpod_suspend_thread);
  * Rescheduling: never.
  */
 
-void xnpod_resume_thread(struct xnthread *thread, xnflags_t mask)
+void xnpod_resume_thread(struct xnthread *thread, int mask)
 {
+       unsigned long oldstate;
        struct xnsched *sched;
-       xnflags_t oldstate;
        spl_t s;
 
        xnlock_get_irqsave(&nklock, s);
diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c
index a43259f..02ca0c7 100644
--- a/kernel/cobalt/posix/cond.c
+++ b/kernel/cobalt/posix/cond.c
@@ -96,12 +96,11 @@ cond_destroy_internal(struct cobalt_cond *cond, struct 
cobalt_kqueues *q)
 static inline int
 pthread_cond_init(struct __shadow_cond *cnd, const pthread_condattr_t *attr)
 {
-       xnflags_t synch_flags = XNSYNCH_PRIO | XNSYNCH_NOPIP;
+       int synch_flags = XNSYNCH_PRIO | XNSYNCH_NOPIP, err;
        struct list_head *condq, *entry;
        struct xnsys_ppd *sys_ppd;
        struct cobalt_cond *cond;
        spl_t s;
-       int err;
 
        if (attr == NULL)
                attr = &cobalt_default_cond_attr;
diff --git a/kernel/cobalt/posix/event.c b/kernel/cobalt/posix/event.c
index e1143f5..3697491 100644
--- a/kernel/cobalt/posix/event.c
+++ b/kernel/cobalt/posix/event.c
@@ -113,8 +113,7 @@ int cobalt_event_wait(struct cobalt_event_shadow __user 
*u_evtsh,
        xntmode_t tmode = XN_RELATIVE;
        struct event_wait_context ewc;
        struct timespec ts;
-       xnflags_t info;
-       int ret = 0;
+       int ret = 0, info;
        spl_t s;
 
        __xn_get_user(event, &u_evtsh->event);
diff --git a/kernel/cobalt/posix/monitor.c b/kernel/cobalt/posix/monitor.c
index 8ca8062..5849357 100644
--- a/kernel/cobalt/posix/monitor.c
+++ b/kernel/cobalt/posix/monitor.c
@@ -107,8 +107,7 @@ int cobalt_monitor_init(struct cobalt_monitor_shadow __user 
*u_monsh,
 static int cobalt_monitor_enter_inner(struct cobalt_monitor *mon)
 {
        struct xnthread *cur = xnpod_current_thread();
-       xnflags_t info;
-       int ret = 0;
+       int ret = 0, info;
 
        if (!cobalt_obj_active(mon, COBALT_MONITOR_MAGIC,
                               struct cobalt_monitor))
@@ -227,10 +226,9 @@ int cobalt_monitor_wait(struct cobalt_monitor_shadow 
__user *u_monsh,
        struct cobalt_monitor_data *datp;
        xnticks_t timeout = XN_INFINITE;
        xntmode_t tmode = XN_RELATIVE;
-       int ret = 0, opret = 0;
+       int ret = 0, opret = 0, info;
        struct xnsynch *synch;
        struct timespec ts;
-       xnflags_t info;
        spl_t s;
 
        __xn_get_user(mon, &u_monsh->monitor);
diff --git a/kernel/cobalt/posix/mutex.c b/kernel/cobalt/posix/mutex.c
index ed40419..44403b7 100644
--- a/kernel/cobalt/posix/mutex.c
+++ b/kernel/cobalt/posix/mutex.c
@@ -56,7 +56,7 @@ static int cobalt_mutex_init_inner(struct __shadow_mutex 
*shadow,
                                   struct mutex_dat *datp,
                                   const pthread_mutexattr_t *attr)
 {
-       xnflags_t synch_flags = XNSYNCH_PRIO | XNSYNCH_OWNER;
+       int synch_flags = XNSYNCH_PRIO | XNSYNCH_OWNER;
        struct xnsys_ppd *sys_ppd;
        struct cobalt_kqueues *kq;
        spl_t s;
diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
index aa00d68..d2a924e 100644
--- a/kernel/cobalt/posix/sem.c
+++ b/kernel/cobalt/posix/sem.c
@@ -525,8 +525,7 @@ static inline int
 sem_timedwait_internal(struct cobalt_sem *sem, int timed, xnticks_t to)
 {
        xntmode_t tmode;
-       xnflags_t info;
-       int ret;
+       int ret, info;
 
        ret = sem_trywait_internal(sem);
        if (ret != -EAGAIN)
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index ce516ed..5c06aca 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -344,10 +344,9 @@ static inline int pthread_create(pthread_t *tid, const 
pthread_attr_t *attr)
        struct xnsched_class *sched_class;
        union xnsched_policy_param param;
        struct xnthread_init_attr iattr;
+       int prio, ret, pol, flags = 0;
        pthread_t thread, cur;
-       xnflags_t flags = 0;
        const char *name;
-       int prio, ret, pol;
        spl_t s;
 
        if (attr && attr->magic != COBALT_THREAD_ATTR_MAGIC)
@@ -557,9 +556,9 @@ static inline int pthread_make_periodic_np(pthread_t thread,
  */
 static inline int pthread_set_mode_np(int clrmask, int setmask, int *mode_r)
 {
-       const xnflags_t valid_flags = XNLOCK|XNTRAPSW;
        struct xnthread *cur = xnpod_current_thread();
-       xnflags_t old;
+       const int valid_flags = XNLOCK|XNTRAPSW;
+       int old;
 
        /*
         * The conforming mode bit is actually zero, since jumping to
diff --git a/kernel/cobalt/registry.c b/kernel/cobalt/registry.c
index cde7037..9d5048c 100644
--- a/kernel/cobalt/registry.c
+++ b/kernel/cobalt/registry.c
@@ -778,8 +778,7 @@ int xnregistry_bind(const char *key, xnticks_t timeout, int 
timeout_mode,
 {
        struct xnobject *object;
        xnthread_t *thread;
-       xnflags_t info;
-       int ret = 0;
+       int ret = 0, info;
        spl_t s;
 
        if (key == NULL)
@@ -960,8 +959,7 @@ int xnregistry_remove_safe(xnhandle_t handle, xnticks_t 
timeout)
 {
        unsigned long long cstamp;
        struct xnobject *object;
-       xnflags_t info;
-       int ret = 0;
+       int ret = 0, info;
        spl_t s;
 
        xnlock_get_irqsave(&nklock, s);
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 2f2cd1a..ad4c577 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -629,7 +629,7 @@ struct vfile_schedlist_data {
        char sched_class[XNOBJECT_NAME_LEN];
        int cprio;
        xnticks_t timeout;
-       xnflags_t state;
+       unsigned long state;
 };
 
 static struct xnvfile_snapshot_ops vfile_schedlist_ops;
@@ -744,7 +744,7 @@ struct vfile_schedstat_priv {
 struct vfile_schedstat_data {
        int cpu;
        pid_t pid;
-       xnflags_t state;
+       unsigned long state;
        char name[XNOBJECT_NAME_LEN];
        unsigned long ssw;
        unsigned long csw;
diff --git a/kernel/cobalt/synch.c b/kernel/cobalt/synch.c
index f238af9..dfd8300 100644
--- a/kernel/cobalt/synch.c
+++ b/kernel/cobalt/synch.c
@@ -38,7 +38,7 @@
 #include <cobalt/kernel/shadow.h>
 
 /*!
- * \fn void xnsynch_init(struct xnsynch *synch, xnflags_t flags,
+ * \fn void xnsynch_init(struct xnsynch *synch, int flags,
  *                       atomic_long_t *fastlock)
  *
  * \brief Initialize a synchronization object.
@@ -97,7 +97,7 @@
  * Rescheduling: never.
  */
 
-void xnsynch_init(struct xnsynch *synch, xnflags_t flags, atomic_long_t 
*fastlock)
+void xnsynch_init(struct xnsynch *synch, int flags, atomic_long_t *fastlock)
 {
        if (flags & XNSYNCH_PIP)
                flags |= XNSYNCH_PRIO | XNSYNCH_OWNER;  /* Obviously... */
@@ -118,8 +118,7 @@ void xnsynch_init(struct xnsynch *synch, xnflags_t flags, 
atomic_long_t *fastloc
 EXPORT_SYMBOL_GPL(xnsynch_init);
 
 /*!
- * \fn xnflags_t xnsynch_sleep_on(struct xnsynch *synch, xnticks_t timeout,
- *                                xntmode_t timeout_mode);
+ * \fn int xnsynch_sleep_on(struct xnsynch *synch, xnticks_t timeout, 
xntmode_t timeout_mode);
  * \brief Sleep on an ownerless synchronization object.
  *
  * Makes the calling thread sleep on the specified synchronization
@@ -161,8 +160,8 @@ EXPORT_SYMBOL_GPL(xnsynch_init);
  * Rescheduling: always.
  */
 
-xnflags_t xnsynch_sleep_on(struct xnsynch *synch, xnticks_t timeout,
-                          xntmode_t timeout_mode)
+int xnsynch_sleep_on(struct xnsynch *synch, xnticks_t timeout,
+                    xntmode_t timeout_mode)
 {
        struct xnthread *thread = xnpod_current_thread();
        spl_t s;
@@ -184,7 +183,7 @@ xnflags_t xnsynch_sleep_on(struct xnsynch *synch, xnticks_t 
timeout,
 
        xnlock_put_irqrestore(&nklock, s);
 
-       return xnthread_test_info(thread, XNRMID|XNTIMEO|XNBREAK);
+       return (int)xnthread_test_info(thread, XNRMID|XNTIMEO|XNBREAK);
 }
 EXPORT_SYMBOL_GPL(xnsynch_sleep_on);
 
@@ -352,8 +351,7 @@ static void xnsynch_renice_thread(struct xnthread *thread,
 }
 
 /*!
- * \fn xnflags_t xnsynch_acquire(struct xnsynch *synch, xnticks_t timeout,
- *                               xntmode_t timeout_mode);
+ * \fn int xnsynch_acquire(struct xnsynch *synch, xnticks_t timeout, xntmode_t 
timeout_mode);
  * \brief Acquire the ownership of a synchronization object.
  *
  * This service should be called by upper interfaces wanting the
@@ -395,8 +393,8 @@ static void xnsynch_renice_thread(struct xnthread *thread,
  * Rescheduling: possible.
  */
 
-xnflags_t xnsynch_acquire(struct xnsynch *synch, xnticks_t timeout,
-                         xntmode_t timeout_mode)
+int xnsynch_acquire(struct xnsynch *synch, xnticks_t timeout,
+                   xntmode_t timeout_mode)
 {
        struct xnthread *thread = xnpod_current_thread(), *owner;
        xnhandle_t threadh = xnthread_handle(thread), fastlock, old;
@@ -406,9 +404,7 @@ xnflags_t xnsynch_acquire(struct xnsynch *synch, xnticks_t 
timeout,
        XENO_BUGON(NUCLEUS, !testbits(synch->status, XNSYNCH_OWNER));
 
        trace_mark(xn_nucleus, synch_acquire, "synch %p", synch);
-
-      redo:
-
+redo:
        fastlock = atomic_long_cmpxchg(lockp, XN_NO_HANDLE, threadh);
 
        if (likely(fastlock == XN_NO_HANDLE)) {
@@ -438,7 +434,7 @@ xnflags_t xnsynch_acquire(struct xnsynch *synch, xnticks_t 
timeout,
                if (likely(old == fastlock))
                        break;
 
-         test_no_owner:
+       test_no_owner:
                if (old == XN_NO_HANDLE) {
                        /* Owner called xnsynch_release
                           (on another cpu) */
@@ -526,11 +522,10 @@ xnflags_t xnsynch_acquire(struct xnsynch *synch, 
xnticks_t timeout,
                atomic_long_set(lockp, threadh);
        }
 
-      unlock_and_exit:
-
+unlock_and_exit:
        xnlock_put_irqrestore(&nklock, s);
 
-       return xnthread_test_info(thread, XNRMID|XNTIMEO|XNBREAK);
+       return (int)xnthread_test_info(thread, XNRMID|XNTIMEO|XNBREAK);
 }
 EXPORT_SYMBOL_GPL(xnsynch_acquire);
 
@@ -775,7 +770,7 @@ out:
 EXPORT_SYMBOL_GPL(xnsynch_peek_pendq);
 
 /*!
- * \fn void xnsynch_flush(struct xnsynch *synch, xnflags_t reason);
+ * \fn int xnsynch_flush(struct xnsynch *synch, int reason);
  * \brief Unblock all waiters pending on a resource.
  *
  * This service atomically releases all threads which currently sleep
@@ -823,7 +818,7 @@ EXPORT_SYMBOL_GPL(xnsynch_peek_pendq);
  * Rescheduling: never.
  */
 
-int xnsynch_flush(struct xnsynch *synch, xnflags_t reason)
+int xnsynch_flush(struct xnsynch *synch, int reason)
 {
        struct xnthread *sleeper, *tmp;
        int ret;
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index dc8af95..a71ff03 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -125,9 +125,8 @@ int xnthread_init(struct xnthread *thread,
                  const union xnsched_policy_param *sched_param)
 {
        DECLARE_COMPLETION_ONSTACK(done);
-       xnflags_t flags = attr->flags;
+       int flags = attr->flags, ret;
        spl_t s;
-       int ret;
 
        flags &= ~XNSUSP;
 #ifndef CONFIG_XENO_HW_FPU
@@ -241,14 +240,13 @@ void xnthread_cleanup(struct xnthread *thread)
        thread->registry.handle = XN_NO_HANDLE;
 }
 
-char *xnthread_format_status(xnflags_t status, char *buf, int size)
+char *xnthread_format_status(unsigned long status, char *buf, int size)
 {
        static const char labels[] = XNTHREAD_STATE_LABELS;
-       xnflags_t mask;
-       int pos, c;
+       int pos, c, mask;
        char *wp;
 
-       for (mask = status & ~XNTHREAD_STATE_SPARES, pos = 0, wp = buf;
+       for (mask = (int)status & ~XNTHREAD_STATE_SPARES, pos = 0, wp = buf;
             mask != 0 && wp - buf < size - 2;  /* 1-letter label + \0 */
             mask >>= 1, pos++) {
                if ((mask & 1) == 0)
diff --git a/kernel/drivers/testing/switchtest.c 
b/kernel/drivers/testing/switchtest.c
index c1eec02..381bce9 100644
--- a/kernel/drivers/testing/switchtest.c
+++ b/kernel/drivers/testing/switchtest.c
@@ -431,8 +431,8 @@ static int rtswitch_create_ktask(rtswitch_context_t *ctx,
        struct xnthread_start_attr sattr;
        struct xnthread_init_attr iattr;
        rtswitch_task_t *task;
-       xnflags_t init_flags;
        struct taskarg arg;
+       int init_flags;
        char name[30];
        int err;
 


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

Reply via email to