Commit 0a5c3c2f authored by Vasily Gorbik's avatar Vasily Gorbik Committed by Heiko Carstens

s390/bitops: make test functions return bool

Make s390/bitops test functions return bool values. That enforces return
value range to 0 and 1 and matches with asm-generic/bitops-instrumented.h
declarations as well as some other architectures implementations.
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Reviewed-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 5518aed8
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/typecheck.h> #include <linux/typecheck.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/types.h>
#include <asm/atomic_ops.h> #include <asm/atomic_ops.h>
#include <asm/barrier.h> #include <asm/barrier.h>
...@@ -118,7 +119,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *ptr) ...@@ -118,7 +119,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *ptr)
__atomic64_xor(mask, (long *)addr); __atomic64_xor(mask, (long *)addr);
} }
static inline int static inline bool
test_and_set_bit(unsigned long nr, volatile unsigned long *ptr) test_and_set_bit(unsigned long nr, volatile unsigned long *ptr)
{ {
unsigned long *addr = __bitops_word(nr, ptr); unsigned long *addr = __bitops_word(nr, ptr);
...@@ -129,7 +130,7 @@ test_and_set_bit(unsigned long nr, volatile unsigned long *ptr) ...@@ -129,7 +130,7 @@ test_and_set_bit(unsigned long nr, volatile unsigned long *ptr)
return (old & mask) != 0; return (old & mask) != 0;
} }
static inline int static inline bool
test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr) test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr)
{ {
unsigned long *addr = __bitops_word(nr, ptr); unsigned long *addr = __bitops_word(nr, ptr);
...@@ -140,7 +141,7 @@ test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr) ...@@ -140,7 +141,7 @@ test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr)
return (old & ~mask) != 0; return (old & ~mask) != 0;
} }
static inline int static inline bool
test_and_change_bit(unsigned long nr, volatile unsigned long *ptr) test_and_change_bit(unsigned long nr, volatile unsigned long *ptr)
{ {
unsigned long *addr = __bitops_word(nr, ptr); unsigned long *addr = __bitops_word(nr, ptr);
...@@ -173,7 +174,7 @@ static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr) ...@@ -173,7 +174,7 @@ static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
*addr ^= 1 << (nr & 7); *addr ^= 1 << (nr & 7);
} }
static inline int static inline bool
__test_and_set_bit(unsigned long nr, volatile unsigned long *ptr) __test_and_set_bit(unsigned long nr, volatile unsigned long *ptr)
{ {
unsigned char *addr = __bitops_byte(nr, ptr); unsigned char *addr = __bitops_byte(nr, ptr);
...@@ -184,7 +185,7 @@ __test_and_set_bit(unsigned long nr, volatile unsigned long *ptr) ...@@ -184,7 +185,7 @@ __test_and_set_bit(unsigned long nr, volatile unsigned long *ptr)
return (ch >> (nr & 7)) & 1; return (ch >> (nr & 7)) & 1;
} }
static inline int static inline bool
__test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr) __test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr)
{ {
unsigned char *addr = __bitops_byte(nr, ptr); unsigned char *addr = __bitops_byte(nr, ptr);
...@@ -195,7 +196,7 @@ __test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr) ...@@ -195,7 +196,7 @@ __test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr)
return (ch >> (nr & 7)) & 1; return (ch >> (nr & 7)) & 1;
} }
static inline int static inline bool
__test_and_change_bit(unsigned long nr, volatile unsigned long *ptr) __test_and_change_bit(unsigned long nr, volatile unsigned long *ptr)
{ {
unsigned char *addr = __bitops_byte(nr, ptr); unsigned char *addr = __bitops_byte(nr, ptr);
...@@ -206,7 +207,7 @@ __test_and_change_bit(unsigned long nr, volatile unsigned long *ptr) ...@@ -206,7 +207,7 @@ __test_and_change_bit(unsigned long nr, volatile unsigned long *ptr)
return (ch >> (nr & 7)) & 1; return (ch >> (nr & 7)) & 1;
} }
static inline int test_bit(unsigned long nr, const volatile unsigned long *ptr) static inline bool test_bit(unsigned long nr, const volatile unsigned long *ptr)
{ {
const volatile unsigned char *addr; const volatile unsigned char *addr;
...@@ -215,8 +216,8 @@ static inline int test_bit(unsigned long nr, const volatile unsigned long *ptr) ...@@ -215,8 +216,8 @@ static inline int test_bit(unsigned long nr, const volatile unsigned long *ptr)
return (*addr >> (nr & 7)) & 1; return (*addr >> (nr & 7)) & 1;
} }
static inline int test_and_set_bit_lock(unsigned long nr, static inline bool test_and_set_bit_lock(unsigned long nr,
volatile unsigned long *ptr) volatile unsigned long *ptr)
{ {
if (test_bit(nr, ptr)) if (test_bit(nr, ptr))
return 1; return 1;
...@@ -261,7 +262,8 @@ static inline void clear_bit_inv(unsigned long nr, volatile unsigned long *ptr) ...@@ -261,7 +262,8 @@ static inline void clear_bit_inv(unsigned long nr, volatile unsigned long *ptr)
return clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); return clear_bit(nr ^ (BITS_PER_LONG - 1), ptr);
} }
static inline int test_and_clear_bit_inv(unsigned long nr, volatile unsigned long *ptr) static inline bool test_and_clear_bit_inv(unsigned long nr,
volatile unsigned long *ptr)
{ {
return test_and_clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); return test_and_clear_bit(nr ^ (BITS_PER_LONG - 1), ptr);
} }
...@@ -276,8 +278,8 @@ static inline void __clear_bit_inv(unsigned long nr, volatile unsigned long *ptr ...@@ -276,8 +278,8 @@ static inline void __clear_bit_inv(unsigned long nr, volatile unsigned long *ptr
return __clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); return __clear_bit(nr ^ (BITS_PER_LONG - 1), ptr);
} }
static inline int test_bit_inv(unsigned long nr, static inline bool test_bit_inv(unsigned long nr,
const volatile unsigned long *ptr) const volatile unsigned long *ptr)
{ {
return test_bit(nr ^ (BITS_PER_LONG - 1), ptr); return test_bit(nr ^ (BITS_PER_LONG - 1), ptr);
} }
......
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