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: Vasily Gorbik <gor@linux.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
This commit is contained in:
parent
5518aed82d
commit
0a5c3c2f47
|
@ -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)
|
||||||
__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)
|
||||||
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)
|
||||||
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)
|
||||||
*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)
|
||||||
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)
|
||||||
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)
|
||||||
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)
|
||||||
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)
|
||||||
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
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue