# HG changeset patch # User Florian Pose # Date 1316095009 -7200 # Node ID 505871ced7676ca4cf99e9206263babac59ba500 # Parent 86a4a7587c43add8e33a16bf9b6987d89a869807 Minor: Fixed line breaks and spacing. diff -r 86a4a7587c43 -r 505871ced767 master/globals.h --- a/master/globals.h Thu Sep 15 14:38:06 2011 +0200 +++ b/master/globals.h Thu Sep 15 15:56:49 2011 +0200 @@ -40,14 +40,19 @@ #include "../include/ecrt.h" #ifdef __KERNEL__ + #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) #include -#endif // KERNEL_VERSION(2,6,24) +#endif // KERNEL_VERSION(2, 6, 24) + #endif // __KERNEL__ +#if 0 #ifdef CONFIG_TRACING -//#define USE_TRACE_PRINTK +#define USE_TRACE_PRINTK +#endif #endif /****************************************************************************** @@ -316,60 +321,73 @@ /*****************************************************************************/ -/*****************************************************************************/ - #ifdef __KERNEL__ /** Mutual exclusion helpers. - * - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + #define ec_mutex_t rt_mutex + static inline void ec_mutex_init(struct ec_mutex_t *mutex) { rt_mutex_init(mutex); } + static inline void ec_mutex_lock(struct ec_mutex_t *mutex) { rt_mutex_lock(mutex); } + static inline int ec_mutex_trylock(struct ec_mutex_t *mutex) { return rt_mutex_trylock(mutex); } + static inline int ec_mutex_lock_interruptible(struct ec_mutex_t *mutex) { - return rt_mutex_lock_interruptible(mutex,0); -} + return rt_mutex_lock_interruptible(mutex, 0); +} + static inline void ec_mutex_unlock(struct ec_mutex_t *mutex) { rt_mutex_unlock(mutex); } -#else // < KERNEL_VERSION(2,6,24) + +#else // < KERNEL_VERSION(2, 6, 24) + #define ec_mutex_t semaphore + static inline void ec_mutex_init(struct ec_mutex_t *sem) { sema_init(sem, 1); } + static inline void ec_mutex_lock(struct ec_mutex_t *sem) { down(sem); } + static inline int ec_mutex_trylock(struct ec_mutex_t *sem) { down(sem); return 1; } + static inline int ec_mutex_lock_interruptible(struct ec_mutex_t *sem) { return down_interruptible(sem); } + static inline void ec_mutex_unlock(struct ec_mutex_t *sem) { up(sem); } -#endif // KERNEL_VERSION(2,6,24) +#endif // KERNEL_VERSION(2, 6, 24) + #endif // __KERNEL__ +/*****************************************************************************/ + #endif