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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Jun 29 16:11:20 2013 +0200

cobalt/kernel: drop atomic_set/clear_mask

Now that setbit() and clrbits() have become useless, we have no more
users of the underlying atomic bitwise operations. Drop them all.

---

 include/cobalt/asm-arm/atomic.h       |   40 ---------------------------
 include/cobalt/asm-blackfin/atomic.h  |   12 --------
 include/cobalt/asm-blackfin/machine.h |    6 ----
 include/cobalt/asm-generic/atomic.h   |   23 +---------------
 include/cobalt/asm-generic/seqlock.h  |    9 +++++-
 include/cobalt/asm-nios2/atomic.h     |   15 ----------
 include/cobalt/asm-powerpc/atomic.h   |   40 ---------------------------
 include/cobalt/asm-sh/atomic.h        |   49 ---------------------------------
 include/cobalt/asm-x86/atomic.h       |   39 --------------------------
 include/cobalt/asm-x86/fptest.h       |    1 +
 include/cobalt/kernel/heap.h          |    1 +
 include/cobalt/kernel/types.h         |    3 --
 kernel/cobalt/arch/blackfin/Makefile  |    4 ---
 kernel/cobalt/arch/blackfin/atomic.S  |   43 -----------------------------
 kernel/cobalt/arch/blackfin/machine.c |    3 --
 15 files changed, 10 insertions(+), 278 deletions(-)

diff --git a/include/cobalt/asm-arm/atomic.h b/include/cobalt/asm-arm/atomic.h
index f38186f..a90f89c 100644
--- a/include/cobalt/asm-arm/atomic.h
+++ b/include/cobalt/asm-arm/atomic.h
@@ -23,46 +23,6 @@
 #ifndef _COBALT_ASM_ARM_ATOMIC_H
 #define _COBALT_ASM_ARM_ATOMIC_H
 
-#ifdef __KERNEL__
-#include <linux/version.h>
-#include <asm/irqflags.h>
-
-#if __LINUX_ARM_ARCH__ >= 6
-static inline void atomic_set_mask(unsigned long mask, unsigned long *addr)
-{
-    unsigned long tmp, tmp2;
-
-    __asm__ __volatile__("@ atomic_set_mask\n"
-                        "1:    ldrex   %0, [%3]\n\t"
-                        "      orr     %0, %0, %4\n\t"
-                        "      strex   %1, %0, [%3]\n"
-                        "      teq     %1, #0\n"
-                        "      bne     1b"
-                        : "=&r" (tmp), "=&r" (tmp2), "+Qo" (*addr)
-                        : "r" (addr), "Ir" (mask)
-                        : "cc");
-}
-#else /* arm <= armv5 */
-#define atomic_set_mask(mask, addr)                                    \
-       ({                                                              \
-               unsigned long flags;                                    \
-                                                                       \
-               flags = hard_local_irq_save();                          \
-               *(unsigned long *)(addr) |= (unsigned long)(mask);      \
-               hard_local_irq_restore(flags);                          \
-       })
-#endif /* arm <= armv5 */
-
-#else /* !__KERNEL__ */
-#include <asm/xenomai/features.h>
-
-#if __LINUX_ARM_ARCH__ <= 5 || !defined(CONFIG_SMP)
-#define xnarch_memory_barrier() \
-       __asm__ __volatile__ ("": /* */ : /* */ :"memory")
-#endif /* arm <= armv5 || !CONFIG_SMP */
-
-#endif /* !__KERNEL__ */
-
 #include <asm-generic/xenomai/atomic.h>
 
 #endif /* !_COBALT_ASM_ARM_ATOMIC_H */
diff --git a/include/cobalt/asm-blackfin/atomic.h 
b/include/cobalt/asm-blackfin/atomic.h
index 9622f31..9b6e321 100644
--- a/include/cobalt/asm-blackfin/atomic.h
+++ b/include/cobalt/asm-blackfin/atomic.h
@@ -20,18 +20,6 @@
 #ifndef _COBALT_ASM_BLACKFIN_ATOMIC_H
 #define _COBALT_ASM_BLACKFIN_ATOMIC_H
 
