linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] unicore32: fix build error for find bitops
@ 2011-06-09 11:09 GuanXuetao
  2011-06-09 11:32 ` Akinobu Mita
  0 siblings, 1 reply; 10+ messages in thread
From: GuanXuetao @ 2011-06-09 11:09 UTC (permalink / raw)
  To: arnd; +Cc: Guan Xuetao, linux-kernel, linux-arch, greg, Akinobu Mita

From: Guan Xuetao <gxt@mprc.pku.edu.cn>

Remove the __uc32_ prefix in find bitops functions.
see commit <19de85ef574c3a2182e3ccad9581805052f14946>
  bitops: add #ifndef for each of find bitops

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
---
 arch/unicore32/include/asm/bitops.h |    6 ------
 arch/unicore32/kernel/ksyms.c       |    4 ++--
 arch/unicore32/lib/findbit.S        |   14 ++++++++------
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h
index 1628a63..a9653f0 100644
--- a/arch/unicore32/include/asm/bitops.h
+++ b/arch/unicore32/include/asm/bitops.h
@@ -13,12 +13,6 @@
 #ifndef __UNICORE_BITOPS_H__
 #define __UNICORE_BITOPS_H__
 
-#define find_next_bit		__uc32_find_next_bit
-#define find_next_zero_bit	__uc32_find_next_zero_bit
-
-#define find_first_bit		__uc32_find_first_bit
-#define find_first_zero_bit	__uc32_find_first_zero_bit
-
 #define _ASM_GENERIC_BITOPS_FLS_H_
 #define _ASM_GENERIC_BITOPS___FLS_H_
 #define _ASM_GENERIC_BITOPS_FFS_H_
diff --git a/arch/unicore32/kernel/ksyms.c b/arch/unicore32/kernel/ksyms.c
index a897080..d98bd81 100644
--- a/arch/unicore32/kernel/ksyms.c
+++ b/arch/unicore32/kernel/ksyms.c
@@ -24,8 +24,8 @@
 
 #include "ksyms.h"
 
-EXPORT_SYMBOL(__uc32_find_next_zero_bit);
-EXPORT_SYMBOL(__uc32_find_next_bit);
+EXPORT_SYMBOL(find_next_zero_bit);
+EXPORT_SYMBOL(find_next_bit);
 
 EXPORT_SYMBOL(__backtrace);
 
diff --git a/arch/unicore32/lib/findbit.S b/arch/unicore32/lib/findbit.S
index c360ce9..c777462 100644
--- a/arch/unicore32/lib/findbit.S
+++ b/arch/unicore32/lib/findbit.S
@@ -17,7 +17,7 @@
  * Purpose  : Find a 'zero' bit
  * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
  */
-__uc32_find_first_zero_bit:
+ENTRY(find_first_zero_bit)
 		cxor.a	r1, #0
 		beq	3f
 		mov	r2, #0
@@ -29,13 +29,14 @@ __uc32_find_first_zero_bit:
 		bub	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
+ENDPROC(find_first_zero_bit)
 
 /*
  * Purpose  : Find next 'zero' bit
  * Prototype: int find_next_zero_bit
  *		(void *addr, unsigned int maxbit, int offset)
  */
-ENTRY(__uc32_find_next_zero_bit)
+ENTRY(find_next_zero_bit)
 		cxor.a	r1, #0
 		beq	3b
 		and.a	ip, r2, #7
@@ -47,14 +48,14 @@ ENTRY(__uc32_find_next_zero_bit)
 		or	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(__uc32_find_next_zero_bit)
+ENDPROC(find_next_zero_bit)
 
 /*
  * Purpose  : Find a 'one' bit
  * Prototype: int find_first_bit
  *		(const unsigned long *addr, unsigned int maxbit);
  */
-__uc32_find_first_bit:
+ENTRY(find_first_bit)
 		cxor.a	r1, #0
 		beq	3f
 		mov	r2, #0
@@ -66,13 +67,14 @@ __uc32_find_first_bit:
 		bub	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
+ENDPROC(find_first_bit)
 
 /*
  * Purpose  : Find next 'one' bit
  * Prototype: int find_next_zero_bit
  *		(void *addr, unsigned int maxbit, int offset)
  */
-ENTRY(__uc32_find_next_bit)
+ENTRY(find_next_bit)
 		cxor.a	r1, #0
 		beq	3b
 		and.a	ip, r2, #7
@@ -83,7 +85,7 @@ ENTRY(__uc32_find_next_bit)
 		or	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(__uc32_find_next_bit)
+ENDPROC(find_next_bit)
 
 /*
  * One or more bits in the LSB of r3 are assumed to be set.
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-09 11:09 [PATCH] unicore32: fix build error for find bitops GuanXuetao
@ 2011-06-09 11:32 ` Akinobu Mita
  2011-06-09 14:05   ` Akinobu Mita
  2011-06-10  3:13   ` Guan Xuetao
  0 siblings, 2 replies; 10+ messages in thread
