[PATCH 03/13] Make generic bitops return bool

From: David Howells
Date: Wed Apr 29 2015 - 15:24:58 EST


Make generic bit handling functions return a bool type when they're returning
a simple boolean value. This allows gcc to make better choices and produce
better warnings.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---

include/asm-generic/bitops/ext2-atomic.h | 4 ++--
include/asm-generic/bitops/le.h | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/asm-generic/bitops/ext2-atomic.h b/include/asm-generic/bitops/ext2-atomic.h
index 87f0f109d7f1..8048f8b38720 100644
--- a/include/asm-generic/bitops/ext2-atomic.h
+++ b/include/asm-generic/bitops/ext2-atomic.h
@@ -7,7 +7,7 @@

#define ext2_set_bit_atomic(lock, nr, addr) \
({ \
- int ret; \
+ bool ret; \
spin_lock(lock); \
ret = __test_and_set_bit_le(nr, addr); \
spin_unlock(lock); \
@@ -16,7 +16,7 @@

#define ext2_clear_bit_atomic(lock, nr, addr) \
({ \
- int ret; \
+ bool ret; \
spin_lock(lock); \
ret = __test_and_clear_bit_le(nr, addr); \
spin_unlock(lock); \
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index 61731543c00e..c610b9943a08 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -49,7 +49,7 @@ extern unsigned long find_next_bit_le(const void *addr,
#error "Please fix <asm/byteorder.h>"
#endif

-static inline int test_bit_le(int nr, const void *addr)
+static inline bool test_bit_le(int nr, const void *addr)
{
return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}
@@ -74,22 +74,22 @@ static inline void __clear_bit_le(int nr, void *addr)
__clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}

-static inline int test_and_set_bit_le(int nr, void *addr)
+static inline bool test_and_set_bit_le(int nr, void *addr)
{
return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}

-static inline int test_and_clear_bit_le(int nr, void *addr)
+static inline bool test_and_clear_bit_le(int nr, void *addr)
{
return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}

-static inline int __test_and_set_bit_le(int nr, void *addr)
+static inline bool __test_and_set_bit_le(int nr, void *addr)
{
return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}

-static inline int __test_and_clear_bit_le(int nr, void *addr)
+static inline bool __test_and_clear_bit_le(int nr, void *addr)
{
return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/