-#ifdef __KERNEL__
-
-#include <asm/xenomai/machine.h>
-
-#define xnarch_atomic_set_mask(pflags, mask)   \
-       __asm_atomic_set_mask((pflags), (mask))
-
-#define xnarch_atomic_clear_mask(pflags, mask)                 \
-       __asm_atomic_clear_mask((pflags), (mask))
-
-#endif /* __KERNEL__ */
-
 #include <asm-generic/xenomai/atomic.h>
 
 #endif /* !_COBALT_ASM_BLACKFIN_ATOMIC_H */
diff --git a/include/cobalt/asm-blackfin/machine.h 
b/include/cobalt/asm-blackfin/machine.h
index af98ad0..b64b262 100644
--- a/include/cobalt/asm-blackfin/machine.h
+++ b/include/cobalt/asm-blackfin/machine.h
@@ -32,12 +32,6 @@ static inline __attribute_const__ unsigned long 
ffnz(unsigned long ul)
        return ffs(ul) - 1;
 }
 
-asmlinkage void __asm_atomic_set_mask(unsigned long *addr,
-                                     unsigned long mask);
-
-asmlinkage void __asm_atomic_clear_mask(unsigned long *addr,
-                                       unsigned long mask);
-
 #include <asm-generic/xenomai/machine.h>
 
 #endif /* !_COBALT_ASM_BLACKFIN_MACHINE_H */
diff --git a/include/cobalt/asm-generic/atomic.h 
b/include/cobalt/asm-generic/atomic.h
index 7b44887..a9a7b85 100644
--- a/include/cobalt/asm-generic/atomic.h
+++ b/include/cobalt/asm-generic/atomic.h
@@ -21,28 +21,7 @@
 #ifndef _COBALT_ASM_GENERIC_ATOMIC_H
 #define _COBALT_ASM_GENERIC_ATOMIC_H
 
-#include <asm/xenomai/features.h>
-
-typedef unsigned long atomic_flags_t;
-
-#ifdef __KERNEL__
-#include <linux/bitops.h>
-#include <asm/atomic.h>
-#include <asm/xenomai/wrappers.h>
-
-/*
- * atomic_set_mask, atomic_clear_mask may not be available from all
- * linux ports.
- */
-#ifndef xnarch_atomic_set_mask
-#define xnarch_atomic_set_mask(pflags,mask) atomic_set_mask((mask),(pflags))
-#endif
-
-#ifndef xnarch_atomic_clear_mask
-#define xnarch_atomic_clear_mask(pflags,mask) 
atomic_clear_mask((mask),(pflags))
-#endif
-
-#else /* !__KERNEL__ */
+#ifndef __KERNEL__
 
 #include <xeno_config.h>
 
diff --git a/include/cobalt/asm-generic/seqlock.h 
b/include/cobalt/asm-generic/seqlock.h
index 27e90ad..d2b1c63 100644
--- a/include/cobalt/asm-generic/seqlock.h
+++ b/include/cobalt/asm-generic/seqlock.h
@@ -21,7 +21,13 @@
 
 /* Originally from the linux kernel, adapted for userland and Xenomai */
 
-#include <asm/xenomai/atomic.h>
+#ifdef __KERNEL__
+#include <linux/bitops.h>
+#include <asm/atomic.h>
+#include <asm/xenomai/wrappers.h>
+#else
+#include <asm-generic/xenomai/atomic.h>
+#endif
 
 typedef struct xnseqcount {
        unsigned int sequence;
@@ -55,7 +61,6 @@ static inline int xnread_seqcount_retry(const xnseqcount_t 
*s, unsigned start)
        return s->sequence != start;
 }
 