From: Akinobu Mita @ 2011-06-09 11:32 UTC (permalink / raw)
  To: GuanXuetao; +Cc: arnd, linux-kernel, linux-arch, greg

2011/6/9 GuanXuetao <gxt@mprc.pku.edu.cn>:
> From: Guan Xuetao <gxt@mprc.pku.edu.cn>
>
> Remove the __uc32_ prefix in find bitops functions.
> see commit <19de85ef574c3a2182e3ccad9581805052f14946>
>  bitops: add #ifndef for each of find bitops
>
> Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
> Cc: Akinobu Mita <akinobu.mita@gmail.com>
> ---
>  arch/unicore32/include/asm/bitops.h |    6 ------
>  arch/unicore32/kernel/ksyms.c       |    4 ++--
>  arch/unicore32/lib/findbit.S        |   14 ++++++++------
>  3 files changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h
> index 1628a63..a9653f0 100644
> --- a/arch/unicore32/include/asm/bitops.h
> +++ b/arch/unicore32/include/asm/bitops.h
> @@ -13,12 +13,6 @@
>  #ifndef __UNICORE_BITOPS_H__
>  #define __UNICORE_BITOPS_H__
>
> -#define find_next_bit          __uc32_find_next_bit
> -#define find_next_zero_bit     __uc32_find_next_zero_bit
> -
> -#define find_first_bit         __uc32_find_first_bit
> -#define find_first_zero_bit    __uc32_find_first_zero_bit
> -

Is this patch really fix the build error?

