Commit b82dccd9 authored by Russell King's avatar Russell King

[ARM] Remove an extraneous load from atomic ops

atomic.h was generating some extra loads that aren't required.  In
addition, it was needlessly performing various tests inside the
atomic region.  This change fixes both these issues.
parent 415395e1
...@@ -71,27 +71,27 @@ static __inline__ void atomic_dec(volatile atomic_t *v) ...@@ -71,27 +71,27 @@ static __inline__ void atomic_dec(volatile atomic_t *v)
static __inline__ int atomic_dec_and_test(volatile atomic_t *v) static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
{ {
unsigned long flags; unsigned long flags;
int result; int val;
__save_flags_cli(flags); __save_flags_cli(flags);
v->counter -= 1; val = v->counter;
result = (v->counter == 0); v->counter = val -= 1;
__restore_flags(flags); __restore_flags(flags);
return result; return val == 0;
} }
static inline int atomic_add_negative(int i, volatile atomic_t *v) static inline int atomic_add_negative(int i, volatile atomic_t *v)
{ {
unsigned long flags; unsigned long flags;
int result; int val;
__save_flags_cli(flags); __save_flags_cli(flags);
v->counter += i; val = v->counter;
result = (v->counter < 0); v->counter = val += i;
__restore_flags(flags); __restore_flags(flags);
return result; return val < 0;
} }
static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *addr) static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *addr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment