* [PATCH] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 1:10 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:10 UTC (permalink / raw) To: Russell King - ARM Linux, Geert Uytterhoeven Cc: linux-arm-kernel@lists.infradead.org, linux-m68k, linux-kernel@vger.kernel.org, Linux-Arch For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..10566c8 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..9e3263a 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 1:10 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:10 UTC (permalink / raw) To: Russell King - ARM Linux, Geert Uytterhoeven Cc: linux-arm-kernel@lists.infradead.org, linux-m68k, linux-kernel@vger.kernel.org, Linux-Arch For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..10566c8 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..9e3263a 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 1:10 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:10 UTC (permalink / raw) To: linux-arm-kernel For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..10566c8 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..9e3263a 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 1:10 ` Chen Gang (?) @ 2013-06-05 1:11 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:11 UTC (permalink / raw) To: Russell King - ARM Linux, Geert Uytterhoeven Cc: linux-arm-kernel@lists.infradead.org, linux-m68k, linux-kernel@vger.kernel.org, Linux-Arch Oh, sorry for word wrap. I need send patch v2, I should notice it next time. On 06/05/2013 09:10 AM, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..10566c8 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile > unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned > long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned > long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..9e3263a 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, > + * unsigned long size); > */ > ENTRY(_find_first_zero_bit_le) > teq r1, #0 > @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) > > /* > * Purpose : Find next 'zero' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, > int offset) > + * Prototype: unsigned long find_next_zero_bit(const void *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_zero_bit_le) > teq r1, #0 > @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) > > /* > * Purpose : Find a 'one' bit > - * Prototype: int find_first_bit(const unsigned long *addr, unsigned > int maxbit); > + * Prototype: unsigned long find_first_bit(const unsigned long *p, > + * unsigned long size); > */ > ENTRY(_find_first_bit_le) > teq r1, #0 > @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) > > /* > * Purpose : Find next 'one' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, > int offset) > + * Prototype: unsigned long find_next_bit(const unsigned long *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_bit_le) > teq r1, #0 > diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h > index c6baa91..b1d8752 100644 > --- a/arch/m68k/include/asm/bitops.h > +++ b/arch/m68k/include/asm/bitops.h > @@ -320,11 +320,11 @@ static inline int > bfchg_mem_test_and_change_bit(int nr, > #include <asm-generic/bitops/ffz.h> > #else > > -static inline int find_first_zero_bit(const unsigned long *vaddr, > - unsigned size) > +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -346,11 +346,12 @@ out: > } > #define find_first_zero_bit find_first_zero_bit > > -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const > unsigned long *vaddr, int size, > } > #define find_next_zero_bit find_next_zero_bit > > -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) > +static inline unsigned long find_first_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -401,11 +403,12 @@ out: > } > #define find_first_bit find_first_bit > > -static inline int find_next_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 1:11 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:11 UTC (permalink / raw) To: Russell King - ARM Linux, Geert Uytterhoeven Cc: linux-arm-kernel@lists.infradead.org, linux-m68k, linux-kernel@vger.kernel.org, Linux-Arch Oh, sorry for word wrap. I need send patch v2, I should notice it next time. On 06/05/2013 09:10 AM, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..10566c8 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile > unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned > long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned > long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..9e3263a 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, > + * unsigned long size); > */ > ENTRY(_find_first_zero_bit_le) > teq r1, #0 > @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) > > /* > * Purpose : Find next 'zero' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, > int offset) > + * Prototype: unsigned long find_next_zero_bit(const void *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_zero_bit_le) > teq r1, #0 > @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) > > /* > * Purpose : Find a 'one' bit > - * Prototype: int find_first_bit(const unsigned long *addr, unsigned > int maxbit); > + * Prototype: unsigned long find_first_bit(const unsigned long *p, > + * unsigned long size); > */ > ENTRY(_find_first_bit_le) > teq r1, #0 > @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) > > /* > * Purpose : Find next 'one' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, > int offset) > + * Prototype: unsigned long find_next_bit(const unsigned long *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_bit_le) > teq r1, #0 > diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h > index c6baa91..b1d8752 100644 > --- a/arch/m68k/include/asm/bitops.h > +++ b/arch/m68k/include/asm/bitops.h > @@ -320,11 +320,11 @@ static inline int > bfchg_mem_test_and_change_bit(int nr, > #include <asm-generic/bitops/ffz.h> > #else > > -static inline int find_first_zero_bit(const unsigned long *vaddr, > - unsigned size) > +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -346,11 +346,12 @@ out: > } > #define find_first_zero_bit find_first_zero_bit > > -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const > unsigned long *vaddr, int size, > } > #define find_next_zero_bit find_next_zero_bit > > -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) > +static inline unsigned long find_first_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -401,11 +403,12 @@ out: > } > #define find_first_bit find_first_bit > > -static inline int find_next_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 1:11 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:11 UTC (permalink / raw) To: linux-arm-kernel Oh, sorry for word wrap. I need send patch v2, I should notice it next time. On 06/05/2013 09:10 AM, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..10566c8 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile > unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned > long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned > long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..9e3263a 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, > + * unsigned long size); > */ > ENTRY(_find_first_zero_bit_le) > teq r1, #0 > @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) > > /* > * Purpose : Find next 'zero' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, > int offset) > + * Prototype: unsigned long find_next_zero_bit(const void *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_zero_bit_le) > teq r1, #0 > @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) > > /* > * Purpose : Find a 'one' bit > - * Prototype: int find_first_bit(const unsigned long *addr, unsigned > int maxbit); > + * Prototype: unsigned long find_first_bit(const unsigned long *p, > + * unsigned long size); > */ > ENTRY(_find_first_bit_le) > teq r1, #0 > @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) > > /* > * Purpose : Find next 'one' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, > int offset) > + * Prototype: unsigned long find_next_bit(const unsigned long *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_bit_le) > teq r1, #0 > diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h > index c6baa91..b1d8752 100644 > --- a/arch/m68k/include/asm/bitops.h > +++ b/arch/m68k/include/asm/bitops.h > @@ -320,11 +320,11 @@ static inline int > bfchg_mem_test_and_change_bit(int nr, > #include <asm-generic/bitops/ffz.h> > #else > > -static inline int find_first_zero_bit(const unsigned long *vaddr, > - unsigned size) > +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -346,11 +346,12 @@ out: > } > #define find_first_zero_bit find_first_zero_bit > > -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const > unsigned long *vaddr, int size, > } > #define find_next_zero_bit find_next_zero_bit > > -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) > +static inline unsigned long find_first_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -401,11 +403,12 @@ out: > } > #define find_first_bit find_first_bit > > -static inline int find_next_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 1:11 ` Chen Gang (?) @ 2013-06-05 1:13 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:13 UTC (permalink / raw) To: Russell King - ARM Linux, Geert Uytterhoeven Cc: linux-arm-kernel@lists.infradead.org, linux-m68k, linux-kernel@vger.kernel.org, Linux-Arch For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..10566c8 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..9e3263a 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 1:13 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:13 UTC (permalink / raw) To: Russell King - ARM Linux, Geert Uytterhoeven Cc: linux-arm-kernel@lists.infradead.org, linux-m68k, linux-kernel@vger.kernel.org, Linux-Arch For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..10566c8 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..9e3263a 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 1:13 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 1:13 UTC (permalink / raw) To: linux-arm-kernel For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..10566c8 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..9e3263a 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 1:13 ` Chen Gang (?) @ 2013-06-05 7:19 ` Uwe Kleine-König -1 siblings, 0 replies; 35+ messages in thread From: Uwe Kleine-König @ 2013-06-05 7:19 UTC (permalink / raw) To: Chen Gang Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hello, On Wed, Jun 05, 2013 at 09:13:01AM +0800, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..10566c8 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, doesn't checkpatch critizise the double space in the line above? > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..9e3263a 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, here is another one. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 7:19 ` Uwe Kleine-König 0 siblings, 0 replies; 35+ messages in thread From: Uwe Kleine-König @ 2013-06-05 7:19 UTC (permalink / raw) To: Chen Gang Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hello, On Wed, Jun 05, 2013 at 09:13:01AM +0800, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..10566c8 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, doesn't checkpatch critizise the double space in the line above? > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..9e3263a 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, here is another one. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 7:19 ` Uwe Kleine-König 0 siblings, 0 replies; 35+ messages in thread From: Uwe Kleine-König @ 2013-06-05 7:19 UTC (permalink / raw) To: linux-arm-kernel Hello, On Wed, Jun 05, 2013 at 09:13:01AM +0800, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..10566c8 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, doesn't checkpatch critizise the double space in the line above? > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..9e3263a 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, here is another one. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 7:19 ` Uwe Kleine-König (?) @ 2013-06-05 11:34 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 11:34 UTC (permalink / raw) To: Uwe Kleine-König Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org On 06/05/2013 03:19 PM, Uwe � wrote: > Hello, > > On Wed, Jun 05, 2013 at 09:13:01AM +0800, Chen Gang wrote: >> >> For arm and m68k, they customize find_*_bit(), but the API is different >> with 'generic'. >> >> avr32, s390, and unicore32 also customize find_*_bit(), but the API is >> the same with 'generic', and the left architectures all use 'generic'. >> >> So need change arm and m68k related API to match the 'generic', then >> all another modules can face same public API for various architectures. >> >> Also beautify code and comments to pass "./scripts/checkpatch.pl" >> >> >> Signed-off-by: Chen Gang <gang.chen@asianux.com> >> --- >> arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- >> arch/arm/lib/findbit.S | 14 ++++++++++---- >> arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- >> 3 files changed, 42 insertions(+), 23 deletions(-) >> >> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h >> index e691ec9..10566c8 100644 >> --- a/arch/arm/include/asm/bitops.h >> +++ b/arch/arm/include/asm/bitops.h >> @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); >> /* >> * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. >> */ >> -extern int _find_first_zero_bit_le(const void * p, unsigned size); >> -extern int _find_next_zero_bit_le(const void * p, int size, int offset); >> -extern int _find_first_bit_le(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_le(const void *p, > doesn't checkpatch critizise the double space in the line above? > Thank you very much for your carefully checking (could you tell me how do you find it ?) :-) I need wait for a day at least, if no another suggestions or completions, I should send patch v3. >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_le(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_le(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> /* >> * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. >> */ >> -extern int _find_first_zero_bit_be(const void * p, unsigned size); >> -extern int _find_next_zero_bit_be(const void * p, int size, int offset); >> -extern int _find_first_bit_be(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_be(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_be(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_be(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> #ifndef CONFIG_SMP >> /* >> diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S >> index 64f6bc1..9e3263a 100644 >> --- a/arch/arm/lib/findbit.S >> +++ b/arch/arm/lib/findbit.S >> @@ -19,7 +19,8 @@ >> >> /* >> * Purpose : Find a 'zero' bit >> - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_zero_bit(const void *p, > here is another one. > Thanks. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 11:34 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 11:34 UTC (permalink / raw) To: Uwe Kleine-König Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org On 06/05/2013 03:19 PM, Uwe � wrote: > Hello, > > On Wed, Jun 05, 2013 at 09:13:01AM +0800, Chen Gang wrote: >> >> For arm and m68k, they customize find_*_bit(), but the API is different >> with 'generic'. >> >> avr32, s390, and unicore32 also customize find_*_bit(), but the API is >> the same with 'generic', and the left architectures all use 'generic'. >> >> So need change arm and m68k related API to match the 'generic', then >> all another modules can face same public API for various architectures. >> >> Also beautify code and comments to pass "./scripts/checkpatch.pl" >> >> >> Signed-off-by: Chen Gang <gang.chen@asianux.com> >> --- >> arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- >> arch/arm/lib/findbit.S | 14 ++++++++++---- >> arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- >> 3 files changed, 42 insertions(+), 23 deletions(-) >> >> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h >> index e691ec9..10566c8 100644 >> --- a/arch/arm/include/asm/bitops.h >> +++ b/arch/arm/include/asm/bitops.h >> @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); >> /* >> * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. >> */ >> -extern int _find_first_zero_bit_le(const void * p, unsigned size); >> -extern int _find_next_zero_bit_le(const void * p, int size, int offset); >> -extern int _find_first_bit_le(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_le(const void *p, > doesn't checkpatch critizise the double space in the line above? > Thank you very much for your carefully checking (could you tell me how do you find it ?) :-) I need wait for a day at least, if no another suggestions or completions, I should send patch v3. >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_le(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_le(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> /* >> * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. >> */ >> -extern int _find_first_zero_bit_be(const void * p, unsigned size); >> -extern int _find_next_zero_bit_be(const void * p, int size, int offset); >> -extern int _find_first_bit_be(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_be(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_be(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_be(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> #ifndef CONFIG_SMP >> /* >> diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S >> index 64f6bc1..9e3263a 100644 >> --- a/arch/arm/lib/findbit.S >> +++ b/arch/arm/lib/findbit.S >> @@ -19,7 +19,8 @@ >> >> /* >> * Purpose : Find a 'zero' bit >> - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_zero_bit(const void *p, > here is another one. > Thanks. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 11:34 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 11:34 UTC (permalink / raw) To: linux-arm-kernel On 06/05/2013 03:19 PM, Uwe ? wrote: > Hello, > > On Wed, Jun 05, 2013 at 09:13:01AM +0800, Chen Gang wrote: >> >> For arm and m68k, they customize find_*_bit(), but the API is different >> with 'generic'. >> >> avr32, s390, and unicore32 also customize find_*_bit(), but the API is >> the same with 'generic', and the left architectures all use 'generic'. >> >> So need change arm and m68k related API to match the 'generic', then >> all another modules can face same public API for various architectures. >> >> Also beautify code and comments to pass "./scripts/checkpatch.pl" >> >> >> Signed-off-by: Chen Gang <gang.chen@asianux.com> >> --- >> arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- >> arch/arm/lib/findbit.S | 14 ++++++++++---- >> arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- >> 3 files changed, 42 insertions(+), 23 deletions(-) >> >> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h >> index e691ec9..10566c8 100644 >> --- a/arch/arm/include/asm/bitops.h >> +++ b/arch/arm/include/asm/bitops.h >> @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); >> /* >> * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. >> */ >> -extern int _find_first_zero_bit_le(const void * p, unsigned size); >> -extern int _find_next_zero_bit_le(const void * p, int size, int offset); >> -extern int _find_first_bit_le(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_le(const void *p, > doesn't checkpatch critizise the double space in the line above? > Thank you very much for your carefully checking (could you tell me how do you find it ?) :-) I need wait for a day at least, if no another suggestions or completions, I should send patch v3. >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_le(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_le(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> /* >> * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. >> */ >> -extern int _find_first_zero_bit_be(const void * p, unsigned size); >> -extern int _find_next_zero_bit_be(const void * p, int size, int offset); >> -extern int _find_first_bit_be(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_be(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_be(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_be(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> #ifndef CONFIG_SMP >> /* >> diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S >> index 64f6bc1..9e3263a 100644 >> --- a/arch/arm/lib/findbit.S >> +++ b/arch/arm/lib/findbit.S >> @@ -19,7 +19,8 @@ >> >> /* >> * Purpose : Find a 'zero' bit >> - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_zero_bit(const void *p, > here is another one. > Thanks. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 11:34 ` Chen Gang (?) @ 2013-06-05 13:02 ` Uwe Kleine-König -1 siblings, 0 replies; 35+ messages in thread From: Uwe Kleine-König @ 2013-06-05 13:02 UTC (permalink / raw) To: Chen Gang Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hello, On Wed, Jun 05, 2013 at 07:34:50PM +0800, Chen Gang wrote: > >> +extern unsigned long _find_first_zero_bit_le(const void *p, > > doesn't checkpatch critizise the double space in the line above? > > > > Thank you very much for your carefully checking (could you tell me how > do you find it ?) :-) I have no tool for that, it just catched my eye. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 13:02 ` Uwe Kleine-König 0 siblings, 0 replies; 35+ messages in thread From: Uwe Kleine-König @ 2013-06-05 13:02 UTC (permalink / raw) To: Chen Gang Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hello, On Wed, Jun 05, 2013 at 07:34:50PM +0800, Chen Gang wrote: > >> +extern unsigned long _find_first_zero_bit_le(const void *p, > > doesn't checkpatch critizise the double space in the line above? > > > > Thank you very much for your carefully checking (could you tell me how > do you find it ?) :-) I have no tool for that, it just catched my eye. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-05 13:02 ` Uwe Kleine-König 0 siblings, 0 replies; 35+ messages in thread From: Uwe Kleine-König @ 2013-06-05 13:02 UTC (permalink / raw) To: linux-arm-kernel Hello, On Wed, Jun 05, 2013 at 07:34:50PM +0800, Chen Gang wrote: > >> +extern unsigned long _find_first_zero_bit_le(const void *p, > > doesn't checkpatch critizise the double space in the line above? > > > > Thank you very much for your carefully checking (could you tell me how > do you find it ?) :-) I have no tool for that, it just catched my eye. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 13:02 ` Uwe Kleine-König (?) (?) @ 2013-06-06 8:38 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-06 8:38 UTC (permalink / raw) To: Uwe Kleine-König Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org On 06/05/2013 09:02 PM, Uwe � wrote: >> Thank you very much for your carefully checking (could you tell me how >> > do you find it ?) :-) > I have no tool for that, it just catched my eye OK, thank again for your carefully checking. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 13:02 ` Uwe Kleine-König (?) @ 2013-06-06 8:38 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-06 8:38 UTC (permalink / raw) To: Uwe Kleine-König Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org On 06/05/2013 09:02 PM, Uwe � wrote: >> Thank you very much for your carefully checking (could you tell me how >> > do you find it ?) :-) > I have no tool for that, it just catched my eye OK, thank again for your carefully checking. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-06 8:38 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-06 8:38 UTC (permalink / raw) To: Uwe Kleine-König Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org On 06/05/2013 09:02 PM, Uwe � wrote: >> Thank you very much for your carefully checking (could you tell me how >> > do you find it ?) :-) > I have no tool for that, it just catched my eye OK, thank again for your carefully checking. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-06 8:38 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-06 8:38 UTC (permalink / raw) To: linux-arm-kernel On 06/05/2013 09:02 PM, Uwe ? wrote: >> Thank you very much for your carefully checking (could you tell me how >> > do you find it ?) :-) > I have no tool for that, it just catched my eye OK, thank again for your carefully checking. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 11:34 ` Chen Gang ` (2 preceding siblings ...) (?) @ 2013-06-05 13:02 ` Uwe Kleine-König -1 siblings, 0 replies; 35+ messages in thread From: Uwe Kleine-König @ 2013-06-05 13:02 UTC (permalink / raw) To: Chen Gang Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hello, On Wed, Jun 05, 2013 at 07:34:50PM +0800, Chen Gang wrote: > >> +extern unsigned long _find_first_zero_bit_le(const void *p, > > doesn't checkpatch critizise the double space in the line above? > > > > Thank you very much for your carefully checking (could you tell me how > do you find it ?) :-) I have no tool for that, it just catched my eye. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 11:34 ` Chen Gang (?) @ 2013-06-06 9:37 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-06 9:37 UTC (permalink / raw) To: Uwe Kleine-König, Russell King - ARM Linux, Geert Uytterhoeven Cc: Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..83e4d3a 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..817dd70 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-06 9:37 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-06 9:37 UTC (permalink / raw) To: Uwe Kleine-König, Russell King - ARM Linux, Geert Uytterhoeven Cc: Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..83e4d3a 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..817dd70 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-06 9:37 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-06 9:37 UTC (permalink / raw) To: linux-arm-kernel For arm and m68k, they customize find_*_bit(), but the API is different with 'generic'. avr32, s390, and unicore32 also customize find_*_bit(), but the API is the same with 'generic', and the left architectures all use 'generic'. So need change arm and m68k related API to match the 'generic', then all another modules can face same public API for various architectures. Also beautify code and comments to pass "./scripts/checkpatch.pl" Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- arch/arm/lib/findbit.S | 14 ++++++++++---- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e691ec9..83e4d3a 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); -extern int _find_first_bit_le(const unsigned long *p, unsigned size); -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_le(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_le(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_le(const unsigned long *p, + unsigned long size, + unsigned long offset); /* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern int _find_first_zero_bit_be(const void * p, unsigned size); -extern int _find_next_zero_bit_be(const void * p, int size, int offset); -extern int _find_first_bit_be(const unsigned long *p, unsigned size); -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); +extern unsigned long _find_first_zero_bit_be(const void *p, + unsigned long size); +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, + unsigned long offset); +extern unsigned long _find_first_bit_be(const unsigned long *p, + unsigned long size); +extern unsigned long _find_next_bit_be(const unsigned long *p, + unsigned long size, + unsigned long offset); #ifndef CONFIG_SMP /* diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 64f6bc1..817dd70 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -19,7 +19,8 @@ /* * Purpose : Find a 'zero' bit - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_zero_bit(const void *p, + * unsigned long size); */ ENTRY(_find_first_zero_bit_le) teq r1, #0 @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) /* * Purpose : Find next 'zero' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_zero_bit(const void *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_zero_bit_le) teq r1, #0 @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) /* * Purpose : Find a 'one' bit - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); + * Prototype: unsigned long find_first_bit(const unsigned long *p, + * unsigned long size); */ ENTRY(_find_first_bit_le) teq r1, #0 @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) /* * Purpose : Find next 'one' bit - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) + * Prototype: unsigned long find_next_bit(const unsigned long *p, + * unsigned long size, + * unsigned long offset); */ ENTRY(_find_next_bit_le) teq r1, #0 diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index c6baa91..b1d8752 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, #include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit(const unsigned long *vaddr, - unsigned size) +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -346,11 +346,12 @@ out: } #define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, } #define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) +static inline unsigned long find_first_bit(const unsigned long *vaddr, + unsigned long size) { const unsigned long *p = vaddr; - int res = 32; + unsigned int res = 32; unsigned int words; unsigned long num; @@ -401,11 +403,12 @@ out: } #define find_first_bit find_first_bit -static inline int find_next_bit(const unsigned long *vaddr, int size, - int offset) +static inline unsigned long find_next_bit(const unsigned long *vaddr, + unsigned long size, + unsigned long offset) { const unsigned long *p = vaddr + (offset >> 5); - int bit = offset & 31UL, res; + unsigned int bit = offset & 31UL, res; if (offset >= size) return size; -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-06 9:37 ` Chen Gang (?) (?) @ 2013-06-18 3:33 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-18 3:33 UTC (permalink / raw) To: Uwe Kleine-König, Russell King - ARM Linux, Geert Uytterhoeven Cc: Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hello related Maintainers: Please help check this patch when you have time. Thanks. On 06/06/2013 05:37 PM, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..83e4d3a 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..817dd70 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, > + * unsigned long size); > */ > ENTRY(_find_first_zero_bit_le) > teq r1, #0 > @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) > > /* > * Purpose : Find next 'zero' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) > + * Prototype: unsigned long find_next_zero_bit(const void *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_zero_bit_le) > teq r1, #0 > @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) > > /* > * Purpose : Find a 'one' bit > - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_bit(const unsigned long *p, > + * unsigned long size); > */ > ENTRY(_find_first_bit_le) > teq r1, #0 > @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) > > /* > * Purpose : Find next 'one' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) > + * Prototype: unsigned long find_next_bit(const unsigned long *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_bit_le) > teq r1, #0 > diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h > index c6baa91..b1d8752 100644 > --- a/arch/m68k/include/asm/bitops.h > +++ b/arch/m68k/include/asm/bitops.h > @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, > #include <asm-generic/bitops/ffz.h> > #else > > -static inline int find_first_zero_bit(const unsigned long *vaddr, > - unsigned size) > +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -346,11 +346,12 @@ out: > } > #define find_first_zero_bit find_first_zero_bit > > -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > } > #define find_next_zero_bit find_next_zero_bit > > -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) > +static inline unsigned long find_first_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -401,11 +403,12 @@ out: > } > #define find_first_bit find_first_bit > > -static inline int find_next_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-06 9:37 ` Chen Gang (?) @ 2013-06-18 3:33 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-18 3:33 UTC (permalink / raw) To: Uwe Kleine-König, Russell King - ARM Linux, Geert Uytterhoeven Cc: Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hello related Maintainers: Please help check this patch when you have time. Thanks. On 06/06/2013 05:37 PM, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..83e4d3a 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..817dd70 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, > + * unsigned long size); > */ > ENTRY(_find_first_zero_bit_le) > teq r1, #0 > @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) > > /* > * Purpose : Find next 'zero' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) > + * Prototype: unsigned long find_next_zero_bit(const void *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_zero_bit_le) > teq r1, #0 > @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) > > /* > * Purpose : Find a 'one' bit > - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_bit(const unsigned long *p, > + * unsigned long size); > */ > ENTRY(_find_first_bit_le) > teq r1, #0 > @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) > > /* > * Purpose : Find next 'one' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) > + * Prototype: unsigned long find_next_bit(const unsigned long *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_bit_le) > teq r1, #0 > diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h > index c6baa91..b1d8752 100644 > --- a/arch/m68k/include/asm/bitops.h > +++ b/arch/m68k/include/asm/bitops.h > @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, > #include <asm-generic/bitops/ffz.h> > #else > > -static inline int find_first_zero_bit(const unsigned long *vaddr, > - unsigned size) > +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -346,11 +346,12 @@ out: > } > #define find_first_zero_bit find_first_zero_bit > > -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > } > #define find_next_zero_bit find_next_zero_bit > > -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) > +static inline unsigned long find_first_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -401,11 +403,12 @@ out: > } > #define find_first_bit find_first_bit > > -static inline int find_next_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-18 3:33 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-18 3:33 UTC (permalink / raw) To: Uwe Kleine-König, Russell King - ARM Linux, Geert Uytterhoeven Cc: Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hello related Maintainers: Please help check this patch when you have time. Thanks. On 06/06/2013 05:37 PM, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..83e4d3a 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..817dd70 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, > + * unsigned long size); > */ > ENTRY(_find_first_zero_bit_le) > teq r1, #0 > @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) > > /* > * Purpose : Find next 'zero' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) > + * Prototype: unsigned long find_next_zero_bit(const void *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_zero_bit_le) > teq r1, #0 > @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) > > /* > * Purpose : Find a 'one' bit > - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_bit(const unsigned long *p, > + * unsigned long size); > */ > ENTRY(_find_first_bit_le) > teq r1, #0 > @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) > > /* > * Purpose : Find next 'one' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) > + * Prototype: unsigned long find_next_bit(const unsigned long *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_bit_le) > teq r1, #0 > diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h > index c6baa91..b1d8752 100644 > --- a/arch/m68k/include/asm/bitops.h > +++ b/arch/m68k/include/asm/bitops.h > @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, > #include <asm-generic/bitops/ffz.h> > #else > > -static inline int find_first_zero_bit(const unsigned long *vaddr, > - unsigned size) > +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -346,11 +346,12 @@ out: > } > #define find_first_zero_bit find_first_zero_bit > > -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > } > #define find_next_zero_bit find_next_zero_bit > > -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) > +static inline unsigned long find_first_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -401,11 +403,12 @@ out: > } > #define find_first_bit find_first_bit > > -static inline int find_next_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-06-18 3:33 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-18 3:33 UTC (permalink / raw) To: linux-arm-kernel Hello related Maintainers: Please help check this patch when you have time. Thanks. On 06/06/2013 05:37 PM, Chen Gang wrote: > > For arm and m68k, they customize find_*_bit(), but the API is different > with 'generic'. > > avr32, s390, and unicore32 also customize find_*_bit(), but the API is > the same with 'generic', and the left architectures all use 'generic'. > > So need change arm and m68k related API to match the 'generic', then > all another modules can face same public API for various architectures. > > Also beautify code and comments to pass "./scripts/checkpatch.pl" > > > Signed-off-by: Chen Gang <gang.chen@asianux.com> > --- > arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- > arch/arm/lib/findbit.S | 14 ++++++++++---- > arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- > 3 files changed, 42 insertions(+), 23 deletions(-) > > diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h > index e691ec9..83e4d3a 100644 > --- a/arch/arm/include/asm/bitops.h > +++ b/arch/arm/include/asm/bitops.h > @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); > /* > * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. > */ > -extern int _find_first_zero_bit_le(const void * p, unsigned size); > -extern int _find_next_zero_bit_le(const void * p, int size, int offset); > -extern int _find_first_bit_le(const unsigned long *p, unsigned size); > -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_le(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_le(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_le(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > /* > * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. > */ > -extern int _find_first_zero_bit_be(const void * p, unsigned size); > -extern int _find_next_zero_bit_be(const void * p, int size, int offset); > -extern int _find_first_bit_be(const unsigned long *p, unsigned size); > -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); > +extern unsigned long _find_first_zero_bit_be(const void *p, > + unsigned long size); > +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, > + unsigned long offset); > +extern unsigned long _find_first_bit_be(const unsigned long *p, > + unsigned long size); > +extern unsigned long _find_next_bit_be(const unsigned long *p, > + unsigned long size, > + unsigned long offset); > > #ifndef CONFIG_SMP > /* > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > index 64f6bc1..817dd70 100644 > --- a/arch/arm/lib/findbit.S > +++ b/arch/arm/lib/findbit.S > @@ -19,7 +19,8 @@ > > /* > * Purpose : Find a 'zero' bit > - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_zero_bit(const void *p, > + * unsigned long size); > */ > ENTRY(_find_first_zero_bit_le) > teq r1, #0 > @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) > > /* > * Purpose : Find next 'zero' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) > + * Prototype: unsigned long find_next_zero_bit(const void *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_zero_bit_le) > teq r1, #0 > @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) > > /* > * Purpose : Find a 'one' bit > - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); > + * Prototype: unsigned long find_first_bit(const unsigned long *p, > + * unsigned long size); > */ > ENTRY(_find_first_bit_le) > teq r1, #0 > @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) > > /* > * Purpose : Find next 'one' bit > - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) > + * Prototype: unsigned long find_next_bit(const unsigned long *p, > + * unsigned long size, > + * unsigned long offset); > */ > ENTRY(_find_next_bit_le) > teq r1, #0 > diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h > index c6baa91..b1d8752 100644 > --- a/arch/m68k/include/asm/bitops.h > +++ b/arch/m68k/include/asm/bitops.h > @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, > #include <asm-generic/bitops/ffz.h> > #else > > -static inline int find_first_zero_bit(const unsigned long *vaddr, > - unsigned size) > +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -346,11 +346,12 @@ out: > } > #define find_first_zero_bit find_first_zero_bit > > -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, > } > #define find_next_zero_bit find_next_zero_bit > > -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) > +static inline unsigned long find_first_bit(const unsigned long *vaddr, > + unsigned long size) > { > const unsigned long *p = vaddr; > - int res = 32; > + unsigned int res = 32; > unsigned int words; > unsigned long num; > > @@ -401,11 +403,12 @@ out: > } > #define find_first_bit find_first_bit > > -static inline int find_next_bit(const unsigned long *vaddr, int size, > - int offset) > +static inline unsigned long find_next_bit(const unsigned long *vaddr, > + unsigned long size, > + unsigned long offset) > { > const unsigned long *p = vaddr + (offset >> 5); > - int bit = offset & 31UL, res; > + unsigned int bit = offset & 31UL, res; > > if (offset >= size) > return size; > -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-18 3:33 ` Chen Gang (?) @ 2013-07-05 1:09 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-07-05 1:09 UTC (permalink / raw) To: Uwe Kleine-König, Russell King - ARM Linux, Geert Uytterhoeven Cc: Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Greg KH Hello Maintainers: Please help check this patch whether OK, when you have time. Thanks. On 06/18/2013 11:33 AM, Chen Gang wrote: > Hello related Maintainers: > > Please help check this patch when you have time. > > Thanks. > > On 06/06/2013 05:37 PM, Chen Gang wrote: >> >> For arm and m68k, they customize find_*_bit(), but the API is different >> with 'generic'. >> >> avr32, s390, and unicore32 also customize find_*_bit(), but the API is >> the same with 'generic', and the left architectures all use 'generic'. >> >> So need change arm and m68k related API to match the 'generic', then >> all another modules can face same public API for various architectures. >> >> Also beautify code and comments to pass "./scripts/checkpatch.pl" >> >> >> Signed-off-by: Chen Gang <gang.chen@asianux.com> >> --- >> arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- >> arch/arm/lib/findbit.S | 14 ++++++++++---- >> arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- >> 3 files changed, 42 insertions(+), 23 deletions(-) >> >> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h >> index e691ec9..83e4d3a 100644 >> --- a/arch/arm/include/asm/bitops.h >> +++ b/arch/arm/include/asm/bitops.h >> @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); >> /* >> * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. >> */ >> -extern int _find_first_zero_bit_le(const void * p, unsigned size); >> -extern int _find_next_zero_bit_le(const void * p, int size, int offset); >> -extern int _find_first_bit_le(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_le(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_le(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_le(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> /* >> * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. >> */ >> -extern int _find_first_zero_bit_be(const void * p, unsigned size); >> -extern int _find_next_zero_bit_be(const void * p, int size, int offset); >> -extern int _find_first_bit_be(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_be(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_be(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_be(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> #ifndef CONFIG_SMP >> /* >> diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S >> index 64f6bc1..817dd70 100644 >> --- a/arch/arm/lib/findbit.S >> +++ b/arch/arm/lib/findbit.S >> @@ -19,7 +19,8 @@ >> >> /* >> * Purpose : Find a 'zero' bit >> - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_zero_bit(const void *p, >> + * unsigned long size); >> */ >> ENTRY(_find_first_zero_bit_le) >> teq r1, #0 >> @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) >> >> /* >> * Purpose : Find next 'zero' bit >> - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) >> + * Prototype: unsigned long find_next_zero_bit(const void *p, >> + * unsigned long size, >> + * unsigned long offset); >> */ >> ENTRY(_find_next_zero_bit_le) >> teq r1, #0 >> @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) >> >> /* >> * Purpose : Find a 'one' bit >> - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_bit(const unsigned long *p, >> + * unsigned long size); >> */ >> ENTRY(_find_first_bit_le) >> teq r1, #0 >> @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) >> >> /* >> * Purpose : Find next 'one' bit >> - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) >> + * Prototype: unsigned long find_next_bit(const unsigned long *p, >> + * unsigned long size, >> + * unsigned long offset); >> */ >> ENTRY(_find_next_bit_le) >> teq r1, #0 >> diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h >> index c6baa91..b1d8752 100644 >> --- a/arch/m68k/include/asm/bitops.h >> +++ b/arch/m68k/include/asm/bitops.h >> @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, >> #include <asm-generic/bitops/ffz.h> >> #else >> >> -static inline int find_first_zero_bit(const unsigned long *vaddr, >> - unsigned size) >> +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, >> + unsigned long size) >> { >> const unsigned long *p = vaddr; >> - int res = 32; >> + unsigned int res = 32; >> unsigned int words; >> unsigned long num; >> >> @@ -346,11 +346,12 @@ out: >> } >> #define find_first_zero_bit find_first_zero_bit >> >> -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, >> - int offset) >> +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, >> + unsigned long size, >> + unsigned long offset) >> { >> const unsigned long *p = vaddr + (offset >> 5); >> - int bit = offset & 31UL, res; >> + unsigned int bit = offset & 31UL, res; >> >> if (offset >= size) >> return size; >> @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, >> } >> #define find_next_zero_bit find_next_zero_bit >> >> -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) >> +static inline unsigned long find_first_bit(const unsigned long *vaddr, >> + unsigned long size) >> { >> const unsigned long *p = vaddr; >> - int res = 32; >> + unsigned int res = 32; >> unsigned int words; >> unsigned long num; >> >> @@ -401,11 +403,12 @@ out: >> } >> #define find_first_bit find_first_bit >> >> -static inline int find_next_bit(const unsigned long *vaddr, int size, >> - int offset) >> +static inline unsigned long find_next_bit(const unsigned long *vaddr, >> + unsigned long size, >> + unsigned long offset) >> { >> const unsigned long *p = vaddr + (offset >> 5); >> - int bit = offset & 31UL, res; >> + unsigned int bit = offset & 31UL, res; >> >> if (offset >= size) >> return size; >> > > -- Chen Gang ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-07-05 1:09 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-07-05 1:09 UTC (permalink / raw) To: Uwe Kleine-König, Russell King - ARM Linux, Geert Uytterhoeven Cc: Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Greg KH Hello Maintainers: Please help check this patch whether OK, when you have time. Thanks. On 06/18/2013 11:33 AM, Chen Gang wrote: > Hello related Maintainers: > > Please help check this patch when you have time. > > Thanks. > > On 06/06/2013 05:37 PM, Chen Gang wrote: >> >> For arm and m68k, they customize find_*_bit(), but the API is different >> with 'generic'. >> >> avr32, s390, and unicore32 also customize find_*_bit(), but the API is >> the same with 'generic', and the left architectures all use 'generic'. >> >> So need change arm and m68k related API to match the 'generic', then >> all another modules can face same public API for various architectures. >> >> Also beautify code and comments to pass "./scripts/checkpatch.pl" >> >> >> Signed-off-by: Chen Gang <gang.chen@asianux.com> >> --- >> arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- >> arch/arm/lib/findbit.S | 14 ++++++++++---- >> arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- >> 3 files changed, 42 insertions(+), 23 deletions(-) >> >> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h >> index e691ec9..83e4d3a 100644 >> --- a/arch/arm/include/asm/bitops.h >> +++ b/arch/arm/include/asm/bitops.h >> @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); >> /* >> * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. >> */ >> -extern int _find_first_zero_bit_le(const void * p, unsigned size); >> -extern int _find_next_zero_bit_le(const void * p, int size, int offset); >> -extern int _find_first_bit_le(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_le(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_le(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_le(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> /* >> * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. >> */ >> -extern int _find_first_zero_bit_be(const void * p, unsigned size); >> -extern int _find_next_zero_bit_be(const void * p, int size, int offset); >> -extern int _find_first_bit_be(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_be(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_be(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_be(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> #ifndef CONFIG_SMP >> /* >> diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S >> index 64f6bc1..817dd70 100644 >> --- a/arch/arm/lib/findbit.S >> +++ b/arch/arm/lib/findbit.S >> @@ -19,7 +19,8 @@ >> >> /* >> * Purpose : Find a 'zero' bit >> - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_zero_bit(const void *p, >> + * unsigned long size); >> */ >> ENTRY(_find_first_zero_bit_le) >> teq r1, #0 >> @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) >> >> /* >> * Purpose : Find next 'zero' bit >> - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) >> + * Prototype: unsigned long find_next_zero_bit(const void *p, >> + * unsigned long size, >> + * unsigned long offset); >> */ >> ENTRY(_find_next_zero_bit_le) >> teq r1, #0 >> @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) >> >> /* >> * Purpose : Find a 'one' bit >> - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_bit(const unsigned long *p, >> + * unsigned long size); >> */ >> ENTRY(_find_first_bit_le) >> teq r1, #0 >> @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) >> >> /* >> * Purpose : Find next 'one' bit >> - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) >> + * Prototype: unsigned long find_next_bit(const unsigned long *p, >> + * unsigned long size, >> + * unsigned long offset); >> */ >> ENTRY(_find_next_bit_le) >> teq r1, #0 >> diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h >> index c6baa91..b1d8752 100644 >> --- a/arch/m68k/include/asm/bitops.h >> +++ b/arch/m68k/include/asm/bitops.h >> @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, >> #include <asm-generic/bitops/ffz.h> >> #else >> >> -static inline int find_first_zero_bit(const unsigned long *vaddr, >> - unsigned size) >> +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, >> + unsigned long size) >> { >> const unsigned long *p = vaddr; >> - int res = 32; >> + unsigned int res = 32; >> unsigned int words; >> unsigned long num; >> >> @@ -346,11 +346,12 @@ out: >> } >> #define find_first_zero_bit find_first_zero_bit >> >> -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, >> - int offset) >> +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, >> + unsigned long size, >> + unsigned long offset) >> { >> const unsigned long *p = vaddr + (offset >> 5); >> - int bit = offset & 31UL, res; >> + unsigned int bit = offset & 31UL, res; >> >> if (offset >= size) >> return size; >> @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, >> } >> #define find_next_zero_bit find_next_zero_bit >> >> -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) >> +static inline unsigned long find_first_bit(const unsigned long *vaddr, >> + unsigned long size) >> { >> const unsigned long *p = vaddr; >> - int res = 32; >> + unsigned int res = 32; >> unsigned int words; >> unsigned long num; >> >> @@ -401,11 +403,12 @@ out: >> } >> #define find_first_bit find_first_bit >> >> -static inline int find_next_bit(const unsigned long *vaddr, int size, >> - int offset) >> +static inline unsigned long find_next_bit(const unsigned long *vaddr, >> + unsigned long size, >> + unsigned long offset) >> { >> const unsigned long *p = vaddr + (offset >> 5); >> - int bit = offset & 31UL, res; >> + unsigned int bit = offset & 31UL, res; >> >> if (offset >= size) >> return size; >> > > -- Chen Gang ^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other @ 2013-07-05 1:09 ` Chen Gang 0 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-07-05 1:09 UTC (permalink / raw) To: linux-arm-kernel Hello Maintainers: Please help check this patch whether OK, when you have time. Thanks. On 06/18/2013 11:33 AM, Chen Gang wrote: > Hello related Maintainers: > > Please help check this patch when you have time. > > Thanks. > > On 06/06/2013 05:37 PM, Chen Gang wrote: >> >> For arm and m68k, they customize find_*_bit(), but the API is different >> with 'generic'. >> >> avr32, s390, and unicore32 also customize find_*_bit(), but the API is >> the same with 'generic', and the left architectures all use 'generic'. >> >> So need change arm and m68k related API to match the 'generic', then >> all another modules can face same public API for various architectures. >> >> Also beautify code and comments to pass "./scripts/checkpatch.pl" >> >> >> Signed-off-by: Chen Gang <gang.chen@asianux.com> >> --- >> arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- >> arch/arm/lib/findbit.S | 14 ++++++++++---- >> arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- >> 3 files changed, 42 insertions(+), 23 deletions(-) >> >> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h >> index e691ec9..83e4d3a 100644 >> --- a/arch/arm/include/asm/bitops.h >> +++ b/arch/arm/include/asm/bitops.h >> @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); >> /* >> * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. >> */ >> -extern int _find_first_zero_bit_le(const void * p, unsigned size); >> -extern int _find_next_zero_bit_le(const void * p, int size, int offset); >> -extern int _find_first_bit_le(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_le(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_le(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_le(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> /* >> * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. >> */ >> -extern int _find_first_zero_bit_be(const void * p, unsigned size); >> -extern int _find_next_zero_bit_be(const void * p, int size, int offset); >> -extern int _find_first_bit_be(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_be(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_be(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_be(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> #ifndef CONFIG_SMP >> /* >> diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S >> index 64f6bc1..817dd70 100644 >> --- a/arch/arm/lib/findbit.S >> +++ b/arch/arm/lib/findbit.S >> @@ -19,7 +19,8 @@ >> >> /* >> * Purpose : Find a 'zero' bit >> - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_zero_bit(const void *p, >> + * unsigned long size); >> */ >> ENTRY(_find_first_zero_bit_le) >> teq r1, #0 >> @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) >> >> /* >> * Purpose : Find next 'zero' bit >> - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) >> + * Prototype: unsigned long find_next_zero_bit(const void *p, >> + * unsigned long size, >> + * unsigned long offset); >> */ >> ENTRY(_find_next_zero_bit_le) >> teq r1, #0 >> @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) >> >> /* >> * Purpose : Find a 'one' bit >> - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_bit(const unsigned long *p, >> + * unsigned long size); >> */ >> ENTRY(_find_first_bit_le) >> teq r1, #0 >> @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) >> >> /* >> * Purpose : Find next 'one' bit >> - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) >> + * Prototype: unsigned long find_next_bit(const unsigned long *p, >> + * unsigned long size, >> + * unsigned long offset); >> */ >> ENTRY(_find_next_bit_le) >> teq r1, #0 >> diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h >> index c6baa91..b1d8752 100644 >> --- a/arch/m68k/include/asm/bitops.h >> +++ b/arch/m68k/include/asm/bitops.h >> @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, >> #include <asm-generic/bitops/ffz.h> >> #else >> >> -static inline int find_first_zero_bit(const unsigned long *vaddr, >> - unsigned size) >> +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, >> + unsigned long size) >> { >> const unsigned long *p = vaddr; >> - int res = 32; >> + unsigned int res = 32; >> unsigned int words; >> unsigned long num; >> >> @@ -346,11 +346,12 @@ out: >> } >> #define find_first_zero_bit find_first_zero_bit >> >> -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, >> - int offset) >> +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, >> + unsigned long size, >> + unsigned long offset) >> { >> const unsigned long *p = vaddr + (offset >> 5); >> - int bit = offset & 31UL, res; >> + unsigned int bit = offset & 31UL, res; >> >> if (offset >= size) >> return size; >> @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, >> } >> #define find_next_zero_bit find_next_zero_bit >> >> -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) >> +static inline unsigned long find_first_bit(const unsigned long *vaddr, >> + unsigned long size) >> { >> const unsigned long *p = vaddr; >> - int res = 32; >> + unsigned int res = 32; >> unsigned int words; >> unsigned long num; >> >> @@ -401,11 +403,12 @@ out: >> } >> #define find_first_bit find_first_bit >> >> -static inline int find_next_bit(const unsigned long *vaddr, int size, >> - int offset) >> +static inline unsigned long find_next_bit(const unsigned long *vaddr, >> + unsigned long size, >> + unsigned long offset) >> { >> const unsigned long *p = vaddr + (offset >> 5); >> - int bit = offset & 31UL, res; >> + unsigned int bit = offset & 31UL, res; >> >> if (offset >= size) >> return size; >> > > -- Chen Gang ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v3] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-18 3:33 ` Chen Gang ` (2 preceding siblings ...) (?) @ 2013-07-05 1:09 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-07-05 1:09 UTC (permalink / raw) To: Uwe Kleine-König, Russell King - ARM Linux, Geert Uytterhoeven Cc: Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Greg KH Hello Maintainers: Please help check this patch whether OK, when you have time. Thanks. On 06/18/2013 11:33 AM, Chen Gang wrote: > Hello related Maintainers: > > Please help check this patch when you have time. > > Thanks. > > On 06/06/2013 05:37 PM, Chen Gang wrote: >> >> For arm and m68k, they customize find_*_bit(), but the API is different >> with 'generic'. >> >> avr32, s390, and unicore32 also customize find_*_bit(), but the API is >> the same with 'generic', and the left architectures all use 'generic'. >> >> So need change arm and m68k related API to match the 'generic', then >> all another modules can face same public API for various architectures. >> >> Also beautify code and comments to pass "./scripts/checkpatch.pl" >> >> >> Signed-off-by: Chen Gang <gang.chen@asianux.com> >> --- >> arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- >> arch/arm/lib/findbit.S | 14 ++++++++++---- >> arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- >> 3 files changed, 42 insertions(+), 23 deletions(-) >> >> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h >> index e691ec9..83e4d3a 100644 >> --- a/arch/arm/include/asm/bitops.h >> +++ b/arch/arm/include/asm/bitops.h >> @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); >> /* >> * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. >> */ >> -extern int _find_first_zero_bit_le(const void * p, unsigned size); >> -extern int _find_next_zero_bit_le(const void * p, int size, int offset); >> -extern int _find_first_bit_le(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_le(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_le(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_le(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> /* >> * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. >> */ >> -extern int _find_first_zero_bit_be(const void * p, unsigned size); >> -extern int _find_next_zero_bit_be(const void * p, int size, int offset); >> -extern int _find_first_bit_be(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_be(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_be(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_be(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> #ifndef CONFIG_SMP >> /* >> diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S >> index 64f6bc1..817dd70 100644 >> --- a/arch/arm/lib/findbit.S >> +++ b/arch/arm/lib/findbit.S >> @@ -19,7 +19,8 @@ >> >> /* >> * Purpose : Find a 'zero' bit >> - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_zero_bit(const void *p, >> + * unsigned long size); >> */ >> ENTRY(_find_first_zero_bit_le) >> teq r1, #0 >> @@ -40,7 +41,9 @@ ENDPROC(_find_first_zero_bit_le) >> >> /* >> * Purpose : Find next 'zero' bit >> - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) >> + * Prototype: unsigned long find_next_zero_bit(const void *p, >> + * unsigned long size, >> + * unsigned long offset); >> */ >> ENTRY(_find_next_zero_bit_le) >> teq r1, #0 >> @@ -60,7 +63,8 @@ ENDPROC(_find_next_zero_bit_le) >> >> /* >> * Purpose : Find a 'one' bit >> - * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_bit(const unsigned long *p, >> + * unsigned long size); >> */ >> ENTRY(_find_first_bit_le) >> teq r1, #0 >> @@ -81,7 +85,9 @@ ENDPROC(_find_first_bit_le) >> >> /* >> * Purpose : Find next 'one' bit >> - * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) >> + * Prototype: unsigned long find_next_bit(const unsigned long *p, >> + * unsigned long size, >> + * unsigned long offset); >> */ >> ENTRY(_find_next_bit_le) >> teq r1, #0 >> diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h >> index c6baa91..b1d8752 100644 >> --- a/arch/m68k/include/asm/bitops.h >> +++ b/arch/m68k/include/asm/bitops.h >> @@ -320,11 +320,11 @@ static inline int bfchg_mem_test_and_change_bit(int nr, >> #include <asm-generic/bitops/ffz.h> >> #else >> >> -static inline int find_first_zero_bit(const unsigned long *vaddr, >> - unsigned size) >> +static inline unsigned long find_first_zero_bit(const unsigned long *vaddr, >> + unsigned long size) >> { >> const unsigned long *p = vaddr; >> - int res = 32; >> + unsigned int res = 32; >> unsigned int words; >> unsigned long num; >> >> @@ -346,11 +346,12 @@ out: >> } >> #define find_first_zero_bit find_first_zero_bit >> >> -static inline int find_next_zero_bit(const unsigned long *vaddr, int size, >> - int offset) >> +static inline unsigned long find_next_zero_bit(const unsigned long *vaddr, >> + unsigned long size, >> + unsigned long offset) >> { >> const unsigned long *p = vaddr + (offset >> 5); >> - int bit = offset & 31UL, res; >> + unsigned int bit = offset & 31UL, res; >> >> if (offset >= size) >> return size; >> @@ -376,10 +377,11 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, >> } >> #define find_next_zero_bit find_next_zero_bit >> >> -static inline int find_first_bit(const unsigned long *vaddr, unsigned size) >> +static inline unsigned long find_first_bit(const unsigned long *vaddr, >> + unsigned long size) >> { >> const unsigned long *p = vaddr; >> - int res = 32; >> + unsigned int res = 32; >> unsigned int words; >> unsigned long num; >> >> @@ -401,11 +403,12 @@ out: >> } >> #define find_first_bit find_first_bit >> >> -static inline int find_next_bit(const unsigned long *vaddr, int size, >> - int offset) >> +static inline unsigned long find_next_bit(const unsigned long *vaddr, >> + unsigned long size, >> + unsigned long offset) >> { >> const unsigned long *p = vaddr + (offset >> 5); >> - int bit = offset & 31UL, res; >> + unsigned int bit = offset & 31UL, res; >> >> if (offset >= size) >> return size; >> > > -- Chen Gang ^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other 2013-06-05 7:19 ` Uwe Kleine-König ` (2 preceding siblings ...) (?) @ 2013-06-05 11:34 ` Chen Gang -1 siblings, 0 replies; 35+ messages in thread From: Chen Gang @ 2013-06-05 11:34 UTC (permalink / raw) To: Uwe Kleine-König Cc: Russell King - ARM Linux, Geert Uytterhoeven, Linux-Arch, linux-m68k, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org On 06/05/2013 03:19 PM, Uwe � wrote: > Hello, > > On Wed, Jun 05, 2013 at 09:13:01AM +0800, Chen Gang wrote: >> >> For arm and m68k, they customize find_*_bit(), but the API is different >> with 'generic'. >> >> avr32, s390, and unicore32 also customize find_*_bit(), but the API is >> the same with 'generic', and the left architectures all use 'generic'. >> >> So need change arm and m68k related API to match the 'generic', then >> all another modules can face same public API for various architectures. >> >> Also beautify code and comments to pass "./scripts/checkpatch.pl" >> >> >> Signed-off-by: Chen Gang <gang.chen@asianux.com> >> --- >> arch/arm/include/asm/bitops.h | 26 ++++++++++++++++++-------- >> arch/arm/lib/findbit.S | 14 ++++++++++---- >> arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- >> 3 files changed, 42 insertions(+), 23 deletions(-) >> >> diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h >> index e691ec9..10566c8 100644 >> --- a/arch/arm/include/asm/bitops.h >> +++ b/arch/arm/include/asm/bitops.h >> @@ -161,18 +161,28 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); >> /* >> * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. >> */ >> -extern int _find_first_zero_bit_le(const void * p, unsigned size); >> -extern int _find_next_zero_bit_le(const void * p, int size, int offset); >> -extern int _find_first_bit_le(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_le(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_le(const void *p, > doesn't checkpatch critizise the double space in the line above? > Thank you very much for your carefully checking (could you tell me how do you find it ?) :-) I need wait for a day at least, if no another suggestions or completions, I should send patch v3. >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_le(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_le(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_le(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> /* >> * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. >> */ >> -extern int _find_first_zero_bit_be(const void * p, unsigned size); >> -extern int _find_next_zero_bit_be(const void * p, int size, int offset); >> -extern int _find_first_bit_be(const unsigned long *p, unsigned size); >> -extern int _find_next_bit_be(const unsigned long *p, int size, int offset); >> +extern unsigned long _find_first_zero_bit_be(const void *p, >> + unsigned long size); >> +extern unsigned long _find_next_zero_bit_be(const void *p, unsigned long size, >> + unsigned long offset); >> +extern unsigned long _find_first_bit_be(const unsigned long *p, >> + unsigned long size); >> +extern unsigned long _find_next_bit_be(const unsigned long *p, >> + unsigned long size, >> + unsigned long offset); >> >> #ifndef CONFIG_SMP >> /* >> diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S >> index 64f6bc1..9e3263a 100644 >> --- a/arch/arm/lib/findbit.S >> +++ b/arch/arm/lib/findbit.S >> @@ -19,7 +19,8 @@ >> >> /* >> * Purpose : Find a 'zero' bit >> - * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); >> + * Prototype: unsigned long find_first_zero_bit(const void *p, > here is another one. > Thanks. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 35+ messages in thread
end of thread, other threads:[~2013-07-05 1:10 UTC | newest] Thread overview: 35+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-06-05 1:10 [PATCH] arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other Chen Gang 2013-06-05 1:10 ` Chen Gang 2013-06-05 1:10 ` Chen Gang 2013-06-05 1:11 ` Chen Gang 2013-06-05 1:11 ` Chen Gang 2013-06-05 1:11 ` Chen Gang 2013-06-05 1:13 ` [PATCH v2] " Chen Gang 2013-06-05 1:13 ` Chen Gang 2013-06-05 1:13 ` Chen Gang 2013-06-05 7:19 ` Uwe Kleine-König 2013-06-05 7:19 ` Uwe Kleine-König 2013-06-05 7:19 ` Uwe Kleine-König 2013-06-05 11:34 ` Chen Gang 2013-06-05 11:34 ` Chen Gang 2013-06-05 11:34 ` Chen Gang 2013-06-05 13:02 ` Uwe Kleine-König 2013-06-05 13:02 ` Uwe Kleine-König 2013-06-05 13:02 ` Uwe Kleine-König 2013-06-06 8:38 ` Chen Gang 2013-06-06 8:38 ` Chen Gang 2013-06-06 8:38 ` Chen Gang 2013-06-06 8:38 ` Chen Gang 2013-06-05 13:02 ` Uwe Kleine-König 2013-06-06 9:37 ` [PATCH v3] " Chen Gang 2013-06-06 9:37 ` Chen Gang 2013-06-06 9:37 ` Chen Gang 2013-06-18 3:33 ` Chen Gang 2013-06-18 3:33 ` Chen Gang 2013-06-18 3:33 ` Chen Gang 2013-06-18 3:33 ` Chen Gang 2013-07-05 1:09 ` Chen Gang 2013-07-05 1:09 ` Chen Gang 2013-07-05 1:09 ` Chen Gang 2013-07-05 1:09 ` Chen Gang 2013-06-05 11:34 ` [PATCH v2] " Chen Gang
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.