Changeset 23684b7 in mainline for arch/mips32/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/mips32/include/atomic.h

    r45fb65c r23684b7  
    3131
    3232#include <arch/types.h>
     33#include <typedefs.h>
    3334
    3435#define atomic_inc(x)   ((void) atomic_add(x, 1))
     
    4142#define atomic_predec(x) atomic_add(x, -1)
    4243
    43 typedef struct { volatile __u32 count; } atomic_t;
    44 
    4544/* Atomic addition of immediate value.
    4645 *
     
    5049 * @return Value after addition.
    5150 */
    52 static inline count_t atomic_add(atomic_t *val, int i)
     51static inline long atomic_add(atomic_t *val, int i)
    5352{
    54         count_t tmp, v;
     53        long tmp, v;
    5554
    5655        __asm__ volatile (
     
    6968}
    7069
    71 /* Reads/writes are atomic on mips for 4-bytes */
    72 
    73 static inline void atomic_set(atomic_t *val, __u32 i)
    74 {
    75         val->count = i;
    76 }
    77 
    78 static inline __u32 atomic_get(atomic_t *val)
    79 {
    80         return val->count;
    81 }
    82 
    8370#endif
Note: See TracChangeset for help on using the changeset viewer.