-
 /*
  * The sequence counter only protects readers from concurrent writers.
  * Writers must use their own locking.
diff --git a/include/cobalt/asm-nios2/atomic.h 
b/include/cobalt/asm-nios2/atomic.h
index 43f585f..348854b 100644
--- a/include/cobalt/asm-nios2/atomic.h
+++ b/include/cobalt/asm-nios2/atomic.h
@@ -20,21 +20,6 @@
 #ifndef _COBALT_ASM_NIOS2_ATOMIC_H
 #define _COBALT_ASM_NIOS2_ATOMIC_H
 
-#ifdef __KERNEL__
-
-#include <asm/irqflags.h>
-
-static inline void atomic_set_mask(unsigned long mask, unsigned long *addr)
-{
-       unsigned long flags;
-
-       flags = hard_local_irq_save();
-       *addr |= mask;
-       hard_local_irq_restore(flags);
-}
-
-#endif /* !__KERNEL__ */
-
 #include <asm-generic/xenomai/atomic.h>
 
 #endif /* !_COBALT_ASM_NIOS2_ATOMIC_H */
diff --git a/include/cobalt/asm-powerpc/atomic.h 
b/include/cobalt/asm-powerpc/atomic.h
index 31a8099..1698740 100644
--- a/include/cobalt/asm-powerpc/atomic.h
+++ b/include/cobalt/asm-powerpc/atomic.h
@@ -23,46 +23,6 @@
 #ifndef _COBALT_ASM_POWERPC_ATOMIC_H
 #define _COBALT_ASM_POWERPC_ATOMIC_H
 
-#ifdef __KERNEL__
-
-#ifdef CONFIG_PPC64
-static __inline__ void atomic64_clear_mask(unsigned long mask,
-                                          unsigned long *ptr)
-{
-    __asm__ __volatile__ ("\n\
-1:     ldarx   5,0,%0 \n\
-       andc    5,5,%1\n"
-"      stdcx.  5,0,%0 \n\
-       bne-    1b"
-       : /*no output*/
-       : "r" (ptr), "r" (mask)
-       : "r5", "cc", "memory");
-}
-#define xnarch_atomic_clear_mask(pflags,mask)  atomic64_clear_mask(mask,pflags)
-
-static __inline__ void atomic64_set_mask(unsigned long mask,
-                                        unsigned long *ptr)
-{
-    __asm__ __volatile__ ("\n\
-1:     ldarx   5,0,%0 \n\
-       or      5,5,%1\n"
-"      stdcx.  5,0,%0 \n\
-       bne-    1b"
-       : /*no output*/
-       : "r" (ptr), "r" (mask)
-       : "r5", "cc", "memory");
-}
-#define xnarch_atomic_set_mask(pflags,mask)    atomic64_set_mask(mask,pflags)
-
-#else /* !CONFIG_PPC64 */
- /* These are defined in arch/{ppc,powerpc}/kernel/misc[_32].S on 32-bit 
PowerPC */
-void atomic_set_mask(unsigned long mask, unsigned long *ptr);
-void atomic_clear_mask(unsigned long mask, unsigned long *ptr);
-
-#endif /* !CONFIG_PPC64 */
-
-#endif /* __KERNEL__ */
-
 #include <asm-generic/xenomai/atomic.h>
 
 #endif /* !_COBALT_ASM_POWERPC_ATOMIC_H */
diff --git a/include/cobalt/asm-sh/atomic.h b/include/cobalt/asm-sh/atomic.h
index 65ccaa6..16ff7b6 100644
--- a/include/cobalt/asm-sh/atomic.h
+++ b/include/cobalt/asm-sh/atomic.h
@@ -20,55 +20,6 @@
 #ifndef _COBALT_ASM_SH_ATOMIC_H
 #define _COBALT_ASM_SH_ATOMIC_H
 