If these find_*_bit macros are removed, vmlinux will have multiple
definisions of find_*_bit. Because lib/find_next_bit.c is built
unconditionally after the commit 63e424c84429903c92a0f1e9654c31ccaf6694d0
("arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-09 11:32 ` Akinobu Mita
@ 2011-06-09 14:05   ` Akinobu Mita
  2011-06-10  3:16     ` Guan Xuetao
  2011-06-10  3:13   ` Guan Xuetao
  1 sibling, 1 reply; 10+ messages in thread
From: Akinobu Mita @ 2011-06-09 14:05 UTC (permalink / raw)
  To: GuanXuetao; +Cc: arnd, linux-kernel, linux-arch, greg

[-- Attachment #1: Type: text/plain, Size: 1742 bytes --]

2011/6/9 Akinobu Mita <akinobu.mita@gmail.com>:
> 2011/6/9 GuanXuetao <gxt@mprc.pku.edu.cn>:
>> From: Guan Xuetao <gxt@mprc.pku.edu.cn>
>>
>> Remove the __uc32_ prefix in find bitops functions.
>> see commit <19de85ef574c3a2182e3ccad9581805052f14946>
>>  bitops: add #ifndef for each of find bitops
>>
>> Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
>> Cc: Akinobu Mita <akinobu.mita@gmail.com>
>> ---
>>  arch/unicore32/include/asm/bitops.h |    6 ------
>>  arch/unicore32/kernel/ksyms.c       |    4 ++--
>>  arch/unicore32/lib/findbit.S        |   14 ++++++++------
>>  3 files changed, 10 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h
>> index 1628a63..a9653f0 100644
>> --- a/arch/unicore32/include/asm/bitops.h
>> +++ b/arch/unicore32/include/asm/bitops.h
>> @@ -13,12 +13,6 @@
>>  #ifndef __UNICORE_BITOPS_H__
>>  #define __UNICORE_BITOPS_H__
>>
>> -#define find_next_bit          __uc32_find_next_bit
>> -#define find_next_zero_bit     __uc32_find_next_zero_bit
>> -
>> -#define find_first_bit         __uc32_find_first_bit
>> -#define find_first_zero_bit    __uc32_find_first_zero_bit
>> -
>
> Is this patch really fix the build error?
>
> If these find_*_bit macros are removed, vmlinux will have multiple
> definisions of find_*_bit. Because lib/find_next_bit.c is built
> unconditionally after the commit 63e424c84429903c92a0f1e9654c31ccaf6694d0
> ("arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}".

The attached patch hopefully fix the build error but it is untested
because I can't find crosstool for unicore32. So could you apply
this patch on top of your patch and check whether it fixes?

[-- Attachment #2: 0001-unicore32-fix-build-error-for-find-bitops.patch --]
[-- Type: text/x-diff, Size: 1695 bytes --]

From 133331e9314388e78619ed77cc62f6ad04233299 Mon Sep 17 00:00:00 2001
From: Akinobu Mita <akinobu.mita@gmail.com>
Date: Thu, 9 Jun 2011 22:28:37 +0900
Subject: [PATCH] unicore32: fix build error for find bitops

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 arch/unicore32/include/asm/bitops.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h
index a9653f0..fb8a29c 100644
--- a/arch/unicore32/include/asm/bitops.h
+++ b/arch/unicore32/include/asm/bitops.h
@@ -17,6 +17,7 @@
 #define _ASM_GENERIC_BITOPS___FLS_H_
 #define _ASM_GENERIC_BITOPS_FFS_H_
 #define _ASM_GENERIC_BITOPS___FFS_H_
+#define _ASM_GENERIC_BITOPS_FIND_H_
 /*
  * On UNICORE, those functions can be implemented around
  * the cntlz instruction for much better code efficiency.
@@ -36,6 +37,22 @@ static inline int fls(int x)
 #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
 #define __ffs(x) (ffs(x) - 1)
 
+extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
+		size, unsigned long offset);
+#define find_next_bit find_next_bit
+
+extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
+		long size, unsigned long offset);
+#define find_next_zero_bit find_next_zero_bit
+
+extern unsigned long find_first_bit(const unsigned long *addr,
+				    unsigned long size);
+#define find_first_bit find_first_bit
+
+extern unsigned long find_first_zero_bit(const unsigned long *addr,
+					 unsigned long size);
+#define find_first_zero_bit find_first_zero_bit
+
 #include <asm-generic/bitops.h>
 
 #endif /* __UNICORE_BITOPS_H__ */
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-09 11:32 ` Akinobu Mita
  2011-06-09 14:05   ` Akinobu Mita
@ 2011-06-10  3:13   ` Guan Xuetao
  1 sibling, 0 replies; 10+ messages in thread
From: Guan Xuetao @ 2011-06-10  3:13 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: arnd, linux-kernel, linux-arch, greg

On Thu, 2011-06-09 at 20:32 +0900, Akinobu Mita wrote:
> 2011/6/9 GuanXuetao <gxt@mprc.pku.edu.cn>:
> > From: Guan Xuetao <gxt@mprc.pku.edu.cn>
> >
> > Remove the __uc32_ prefix in find bitops functions.
> > see commit <19de85ef574c3a2182e3ccad9581805052f14946>
> >  bitops: add #ifndef for each of find bitops
> >
> > Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
> > Cc: Akinobu Mita <akinobu.mita@gmail.com>
> > ---
> >  arch/unicore32/include/asm/bitops.h |    6 ------
> >  arch/unicore32/kernel/ksyms.c       |    4 ++--
> >  arch/unicore32/lib/findbit.S        |   14 ++++++++------
> >  3 files changed, 10 insertions(+), 14 deletions(-)
> >
> > diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h
> > index 1628a63..a9653f0 100644
> > --- a/arch/unicore32/include/asm/bitops.h
> > +++ b/arch/unicore32/include/asm/bitops.h
> > @@ -13,12 +13,6 @@
> >  #ifndef __UNICORE_BITOPS_H__
> >  #define __UNICORE_BITOPS_H__
> >
> > -#define find_next_bit          __uc32_find_next_bit
> > -#define find_next_zero_bit     __uc32_find_next_zero_bit
> > -
> > -#define find_first_bit         __uc32_find_first_bit
> > -#define find_first_zero_bit    __uc32_find_first_zero_bit
> > -
> 
> Is this patch really fix the build error?
> 
> If these find_*_bit macros are removed, vmlinux will have multiple
> definisions of find_*_bit. Because lib/find_next_bit.c is built
> unconditionally after the commit 63e424c84429903c92a0f1e9654c31ccaf6694d0
> ("arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}".
Yes, the patch really 'eliminate' the build error.
However, when I checked binary code in vmlinux, it definitely uses the
functions in lib/find*.c, but not the assembly implementations in
arch/unicore32/lib/findbit.S.

Thanks & Regards,
Guan Xuetao




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-09 14:05   ` Akinobu Mita
@ 2011-06-10  3:16     ` Guan Xuetao
  2011-06-10  4:22       ` Akinobu Mita
  0 siblings, 1 reply; 10+ messages in thread
From: Guan Xuetao @ 2011-06-10  3:16 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: arnd, linux-kernel, linux-arch, greg

On Thu, 2011-06-09 at 23:05 +0900, Akinobu Mita wrote:
> 2011/6/9 Akinobu Mita <akinobu.mita@gmail.com>:
> > 2011/6/9 GuanXuetao <gxt@mprc.pku.edu.cn>:
> >> From: Guan Xuetao <gxt@mprc.pku.edu.cn>
> >>
> >> Remove the __uc32_ prefix in find bitops functions.
> >> see commit <19de85ef574c3a2182e3ccad9581805052f14946>
> >>  bitops: add #ifndef for each of find bitops
> >>
> >> Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
> >> Cc: Akinobu Mita <akinobu.mita@gmail.com>
> >> ---
> >>  arch/unicore32/include/asm/bitops.h |    6 ------
> >>  arch/unicore32/kernel/ksyms.c       |    4 ++--
> >>  arch/unicore32/lib/findbit.S        |   14 ++++++++------
> >>  3 files changed, 10 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h
> >> index 1628a63..a9653f0 100644
> >> --- a/arch/unicore32/include/asm/bitops.h
> >> +++ b/arch/unicore32/include/asm/bitops.h
> >> @@ -13,12 +13,6 @@
> >>  #ifndef __UNICORE_BITOPS_H__
> >>  #define __UNICORE_BITOPS_H__
> >>
> >> -#define find_next_bit          __uc32_find_next_bit
> >> -#define find_next_zero_bit     __uc32_find_next_zero_bit
> >> -
> >> -#define find_first_bit         __uc32_find_first_bit
> >> -#define find_first_zero_bit    __uc32_find_first_zero_bit
> >> -
> >
> > Is this patch really fix the build error?
> >
> > If these find_*_bit macros are removed, vmlinux will have multiple
> > definisions of find_*_bit. Because lib/find_next_bit.c is built
> > unconditionally after the commit 63e424c84429903c92a0f1e9654c31ccaf6694d0
> > ("arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}".
> 
> The attached patch hopefully fix the build error but it is untested
> because I can't find crosstool for unicore32. So could you apply
> this patch on top of your patch and check whether it fixes?

Thanks Akinobu.
I want to avoid the duplication of the 'extern' function definitions in
asm-generic header and arch-specific header.

Guan Xuetao


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-10  3:16     ` Guan Xuetao
@ 2011-06-10  4:22       ` Akinobu Mita
  2011-06-13  8:57         ` Guan Xuetao
  0 siblings, 1 reply; 10+ messages in thread
From: Akinobu Mita @ 2011-06-10  4:22 UTC (permalink / raw)
  To: gxt; +Cc: arnd, linux-kernel, linux-arch, greg

2011/6/10 Guan Xuetao <gxt@mprc.pku.edu.cn>:
> On Thu, 2011-06-09 at 23:05 +0900, Akinobu Mita wrote:
>> 2011/6/9 Akinobu Mita <akinobu.mita@gmail.com>:
>> > 2011/6/9 GuanXuetao <gxt@mprc.pku.edu.cn>:
>> >> From: Guan Xuetao <gxt@mprc.pku.edu.cn>
>> >>
>> >> Remove the __uc32_ prefix in find bitops functions.
>> >> see commit <19de85ef574c3a2182e3ccad9581805052f14946>
>> >>  bitops: add #ifndef for each of find bitops
>> >>
>> >> Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
>> >> Cc: Akinobu Mita <akinobu.mita@gmail.com>
>> >> ---
>> >>  arch/unicore32/include/asm/bitops.h |    6 ------
>> >>  arch/unicore32/kernel/ksyms.c       |    4 ++--
>> >>  arch/unicore32/lib/findbit.S        |   14 ++++++++------
>> >>  3 files changed, 10 insertions(+), 14 deletions(-)
>> >>
>> >> diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h
>> >> index 1628a63..a9653f0 100644
>> >> --- a/arch/unicore32/include/asm/bitops.h
>> >> +++ b/arch/unicore32/include/asm/bitops.h
>> >> @@ -13,12 +13,6 @@
>> >>  #ifndef __UNICORE_BITOPS_H__
>> >>  #define __UNICORE_BITOPS_H__
>> >>
>> >> -#define find_next_bit          __uc32_find_next_bit
>> >> -#define find_next_zero_bit     __uc32_find_next_zero_bit
>> >> -
>> >> -#define find_first_bit         __uc32_find_first_bit
>> >> -#define find_first_zero_bit    __uc32_find_first_zero_bit
>> >> -
>> >
>> > Is this patch really fix the build error?
>> >
>> > If these find_*_bit macros are removed, vmlinux will have multiple
>> > definisions of find_*_bit. Because lib/find_next_bit.c is built
>> > unconditionally after the commit 63e424c84429903c92a0f1e9654c31ccaf6694d0
>> > ("arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}".
>>
>> The attached patch hopefully fix the build error but it is untested
>> because I can't find crosstool for unicore32. So could you apply
>> this patch on top of your patch and check whether it fixes?
>
> Thanks Akinobu.
> I want to avoid the duplication of the 'extern' function definitions in
> asm-generic header and arch-specific header.

OK then adding the following four lines after asm-generic/bitops.h
inclusion should fix the problem.

#define find_next_bit find_next_bit
#define find_next_zero_bit find_next_zero_bit
#define find_first_bit find_first_bit
#define find_first_zero_bit find_first_zero_bit

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-10  4:22       ` Akinobu Mita
@ 2011-06-13  8:57         ` Guan Xuetao
  2011-06-13  9:33           ` Akinobu Mita
  0 siblings, 1 reply; 10+ messages in thread
From: Guan Xuetao @ 2011-06-13  8:57 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: arnd, linux-kernel, linux-arch, greg

On Fri, 2011-06-10 at 13:22 +0900, Akinobu Mita wrote:
> 2011/6/10 Guan Xuetao <gxt@mprc.pku.edu.cn>:
> > On Thu, 2011-06-09 at 23:05 +0900, Akinobu Mita wrote:
> >> 2011/6/9 Akinobu Mita <akinobu.mita@gmail.com>:
> >> > 2011/6/9 GuanXuetao <gxt@mprc.pku.edu.cn>:
> >> >> From: Guan Xuetao <gxt@mprc.pku.edu.cn>
> >> >>
> >> >> Remove the __uc32_ prefix in find bitops functions.
> >> >> see commit <19de85ef574c3a2182e3ccad9581805052f14946>
> >> >>  bitops: add #ifndef for each of find bitops
> >> >>
> >> >> Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
> >> >> Cc: Akinobu Mita <akinobu.mita@gmail.com>
> >> >> ---
> >> >>  arch/unicore32/include/asm/bitops.h |    6 ------
> >> >>  arch/unicore32/kernel/ksyms.c       |    4 ++--
> >> >>  arch/unicore32/lib/findbit.S        |   14 ++++++++------
> >> >>  3 files changed, 10 insertions(+), 14 deletions(-)
> >> >>
> >> >> diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h
> >> >> index 1628a63..a9653f0 100644
> >> >> --- a/arch/unicore32/include/asm/bitops.h
> >> >> +++ b/arch/unicore32/include/asm/bitops.h
> >> >> @@ -13,12 +13,6 @@
> >> >>  #ifndef __UNICORE_BITOPS_H__
> >> >>  #define __UNICORE_BITOPS_H__
> >> >>
> >> >> -#define find_next_bit          __uc32_find_next_bit
> >> >> -#define find_next_zero_bit     __uc32_find_next_zero_bit
> >> >> -
> >> >> -#define find_first_bit         __uc32_find_first_bit
> >> >> -#define find_first_zero_bit    __uc32_find_first_zero_bit
> >> >> -
> >> >
> >> > Is this patch really fix the build error?
> >> >
> >> > If these find_*_bit macros are removed, vmlinux will have multiple
> >> > definisions of find_*_bit. Because lib/find_next_bit.c is built
> >> > unconditionally after the commit 63e424c84429903c92a0f1e9654c31ccaf6694d0
> >> > ("arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}".
> >>
> >> The attached patch hopefully fix the build error but it is untested
> >> because I can't find crosstool for unicore32. So could you apply
> >> this patch on top of your patch and check whether it fixes?
> >
> > Thanks Akinobu.
> > I want to avoid the duplication of the 'extern' function definitions in
> > asm-generic header and arch-specific header.
> 
> OK then adding the following four lines after asm-generic/bitops.h
> inclusion should fix the problem.
> 
> #define find_next_bit find_next_bit
> #define find_next_zero_bit find_next_zero_bit
> #define find_first_bit find_first_bit
> #define find_first_zero_bit find_first_zero_bit

Thanks, please review following patch:
>From 660882536a3c7c77e0f8d817dabcbbecab20367d Mon Sep 17 00:00:00 2001
From: Guan Xuetao <gxt@mprc.pku.edu.cn>
Date: Mon, 13 Jun 2011 11:44:49 +0800
Subject: [PATCH] unicore32: fix build error for find bitops

Remove the __uc32_ prefix in find bitops functions.
Move find_* macros behind asm-generic/bitops.h inclusion.
see commit <19de85ef574c3a2182e3ccad9581805052f14946>
  bitops: add #ifndef for each of find bitops
also see commit <63e424c84429903c92a0f1e9654c31ccaf6694d0>
  arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
---
 arch/unicore32/include/asm/bitops.h |   12 ++++++------
 arch/unicore32/kernel/ksyms.c       |    4 ++--
 arch/unicore32/lib/findbit.S        |   14 ++++++++------
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/unicore32/include/asm/bitops.h
b/arch/unicore32/include/asm/bitops.h
index 1628a63..401f597 100644
--- a/arch/unicore32/include/asm/bitops.h
+++ b/arch/unicore32/include/asm/bitops.h
@@ -13,12 +13,6 @@
 #ifndef __UNICORE_BITOPS_H__
 #define __UNICORE_BITOPS_H__
 
-#define find_next_bit		__uc32_find_next_bit
-#define find_next_zero_bit	__uc32_find_next_zero_bit
-
-#define find_first_bit		__uc32_find_first_bit
-#define find_first_zero_bit	__uc32_find_first_zero_bit
-
 #define _ASM_GENERIC_BITOPS_FLS_H_
 #define _ASM_GENERIC_BITOPS___FLS_H_
 #define _ASM_GENERIC_BITOPS_FFS_H_
@@ -44,4 +38,10 @@ static inline int fls(int x)
 
 #include <asm-generic/bitops.h>
 
+/* following definitions: to avoid using codes in lib/find_*.c */
+#define find_next_bit		find_next_bit
+#define find_next_zero_bit	find_next_zero_bit
+#define find_first_bit		find_first_bit
+#define find_first_zero_bit	find_first_zero_bit
+
 #endif /* __UNICORE_BITOPS_H__ */
diff --git a/arch/unicore32/kernel/ksyms.c
b/arch/unicore32/kernel/ksyms.c
index a897080..d98bd81 100644
--- a/arch/unicore32/kernel/ksyms.c
+++ b/arch/unicore32/kernel/ksyms.c
@@ -24,8 +24,8 @@
 
 #include "ksyms.h"
 
-EXPORT_SYMBOL(__uc32_find_next_zero_bit);
-EXPORT_SYMBOL(__uc32_find_next_bit);
+EXPORT_SYMBOL(find_next_zero_bit);
+EXPORT_SYMBOL(find_next_bit);
 
 EXPORT_SYMBOL(__backtrace);
 
diff --git a/arch/unicore32/lib/findbit.S b/arch/unicore32/lib/findbit.S
index c360ce9..c777462 100644
--- a/arch/unicore32/lib/findbit.S
+++ b/arch/unicore32/lib/findbit.S
@@ -17,7 +17,7 @@
  * Purpose  : Find a 'zero' bit
  * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
  */
-__uc32_find_first_zero_bit:
+ENTRY(find_first_zero_bit)
 		cxor.a	r1, #0
 		beq	3f
 		mov	r2, #0
@@ -29,13 +29,14 @@ __uc32_find_first_zero_bit:
 		bub	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
+ENDPROC(find_first_zero_bit)
 
 /*
  * Purpose  : Find next 'zero' bit
  * Prototype: int find_next_zero_bit
  *		(void *addr, unsigned int maxbit, int offset)
  */
-ENTRY(__uc32_find_next_zero_bit)
+ENTRY(find_next_zero_bit)
 		cxor.a	r1, #0
 		beq	3b
 		and.a	ip, r2, #7
@@ -47,14 +48,14 @@ ENTRY(__uc32_find_next_zero_bit)
 		or	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(__uc32_find_next_zero_bit)
+ENDPROC(find_next_zero_bit)
 
 /*
  * Purpose  : Find a 'one' bit
  * Prototype: int find_first_bit
  *		(const unsigned long *addr, unsigned int maxbit);
  */
-__uc32_find_first_bit:
+ENTRY(find_first_bit)
 		cxor.a	r1, #0
 		beq	3f
 		mov	r2, #0
@@ -66,13 +67,14 @@ __uc32_find_first_bit:
 		bub	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
+ENDPROC(find_first_bit)
 
 /*
  * Purpose  : Find next 'one' bit
  * Prototype: int find_next_zero_bit
  *		(void *addr, unsigned int maxbit, int offset)
  */
-ENTRY(__uc32_find_next_bit)
+ENTRY(find_next_bit)
 		cxor.a	r1, #0
 		beq	3b
 		and.a	ip, r2, #7
@@ -83,7 +85,7 @@ ENTRY(__uc32_find_next_bit)
 		or	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(__uc32_find_next_bit)
+ENDPROC(find_next_bit)
 
 /*
  * One or more bits in the LSB of r3 are assumed to be set.
-- 
1.6.2.2




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-13  8:57         ` Guan Xuetao
@ 2011-06-13  9:33           ` Akinobu Mita
  2011-06-13 10:22             ` Guan Xuetao
  0 siblings, 1 reply; 10+ messages in thread
From: Akinobu Mita @ 2011-06-13  9:33 UTC (permalink / raw)
  To: gxt; +Cc: arnd, linux-kernel, linux-arch, greg

2011/6/13 Guan Xuetao <gxt@mprc.pku.edu.cn>:
> Thanks, please review following patch:

Looks good to me.

> diff --git a/arch/unicore32/kernel/ksyms.c
> b/arch/unicore32/kernel/ksyms.c
> index a897080..d98bd81 100644
> --- a/arch/unicore32/kernel/ksyms.c
> +++ b/arch/unicore32/kernel/ksyms.c
> @@ -24,8 +24,8 @@
>
>  #include "ksyms.h"
>
> -EXPORT_SYMBOL(__uc32_find_next_zero_bit);
> -EXPORT_SYMBOL(__uc32_find_next_bit);
> +EXPORT_SYMBOL(find_next_zero_bit);
> +EXPORT_SYMBOL(find_next_bit);

I'm wondering why there are no EXPORT_SYMBOL for find_first_bit
and find_first_zero_bit.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-13  9:33           ` Akinobu Mita
@ 2011-06-13 10:22             ` Guan Xuetao
  2011-06-13 11:32               ` Akinobu Mita
  0 siblings, 1 reply; 10+ messages in thread
From: Guan Xuetao @ 2011-06-13 10:22 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: arnd, linux-kernel, linux-arch, greg

On Mon, 2011-06-13 at 18:33 +0900, Akinobu Mita wrote:
> 2011/6/13 Guan Xuetao <gxt@mprc.pku.edu.cn>:
> > Thanks, please review following patch:
> 
> Looks good to me.
Could I add your acked-by information on this patch?

> 
> > diff --git a/arch/unicore32/kernel/ksyms.c
> > b/arch/unicore32/kernel/ksyms.c
> > index a897080..d98bd81 100644
> > --- a/arch/unicore32/kernel/ksyms.c
> > +++ b/arch/unicore32/kernel/ksyms.c
> > @@ -24,8 +24,8 @@
> >
> >  #include "ksyms.h"
> >
> > -EXPORT_SYMBOL(__uc32_find_next_zero_bit);
> > -EXPORT_SYMBOL(__uc32_find_next_bit);
> > +EXPORT_SYMBOL(find_next_zero_bit);
> > +EXPORT_SYMBOL(find_next_bit);
> 
> I'm wondering why there are no EXPORT_SYMBOL for find_first_bit
> and find_first_zero_bit.
IMO, only functions that are needed by modules should be exported.
When building modules under unicore32 & pkunity-soc, we only need
find_next_bit and find_next_zero_bit exported at present, and if new
functions are required, I am going to add them in the same time.
In fact, I think, the 'arch-generic' ksyms.c is a better idea.

Guan Xuetao 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] unicore32: fix build error for find bitops
  2011-06-13 10:22             ` Guan Xuetao
@ 2011-06-13 11:32               ` Akinobu Mita
  0 siblings, 0 replies; 10+ messages in thread
From: Akinobu Mita @ 2011-06-13 11:32 UTC (permalink / raw)
  To: gxt; +Cc: arnd, linux-kernel, linux-arch, greg

2011/6/13 Guan Xuetao <gxt@mprc.pku.edu.cn>:
> On Mon, 2011-06-13 at 18:33 +0900, Akinobu Mita wrote:
>> 2011/6/13 Guan Xuetao <gxt@mprc.pku.edu.cn>:
>> > Thanks, please review following patch:
>>
>> Looks good to me.
> Could I add your acked-by information on this patch?

Of course, yes.

>> > diff --git a/arch/unicore32/kernel/ksyms.c
>> > b/arch/unicore32/kernel/ksyms.c
>> > index a897080..d98bd81 100644
>> > --- a/arch/unicore32/kernel/ksyms.c
>> > +++ b/arch/unicore32/kernel/ksyms.c
>> > @@ -24,8 +24,8 @@
>> >
>> >  #include "ksyms.h"
>> >
>> > -EXPORT_SYMBOL(__uc32_find_next_zero_bit);
>> > -EXPORT_SYMBOL(__uc32_find_next_bit);
>> > +EXPORT_SYMBOL(find_next_zero_bit);
>> > +EXPORT_SYMBOL(find_next_bit);
>>
>> I'm wondering why there are no EXPORT_SYMBOL for find_first_bit
>> and find_first_zero_bit.
> IMO, only functions that are needed by modules should be exported.
> When building modules under unicore32 & pkunity-soc, we only need
> find_next_bit and find_next_zero_bit exported at present, and if new
> functions are required, I am going to add them in the same time.
> In fact, I think, the 'arch-generic' ksyms.c is a better idea.

OK, I see.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-06-13 11:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 11:09 [PATCH] unicore32: fix build error for find bitops GuanXuetao
2011-06-09 11:32 ` Akinobu Mita
2011-06-09 14:05   ` Akinobu Mita
2011-06-10  3:16     ` Guan Xuetao
2011-06-10  4:22       ` Akinobu Mita
2011-06-13  8:57         ` Guan Xuetao
2011-06-13  9:33           ` Akinobu Mita
2011-06-13 10:22             ` Guan Xuetao
2011-06-13 11:32               ` Akinobu Mita
2011-06-10  3:13   ` Guan Xuetao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).