Commit-ID:  3724921396dd1a07c93e3516b8d7c9ff570d17a9
Gitweb:     https://git.kernel.org/tip/3724921396dd1a07c93e3516b8d7c9ff570d17a9
Author:     Mark Rutland <mark.rutl...@arm.com>
AuthorDate: Wed, 22 May 2019 14:22:48 +0100
Committer:  Ingo Molnar <mi...@kernel.org>
CommitDate: Mon, 3 Jun 2019 12:32:57 +0200

locking/atomic: Use s64 for atomic64_t on 64-bit

Now that all architectures use 64 consistently as the base type for the
atomic64 API, let's have the CONFIG_64BIT definition of atomic64_t use
s64 as the underlying type for atomic64_t, rather than long, matching
the generated headers.

On architectures where atomic64_read(v) is READ_ONCE(v->counter), this
patch will cause the return type of atomic64_read() to be s64.

As of this patch, the atomic64 API can be relied upon to consistently
return s64 where a value rather than boolean condition is returned. This
should make code more robust, and simpler, allowing for the removal of
casts previously required to ensure consistent types.

Signed-off-by: Mark Rutland <mark.rutl...@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Will Deacon <will.dea...@arm.com>
Cc: a...@eecs.berkeley.edu
Cc: a...@arndb.de
Cc: b...@alien8.de
Cc: catalin.mari...@arm.com
Cc: da...@davemloft.net
Cc: fenghua...@intel.com
Cc: heiko.carst...@de.ibm.com
Cc: herb...@gondor.apana.org.au
Cc: i...@jurassic.park.msu.ru
Cc: jho...@kernel.org
Cc: li...@armlinux.org.uk
Cc: matts...@gmail.com
Cc: m...@ellerman.id.au
Cc: pal...@sifive.com
Cc: paul.bur...@mips.com
Cc: pau...@samba.org
Cc: r...@linux-mips.org
Cc: r...@twiddle.net
Cc: tony.l...@intel.com
Cc: vgu...@synopsys.com
Link: https://lkml.kernel.org/r/20190522132250.26499-17-mark.rutl...@arm.com
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 include/linux/types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/types.h b/include/linux/types.h
index 231114ae38f4..05030f608be3 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -174,7 +174,7 @@ typedef struct {
 
 #ifdef CONFIG_64BIT
 typedef struct {
-       long counter;
+       s64 counter;
 } atomic64_t;
 #endif
 

Reply via email to