[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1295702039-23186-6-git-send-email-akinobu.mita@gmail.com>
Date: Sat, 22 Jan 2011 22:13:37 +0900
From: Akinobu Mita <akinobu.mita@...il.com>
To: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
akpm@...ux-foundation.org
Cc: Akinobu Mita <akinobu.mita@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>,
Richard Henderson <rth@...ddle.net>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Mikael Starvik <starvik@...s.com>,
David Howells <dhowells@...hat.com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
"Luck, Tony" <tony.luck@...el.com>,
Ralf Baechle <ralf@...ux-mips.org>,
Kyle McMartin <kyle@...artin.ca>,
Matthew Wilcox <willy@...ian.org>,
Grant Grundler <grundler@...isc-linux.org>,
Paul Mundt <lethal@...ux-sh.org>,
Kazumoto Kojima <kkojima@...iij4u.or.jp>,
Hirokazu Takata <takata@...ux-m32r.org>,
"David S. Miller" <davem@...emloft.net>,
Chris Zankel <chris@...kel.net>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
Hans-Christian Egtvedt <hans-christian.egtvedt@...el.com>,
"H. Peter Anvin" <hpa@...or.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>
Subject: [PATCH v5 05/27] asm-generic: change little-endian bitops to take any pointer types
This makes the little-endian bitops take any pointer types by
changing the prototypes and adding casts in the preprocessor macros.
That would seem to at least make all the filesystem code happier, and
they can continue to do just something like
#define ext2_set_bit __test_and_set_bit_le
(or whatever the exact sequence ends up being).
Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Richard Henderson <rth@...ddle.net>
Cc: Ivan Kokshaysky <ink@...assic.park.msu.ru>
Cc: Mikael Starvik <starvik@...s.com>
Cc: David Howells <dhowells@...hat.com>
Cc: Yoshinori Sato <ysato@...rs.sourceforge.jp>
Cc: "Luck, Tony" <tony.luck@...el.com>
Cc: Ralf Baechle <ralf@...ux-mips.org>
Cc: Kyle McMartin <kyle@...artin.ca>
Cc: Matthew Wilcox <willy@...ian.org>
Cc: Grant Grundler <grundler@...isc-linux.org>
Cc: Paul Mundt <lethal@...ux-sh.org>
Cc: Kazumoto Kojima <kkojima@...iij4u.or.jp>
Cc: Hirokazu Takata <takata@...ux-m32r.org>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Chris Zankel <chris@...kel.net>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Hans-Christian Egtvedt <hans-christian.egtvedt@...el.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Paul Mackerras <paulus@...ba.org>
---
Change from v4:
- new patch
The whole series is available in the git branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v5
arch/powerpc/include/asm/bitops.h | 4 ++--
include/asm-generic/bitops/le.h | 24 ++++++++++++------------
lib/find_next_bit.c | 10 ++++++----
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
index 97aacbd..db567ed 100644
--- a/arch/powerpc/include/asm/bitops.h
+++ b/arch/powerpc/include/asm/bitops.h
@@ -305,10 +305,10 @@ static __inline__ int test_le_bit(unsigned long nr,
#define find_first_zero_bit_le(addr, size) \
find_next_zero_bit_le((addr), (size), 0)
-unsigned long find_next_zero_bit_le(const unsigned long *addr,
+unsigned long find_next_zero_bit_le(const void *addr,
unsigned long size, unsigned long offset);
-unsigned long find_next_bit_le(const unsigned long *addr,
+unsigned long find_next_bit_le(const void *addr,
unsigned long size, unsigned long offset);
/* Bitmap functions for the ext2 filesystem */
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index 394ac3e..7644a15 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -9,19 +9,19 @@
#define BITOP_LE_SWIZZLE 0
#define find_next_zero_bit_le(addr, size, offset) \
- find_next_zero_bit(addr, size, offset)
+ find_next_zero_bit((unsigned long *)(addr), size, offset)
#define find_next_bit_le(addr, size, offset) \
- find_next_bit(addr, size, offset)
+ find_next_bit((unsigned long *)(addr), size, offset)
#define find_first_zero_bit_le(addr, size) \
- find_first_zero_bit(addr, size)
+ find_first_zero_bit((unsigned long *)(addr), size)
#elif defined(__BIG_ENDIAN)
#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
-extern unsigned long find_next_zero_bit_le(const unsigned long *addr,
+extern unsigned long find_next_zero_bit_le(const void *addr,
unsigned long size, unsigned long offset);
-extern unsigned long find_next_bit_le(const unsigned long *addr,
+extern unsigned long find_next_bit_le(const void *addr,
unsigned long size, unsigned long offset);
#define find_first_zero_bit_le(addr, size) \
@@ -32,20 +32,20 @@ extern unsigned long find_next_bit_le(const unsigned long *addr,
#endif
#define test_bit_le(nr, addr) \
- test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ test_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))
#define __set_bit_le(nr, addr) \
- __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ __set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))
#define __clear_bit_le(nr, addr) \
- __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))
#define test_and_set_bit_le(nr, addr) \
- test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))
#define test_and_clear_bit_le(nr, addr) \
- test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))
#define __test_and_set_bit_le(nr, addr) \
- __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))
#define __test_and_clear_bit_le(nr, addr) \
- __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))
#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c
index c093ba9..7667c3d 100644
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -185,15 +185,16 @@ static inline unsigned long ext2_swab(const unsigned long y)
#endif
}
-unsigned long find_next_zero_bit_le(const unsigned long *addr, unsigned
+unsigned long find_next_zero_bit_le(const void *addr, unsigned
long size, unsigned long offset)
{
- const unsigned long *p = addr + BITOP_WORD(offset);
+ const unsigned long *p = addr;
unsigned long result = offset & ~(BITS_PER_LONG - 1);
unsigned long tmp;
if (offset >= size)
return size;
+ p += BITOP_WORD(offset);
size -= result;
offset &= (BITS_PER_LONG - 1UL);
if (offset) {
@@ -228,15 +229,16 @@ found_middle_swap:
}
EXPORT_SYMBOL(find_next_zero_bit_le);
-unsigned long find_next_bit_le(const unsigned long *addr, unsigned
+unsigned long find_next_bit_le(const void *addr, unsigned
long size, unsigned long offset)
{
- const unsigned long *p = addr + BITOP_WORD(offset);
+ const unsigned long *p = addr;
unsigned long result = offset & ~(BITS_PER_LONG - 1);
unsigned long tmp;
if (offset >= size)
return size;
+ p += BITOP_WORD(offset);
size -= result;
offset &= (BITS_PER_LONG - 1UL);
if (offset) {
--
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists