bitmap: find_last_bit(): fix for avr32

Move find_last_bit into its own file.

The linux-next build (avr32 defconfig) failed like this:

arch/avr32/lib/lib.a(findbit.o): In function `generic_find_next_le_bit':
arch/avr32/lib/findbit.S:(.text+0xa6): multiple definition of `generic_find_next_le_bit'
lib/lib.a(find_next_bit.o):find_next_bit.c:(.text+0x58): first defined here
arch/avr32/lib/lib.a(findbit.o): In function `generic_find_next_zero_le_bit':
arch/avr32/lib/findbit.S:(.text+0xde): multiple definition of `generic_find_next_zero_le_bit'
lib/lib.a(find_next_bit.o):find_next_bit.c:(.text+0x144): first defined here

Caused by commit 9c5b94713eeadb030a3c72f7bfb07d7695f75699
("bitmap:find_last_bit") which caused lib/find_next_bit.o to be built
where it would not have been before.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 lib/Makefile        |    2 +-
 lib/find_last_bit.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 lib/find_next_bit.c |   31 -------------------------------
 3 files changed, 46 insertions(+), 32 deletions(-)

diff --git a/lib/Makefile b/lib/Makefile
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -37,7 +37,7 @@ lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) +=
 lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
 lib-$(CONFIG_GENERIC_FIND_FIRST_BIT) += find_next_bit.o
 lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += find_next_bit.o
-lib-$(CONFIG_GENERIC_FIND_LAST_BIT) += find_next_bit.o
+lib-$(CONFIG_GENERIC_FIND_LAST_BIT) += find_last_bit.o
 obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
 obj-$(CONFIG_LOCK_KERNEL) += kernel_lock.o
 obj-$(CONFIG_PLIST) += plist.o
diff --git a/lib/find_last_bit.c b/lib/find_last_bit.c
new file mode 100644
--- /dev/null
+++ b/lib/find_last_bit.c
@@ -0,0 +1,45 @@
+/* find_last_bit.c: fallback find next bit implementation
+ *
+ * Copyright (C) 2008 IBM Corporation
+ * Written by Rusty Russell <rusty@rustcorp.com.au>
+ * (Inspired by David Howell's find_next_bit implementation)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/bitops.h>
+#include <linux/module.h>
+#include <asm/types.h>
+#include <asm/byteorder.h>
+
+unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
+{
+	unsigned long words;
+	unsigned long tmp;
+
+	/* Start at final word. */
+	words = size / BITS_PER_LONG;
+
+	/* Partial final word? */
+	if (size & (BITS_PER_LONG-1)) {
+		tmp = (addr[words] & (~0UL >> (BITS_PER_LONG
+					 - (size & (BITS_PER_LONG-1)))));
+		if (tmp)
+			goto found;
+	}
+
+	while (words) {
+		tmp = addr[--words];
+		if (tmp) {
+found:
+			return words * BITS_PER_LONG + __fls(tmp);
+		}
+	}
+
+	/* Not found */
+	return size;
+}
+EXPORT_SYMBOL(find_last_bit);
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -159,37 +159,6 @@ EXPORT_SYMBOL(find_first_zero_bit);
 EXPORT_SYMBOL(find_first_zero_bit);
 #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
 
-#ifdef CONFIG_GENERIC_FIND_LAST_BIT
-unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
-{
-	unsigned long words;
-	unsigned long tmp;
-
-	/* Start at final word. */
-	words = size / BITS_PER_LONG;
-
-	/* Partial final word? */
-	if (size & (BITS_PER_LONG-1)) {
-		tmp = (addr[words] & (~0UL >> (BITS_PER_LONG
-					 - (size & (BITS_PER_LONG-1)))));
-		if (tmp)
-			goto found;
-	}
-
-	while (words) {
-		tmp = addr[--words];
-		if (tmp) {
-found:
-			return words * BITS_PER_LONG + __fls(tmp);
-		}
-	}
-
-	/* Not found */
-	return size;
-}
-EXPORT_SYMBOL(find_last_bit);
-#endif /* CONFIG_GENERIC_FIND_LAST_BIT */
-
 #ifdef __BIG_ENDIAN
 
 /* include/linux/byteorder does not support "unsigned long" type */