-#ifdef __KERNEL__
-#include <asm/atomic.h>
-
-#define xnarch_atomic_set_mask(pflags,mask) \
-       atomic_set_mask(mask, (atomic_t *)(pflags))
-#define xnarch_atomic_clear_mask(pflags,mask) \
-       atomic_clear_mask(mask, (atomic_t *)(pflags))
-
-#else /* !__KERNEL */
-#include <endian.h>
-
-static inline unsigned long long load_u64(volatile void *p)
-{
-       union {
-#if __BYTE_ORDER == __BIG_ENDIAN
-               struct {
-                       unsigned long high;
-                       unsigned long low;
-               } e;
-#else /* __LITTLE_ENDIAN */
-               struct {
-                       unsigned long low;
-                       unsigned long high;
-               } e;
-#endif /* __LITTLE_ENDIAN */
-               struct {
-                       unsigned long l1;
-                       unsigned long l2;
-               } v;
-       } u;
-
-       __asm__ __volatile__ (
-               "   .align 2              \n\t"
-               "   mova    1f,   r0      \n\t" /* r0 = end point */
-               "   nop                   \n\t"
-               "   mov    r15,   r1      \n\t" /* r1 = saved sp */
-               "   mov    #-4,   r15     \n\t" /* LOGIN */
-               "   mov.l  @%2,   %0      \n\t" /* load first 32bit word */
-               "   mov.l  @(4, %2),   %1 \n\t" /* load second 32bit word */
-               "1: mov     r1,   r15     \n\t" /* LOGOUT */
-               : "=&r" (u.v.l1), "=&r" (u.v.l2)
-               : "r" (p)
-               : "memory", "r0", "r1");
-
-       return ((unsigned long long)u.e.high << 32) | u.e.low;
-}
-
-#endif /* !__KERNEL__ */
-
 #include <asm-generic/xenomai/atomic.h>
 
 #endif /* !_COBALT_ASM_SH_ATOMIC_H */
diff --git a/include/cobalt/asm-x86/atomic.h b/include/cobalt/asm-x86/atomic.h
index bc1f108..ad3d855 100644
--- a/include/cobalt/asm-x86/atomic.h
+++ b/include/cobalt/asm-x86/atomic.h
@@ -20,45 +20,6 @@
 #ifndef _COBALT_ASM_X86_ATOMIC_H
 #define _COBALT_ASM_X86_ATOMIC_H
 
-#include <asm/xenomai/features.h>
-
-#ifdef __KERNEL__
-#include <asm/atomic.h>
-
-#define xnarch_atomic_set_mask(pflags,mask)            \
-       atomic_set_mask((mask),(unsigned *)(pflags))
-#define xnarch_atomic_clear_mask(pflags,mask)          \
-       atomic_clear_mask((mask),(unsigned *)(pflags))
-
-#else /* !__KERNEL */
-#include <xeno_config.h>
-
-#ifdef CONFIG_SMP
-#define LOCK_PREFIX "lock ; "
-#else
-#define LOCK_PREFIX ""
-#endif
-
-#define cpu_relax() asm volatile("rep; nop" ::: "memory")
-
-#ifdef __i386__
-
-#define xnarch_memory_barrier()                __asm__ __volatile__("": : 
:"memory")
-#define xnarch_read_memory_barrier() \
-       __asm__ __volatile__ (LOCK_PREFIX "addl $0,0(%%esp)": : :"memory")
-#define xnarch_write_memory_barrier() \
-       __asm__ __volatile__ (LOCK_PREFIX "addl $0,0(%%esp)": : :"memory")
-
-#else /* x86_64 */
-
-#define xnarch_memory_barrier()                asm 
volatile("mfence":::"memory")
-#define xnarch_read_memory_barrier()   asm volatile("lfence":::"memory")
-#define xnarch_write_memory_barrier()  asm volatile("sfence":::"memory")
-
-#endif /* x86_64 */
-
-#endif /* !__KERNEL__ */
-
 #include <asm-generic/xenomai/atomic.h>
 
 #endif /* !_COBALT_ASM_X86_ATOMIC_64_H */
diff --git a/include/cobalt/asm-x86/fptest.h b/include/cobalt/asm-x86/fptest.h
index 2052149..18c48b7 100644
--- a/include/cobalt/asm-x86/fptest.h
+++ b/include/cobalt/asm-x86/fptest.h
@@ -58,6 +58,7 @@ static inline void fp_features_init(void)
 
 #else /* !__KERNEL__ */
 #include <stdio.h>
+#include <stdint.h>
 #define printk printf
 
 #define FP_FEATURE_SSE2                        0x01
diff --git a/include/cobalt/kernel/heap.h b/include/cobalt/kernel/heap.h
index b4b1e97..4c2b8d8 100644
--- a/include/cobalt/kernel/heap.h
+++ b/include/cobalt/kernel/heap.h
@@ -263,6 +263,7 @@ int xnheap_check_block(struct xnheap *heap,
 int xnheap_remap_vm_page(struct vm_area_struct *vma,
                         unsigned long from, unsigned long to);
 
+struct file;
 struct vm_area_struct;
 
 int xnheap_remap_io_page_range(struct file *filp,
diff --git a/include/cobalt/kernel/types.h b/include/cobalt/kernel/types.h
index 7289923..72e50da 100644
--- a/include/cobalt/kernel/types.h
+++ b/include/cobalt/kernel/types.h
@@ -22,9 +22,6 @@
 
 #include <cobalt/uapi/sys/types.h>
 
-#define setbits(flags,mask)  xnarch_atomic_set_mask(&(flags),mask)
-#define clrbits(flags,mask)  xnarch_atomic_clear_mask(&(flags),mask)
-
 #define XENO_INFO KERN_INFO    "[Xenomai] "
 #define XENO_WARN KERN_WARNING "[Xenomai] "
 #define XENO_ERR  KERN_ERR     "[Xenomai] "
diff --git a/kernel/cobalt/arch/blackfin/Makefile 
b/kernel/cobalt/arch/blackfin/Makefile
index f36b021..58f6b31 100644
--- a/kernel/cobalt/arch/blackfin/Makefile
+++ b/kernel/cobalt/arch/blackfin/Makefile
@@ -2,8 +2,4 @@ obj-$(CONFIG_XENOMAI) += bfin_hal.o
 
 bfin_hal-y := machine.o mayday.o thread.o switch.o syscall.o
 
-ifndef CONFIG_SMP
-bfin_hal-y += atomic.o
-endif
-
 ccflags-y := -D__IN_XENOMAI__ -Iinclude/xenomai/cobalt -Iinclude/xenomai
diff --git a/kernel/cobalt/arch/blackfin/atomic.S 
b/kernel/cobalt/arch/blackfin/atomic.S
deleted file mode 100644
index 6fe8aeb..0000000
--- a/kernel/cobalt/arch/blackfin/atomic.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2009 Philippe Gerum.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
- * USA; either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <linux/linkage.h>
-#include <asm/blackfin.h>
-#include <asm/entry.h>
-
-ENTRY(___asm_atomic_set_mask)
-       p0 = r0;
-       cli r0
-       r2 = [p0];
-       r2 = r2 | r1;
-       [p0] = r2;
-       sti r0
-       rts;
-ENDPROC(___asm_atomic_set_mask)
-
-ENTRY(___asm_atomic_clear_mask)
-       p0 = r0;
-       r1 = ~r1
-       cli r0
-       r2 = [p0];
-       r2 = r2 & r1;
-       [p0] = r2;
-       sti r0
-       rts;
-ENDPROC(___asm_atomic_clear_mask)
diff --git a/kernel/cobalt/arch/blackfin/machine.c 
b/kernel/cobalt/arch/blackfin/machine.c
index 72ffed9..e48b8c4 100644
--- a/kernel/cobalt/arch/blackfin/machine.c
+++ b/kernel/cobalt/arch/blackfin/machine.c
@@ -69,6 +69,3 @@ struct xnarch_machdesc xnarch_machdesc = {
        .prefault = NULL,
        .fault_labels = fault_labels,
 };
-
-EXPORT_SYMBOL_GPL(__asm_atomic_set_mask);
-EXPORT_SYMBOL_GPL(__asm_atomic_clear_mask);


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

Reply via email to