Skip to contentSkip to conversation

DECLARE_XNLOCK vs. DEFINE_XNLOCK

PATCH Applied Jan Kiszka 2 participants 2 messages Feb 20, 2007 – Feb 23, 2007

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 DECLARE_XNLOCK vs. DEFINE_XNLOCK

This patch renames DECLARE_*XNLOCK to DEFINE_*XNLOCK, defines real DECLARE_XNLOCK + DECLARE_EXTERN_XNLOCK and applies it on several users.

Jan

---
 include/asm-generic/system.h |   10 +++++++---
 include/asm-sim/system.h     |    4 +++-
 include/nucleus/heap.h       |    4 +---
 include/nucleus/pod.h        |    4 +---
 ksrc/nucleus/intr.c          |    4 +---
 ksrc/nucleus/pod.c           |    2 +-
 ksrc/nucleus/shadow.c        |    2 +-
 ksrc/skins/posix/registry.c  |    4 +---
 ksrc/skins/posix/registry.h  |    4 +---
 ksrc/skins/rtdm/core.c       |    4 +---
 ksrc/skins/rtdm/core.h       |    4 +---
 ksrc/skins/rtdm/device.c     |    5 +----
 12 files changed, 20 insertions(+), 31 deletions(-)
asm-generic/system.h +7 -3
Index: include/asm-generic/system.h
===================================================================
@@ -245,8 +245,10 @@ static inline void xnlock_init (xnlock_t
     *lock = XNARCH_LOCK_UNLOCKED;
 }
 
-#define DECLARE_XNLOCK(lock)		xnlock_t lock = XNARCH_LOCK_UNLOCKED
-#define DECLARE_PRIVATE_XNLOCK(lock) static DECLARE_XNLOCK(lock)
+#define DECLARE_XNLOCK(lock)		xnlock_t lock
+#define DECLARE_EXTERN_XNLOCK(lock)	extern xnlock_t lock
+#define DEFINE_XNLOCK(lock)		xnlock_t lock = XNARCH_LOCK_UNLOCKED
+#define DEFINE_PRIVATE_XNLOCK(lock) static DEFINE_XNLOCK(lock)
 
 #if XENO_DEBUG(NUCLEUS)
 
@@ -386,7 +388,9 @@ static inline void xnlock_put_irqrestore
 #define xnlock_clear_irqon(lock)       rthal_local_irq_enable()
 
 #define DECLARE_XNLOCK(lock)
-#define DECLARE_PRIVATE_XNLOCK(lock)
+#define DECLARE_EXTERN_XNLOCK(lock)
+#define DEFINE_XNLOCK(lock)
+#define DEFINE_PRIVATE_XNLOCK(lock)
 
 #endif /* !CONFIG_SMP */
 
asm-sim/system.h +3 -1
Index: include/asm-sim/system.h
===================================================================
@@ -79,7 +79,9 @@ typedef unsigned long xnlock_t;
 #define xnlock_clear_irqon(lock)       mvm_set_irqmask(0)
 
 #define DECLARE_XNLOCK(lock)
-#define DECLARE_PRIVATE_XNLOCK(lock)
+#define DECLARE_EXTERN_XNLOCK(lock)
+#define DEFINE_XNLOCK(lock)
+#define DEFINE_PRIVATE_XNLOCK(lock)
 
 #define XNARCH_NR_CPUS              1
 
