Changeset 0b9ac3c in mainline for kernel/arch/mips32/include/atomic.h


Ignore:
Timestamp:
2010-02-23T19:03:28Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c62d2e1
Parents:
1ccafee (diff), 5e50394 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/include/atomic.h

    r1ccafee r0b9ac3c  
    2727 */
    2828
    29 /** @addtogroup mips32 
     29/** @addtogroup mips32
    3030 * @{
    3131 */
     
    5151 *
    5252 * @return Value after addition.
     53 *
    5354 */
    54 static inline long atomic_add(atomic_t *val, int i)
     55static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i)
    5556{
    56         long tmp, v;
     57        atomic_count_t tmp;
     58        atomic_count_t v;
    5759       
    5860        asm volatile (
     
    6466                "       beq %0, %4, 1b\n"   /* if the atomic operation failed, try again */
    6567                "       nop\n"
    66                 : "=&r" (tmp), "+m" (val->count), "=&r" (v)
    67                 : "r" (i), "i" (0)
     68                : "=&r" (tmp),
     69                  "+m" (val->count),
     70                  "=&r" (v)
     71                : "r" (i),
     72                  "i" (0)
    6873        );
    6974       
     
    7176}
    7277
    73 static inline uint32_t test_and_set(atomic_t *val) {
    74         uint32_t tmp, v;
     78static inline atomic_count_t test_and_set(atomic_t *val)
     79{
     80        atomic_count_t tmp;
     81        atomic_count_t v;
    7582       
    7683        asm volatile (
     
    8289                "       beqz %0, 1b\n"
    8390                "2:\n"
    84                 : "=&r" (tmp), "+m" (val->count), "=&r" (v)
     91                : "=&r" (tmp),
     92                  "+m" (val->count),
     93                  "=&r" (v)
    8594                : "i" (1)
    8695        );
     
    8998}
    9099
    91 static inline void atomic_lock_arch(atomic_t *val) {
     100static inline void atomic_lock_arch(atomic_t *val)
     101{
    92102        do {
    93                 while (val->count)
    94                         ;
     103                while (val->count);
    95104        } while (test_and_set(val));
    96105}
Note: See TracChangeset for help on using the changeset viewer.