locking/atomic, arc: Use s64 for atomic64

As a step towards making the atomic64 API use consistent types treewide,
let's have the arc atomic64 implementation use s64 as the underlying
type for atomic64_t, rather than u64, matching the generated headers.

Otherwise, there should be no functional change as a result of this
patch.

Acked-By: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: aou@eecs.berkeley.edu
Cc: arnd@arndb.de
Cc: bp@alien8.de
Cc: catalin.marinas@arm.com
Cc: davem@davemloft.net
Cc: fenghua.yu@intel.com
Cc: heiko.carstens@de.ibm.com
Cc: herbert@gondor.apana.org.au
Cc: ink@jurassic.park.msu.ru
Cc: jhogan@kernel.org
Cc: linux@armlinux.org.uk
Cc: mattst88@gmail.com
Cc: mpe@ellerman.id.au
Cc: palmer@sifive.com
Cc: paul.burton@mips.com
Cc: paulus@samba.org
Cc: ralf@linux-mips.org
Cc: rth@twiddle.net
Cc: tony.luck@intel.com
Link: https://lkml.kernel.org/r/20190522132250.26499-6-mark.rutland@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Mark Rutland 2019-05-22 14:22:37 +01:00 committed by Ingo Molnar
parent 0203fdc160
commit 16fbad0869

View file

@ -324,14 +324,14 @@ ATOMIC_OPS(xor, ^=, CTOP_INST_AXOR_DI_R2_R2_R3)
*/ */
typedef struct { typedef struct {
aligned_u64 counter; s64 __aligned(8) counter;
} atomic64_t; } atomic64_t;
#define ATOMIC64_INIT(a) { (a) } #define ATOMIC64_INIT(a) { (a) }
static inline long long atomic64_read(const atomic64_t *v) static inline s64 atomic64_read(const atomic64_t *v)
{ {
unsigned long long val; s64 val;
__asm__ __volatile__( __asm__ __volatile__(
" ldd %0, [%1] \n" " ldd %0, [%1] \n"
@ -341,7 +341,7 @@ static inline long long atomic64_read(const atomic64_t *v)
return val; return val;
} }
static inline void atomic64_set(atomic64_t *v, long long a) static inline void atomic64_set(atomic64_t *v, s64 a)
{ {
/* /*
* This could have been a simple assignment in "C" but would need * This could have been a simple assignment in "C" but would need
@ -362,9 +362,9 @@ static inline void atomic64_set(atomic64_t *v, long long a)
} }
#define ATOMIC64_OP(op, op1, op2) \ #define ATOMIC64_OP(op, op1, op2) \
static inline void atomic64_##op(long long a, atomic64_t *v) \ static inline void atomic64_##op(s64 a, atomic64_t *v) \
{ \ { \
unsigned long long val; \ s64 val; \
\ \
__asm__ __volatile__( \ __asm__ __volatile__( \
"1: \n" \ "1: \n" \
@ -375,13 +375,13 @@ static inline void atomic64_##op(long long a, atomic64_t *v) \
" bnz 1b \n" \ " bnz 1b \n" \
: "=&r"(val) \ : "=&r"(val) \
: "r"(&v->counter), "ir"(a) \ : "r"(&v->counter), "ir"(a) \
: "cc"); \ : "cc"); \
} \ } \
#define ATOMIC64_OP_RETURN(op, op1, op2) \ #define ATOMIC64_OP_RETURN(op, op1, op2) \
static inline long long atomic64_##op##_return(long long a, atomic64_t *v) \ static inline s64 atomic64_##op##_return(s64 a, atomic64_t *v) \
{ \ { \
unsigned long long val; \ s64 val; \
\ \
smp_mb(); \ smp_mb(); \
\ \
@ -402,9 +402,9 @@ static inline long long atomic64_##op##_return(long long a, atomic64_t *v) \
} }
#define ATOMIC64_FETCH_OP(op, op1, op2) \ #define ATOMIC64_FETCH_OP(op, op1, op2) \
static inline long long atomic64_fetch_##op(long long a, atomic64_t *v) \ static inline s64 atomic64_fetch_##op(s64 a, atomic64_t *v) \
{ \ { \
unsigned long long val, orig; \ s64 val, orig; \
\ \
smp_mb(); \ smp_mb(); \
\ \
@ -444,10 +444,10 @@ ATOMIC64_OPS(xor, xor, xor)
#undef ATOMIC64_OP_RETURN #undef ATOMIC64_OP_RETURN
#undef ATOMIC64_OP #undef ATOMIC64_OP
static inline long long static inline s64
atomic64_cmpxchg(atomic64_t *ptr, long long expected, long long new) atomic64_cmpxchg(atomic64_t *ptr, s64 expected, s64 new)
{ {
long long prev; s64 prev;
smp_mb(); smp_mb();
@ -467,9 +467,9 @@ atomic64_cmpxchg(atomic64_t *ptr, long long expected, long long new)
return prev; return prev;
} }
static inline long long atomic64_xchg(atomic64_t *ptr, long long new) static inline s64 atomic64_xchg(atomic64_t *ptr, s64 new)
{ {
long long prev; s64 prev;
smp_mb(); smp_mb();
@ -495,9 +495,9 @@ static inline long long atomic64_xchg(atomic64_t *ptr, long long new)
* the atomic variable, v, was not decremented. * the atomic variable, v, was not decremented.
*/ */
static inline long long atomic64_dec_if_positive(atomic64_t *v) static inline s64 atomic64_dec_if_positive(atomic64_t *v)
{ {
long long val; s64 val;
smp_mb(); smp_mb();
@ -528,10 +528,9 @@ static inline long long atomic64_dec_if_positive(atomic64_t *v)
* Atomically adds @a to @v, if it was not @u. * Atomically adds @a to @v, if it was not @u.
* Returns the old value of @v * Returns the old value of @v
*/ */
static inline long long atomic64_fetch_add_unless(atomic64_t *v, long long a, static inline s64 atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u)
long long u)
{ {
long long old, temp; s64 old, temp;
smp_mb(); smp_mb();