nucleus/heap.h +1 -3
Index: include/nucleus/heap.h
===================================================================
@@ -89,9 +89,7 @@ typedef struct xnheap {
 
 	xnqueue_t extents;
 
-#ifdef CONFIG_SMP
-	xnlock_t lock;
-#endif /* CONFIG_SMP */
+	DECLARE_XNLOCK(lock);
 
 	caddr_t buckets[XNHEAP_NBUCKETS];
 
nucleus/pod.h +1 -3
Index: include/nucleus/pod.h
===================================================================
@@ -219,9 +219,7 @@ typedef struct xnpod xnpod_t;
 
 extern xnpod_t *nkpod;
 
-#ifdef CONFIG_SMP
-extern xnlock_t nklock;
-#endif /* CONFIG_SMP */
+DECLARE_EXTERN_XNLOCK(nklock);
 
 extern u_long nkschedlat;
 
skins/posix/registry.c +1 -3
Index: ksrc/skins/posix/registry.c
===================================================================
@@ -322,9 +322,7 @@ int pse51_desc_get(pse51_desc_t ** descp
 
 #if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE)
 
-#ifdef CONFIG_SMP
-xnlock_t pse51_assoc_lock;
-#endif
+DEFINE_XNLOCK(pse51_assoc_lock);
 
 static int pse51_assoc_lookup_inner(pse51_assocq_t * q,
 				    pse51_assoc_t ** passoc,
skins/posix/registry.h +1 -3
Index: ksrc/skins/posix/registry.h
===================================================================
@@ -90,9 +90,7 @@ int pse51_desc_destroy(pse51_desc_t *des
 #if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE)
 struct mm_struct;
 
-#ifdef CONFIG_SMP
-extern xnlock_t pse51_assoc_lock;
-#endif
+DECLARE_EXTERN_XNLOCK(pse51_assoc_lock);
 
 typedef xnqueue_t pse51_assocq_t;
 
skins/rtdm/device.c +1 -4
Index: ksrc/skins/rtdm/device.c
===================================================================
@@ -61,10 +61,7 @@ static int          name_hashkey_mask;
 static int          proto_hashkey_mask;
 
 DECLARE_MUTEX(nrt_dev_lock);
-
-#ifdef CONFIG_SMP
-xnlock_t            rt_dev_lock = XNARCH_LOCK_UNLOCKED;
-#endif /* CONFIG_SMP */
+DEFINE_PRIVATE_XNLOCK(rt_dev_lock);
 
 #ifndef MODULE
 int                 rtdm_initialised = 0;
skins/rtdm/core.c +1 -3
Index: ksrc/skins/rtdm/core.c
===================================================================
@@ -45,9 +45,7 @@ static unsigned long    used_fildes[FD_B
 int                     open_fildes;    /* amount of used descriptors */
 xntbase_t               *rtdm_tbase;
 
-#ifdef CONFIG_SMP
-xnlock_t                rt_fildes_lock = XNARCH_LOCK_UNLOCKED;
-#endif /* !CONFIG_SMP */
+DEFINE_XNLOCK(rt_fildes_lock);
 
 
 /**
skins/rtdm/core.h +1 -3
Index: ksrc/skins/rtdm/core.h
===================================================================
@@ -24,9 +24,7 @@
 #include <rtdm/rtdm_driver.h>
 
 
-#ifdef CONFIG_SMP
-extern xnlock_t             rt_fildes_lock;
-#endif /* CONFIG_SMP */
+DECLARE_EXTERN_XNLOCK(rt_fildes_lock);
 
 #define RTDM_FD_MAX         CONFIG_XENO_OPT_RTDM_FILDES
 
nucleus/intr.c +1 -3
Index: ksrc/nucleus/intr.c
===================================================================
@@ -39,9 +39,7 @@
 
 #define XNINTR_MAX_UNHANDLED	1000
 
-#ifdef CONFIG_SMP
-xnlock_t intrlock = XNARCH_LOCK_UNLOCKED;
-#endif /* CONFIG_SMP */
+DEFINE_PRIVATE_XNLOCK(intrlock);
 
 xnintr_t nkclock;
 
nucleus/pod.c +1 -1
Index: ksrc/nucleus/pod.c
===================================================================
@@ -56,7 +56,7 @@
 
 xnpod_t *nkpod = NULL;
 
-DECLARE_XNLOCK(nklock);
+DEFINE_XNLOCK(nklock);
 
 u_long nkschedlat = 0;
 
nucleus/shadow.c +1 -1
Index: ksrc/nucleus/shadow.c
===================================================================
@@ -175,7 +175,7 @@ void xnpod_discard_iface_proc(struct xns
  * its base priority, i.e. the lowest available level.
  */
 
-DECLARE_PRIVATE_XNLOCK(rpilock);
+DEFINE_PRIVATE_XNLOCK(rpilock);
 
 #define rpi_p(t)	((t)->rpi != NULL)
 
#1 lore raw
Quoted 2 lines · Jan Kiszka

This patch renames DECLARE_*XNLOCK to DEFINE_*XNLOCK, defines real DECLARE_XNLOCK + DECLARE_EXTERN_XNLOCK and applies it on several users.

Merged, thanks.

Signature · 1 line
Philippe.