Changeset 23684b7 in mainline for arch/sparc64/include/atomic.h


Ignore:
Timestamp:
2006-03-22T17:21:15Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d71007e
Parents:
45fb65c
Message:

Define atomic_t only once in atomic.h
Change the encapsulated counter type to long so that it supports negative values as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/sparc64/include/atomic.h

    r45fb65c r23684b7  
    3131
    3232#include <arch/types.h>
    33 
    34 typedef struct { volatile __u64 count; } atomic_t;
     33#include <typedefs.h>
    3534
    3635/** Atomic add operation.
     
    4342 * @return Value of the atomic variable as it existed before addition.
    4443 */
    45 static inline count_t atomic_add(atomic_t *val, int i)
     44static inline long atomic_add(atomic_t *val, int i)
    4645{
    4746        __u64 a, b;
     
    6362}
    6463
    65 static inline count_t atomic_preinc(atomic_t *val)
     64static inline long atomic_preinc(atomic_t *val)
    6665{
    6766        return atomic_add(val, 1) + 1;
    6867}
    6968
    70 static inline count_t atomic_postinc(atomic_t *val)
     69static inline long atomic_postinc(atomic_t *val)
    7170{
    7271        return atomic_add(val, 1);
    7372}
    7473
    75 static inline count_t atomic_predec(atomic_t *val)
     74static inline long atomic_predec(atomic_t *val)
    7675{
    7776        return atomic_add(val, -1) - 1;
    7877}
    7978
    80 static inline count_t atomic_postdec(atomic_t *val)
     79static inline long atomic_postdec(atomic_t *val)
    8180{
    8281        return atomic_add(val, -1);
     
    9392}
    9493
    95 static inline void atomic_set(atomic_t *val, __u64 i)
    96 {
    97         val->count = i;
    98 }
    99 
    100 static inline __u64 atomic_get(atomic_t *val)
    101 {
    102         return val->count;
    103 }
    104 
    10594#endif
Note: See TracChangeset for help on using the changeset viewer.