arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other
PATCH 1/1 arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other
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"
--- 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(-)
arch/arm/include/asm/bitops.h +0 -0
@@ -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
/*
arch/arm/lib/findbit.S +2 -2
@@ -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
arch/m68k/include/asm/bitops.h +0 -0
@@ -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;
Signature · 1 line
1.7.7.6
Oh, sorry for word wrap. I need send patch v2, I should notice it next time.
Quoted 181 lines · Chen Gang
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 <[email protected]>--- 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(-)arch/arm/include/asm/bitops.h +18
-8@@ -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
/*arch/arm/lib/findbit.S +5
-2@@ -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)arch/arm/lib/findbit.S +2
-1teq 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)arch/arm/lib/findbit.S +3
-1teq 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)arch/arm/lib/findbit.S +0
-0teq r1, #0arch/m68k/include/asm/bitops.h +14
-11@@ -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;
Signature · 3 lines
Chen Gang Asianux Corporation
PATCH v2 1/1 arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other
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"
--- 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(-)
arch/arm/include/asm/bitops.h +18 -8
@@ -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 /*
arch/arm/lib/findbit.S +10 -4
@@ -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
arch/m68k/include/asm/bitops.h +14 -11
@@ -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;
Signature · 1 line
1.7.7.6
Hello,
Quoted 25 lines · Chen Gang
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 <[email protected]>--- 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(-)arch/arm/include/asm/bitops.h +0
-0
arch/arm/include/asm/bitops.h extern int _test_and_change_bit(int nr, volatile unsigned long * p); · line 164
Quoted 8 lines
arch/arm/include/asm/bitops.h +1
-4@@ -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?
Quoted 33 lines
arch/arm/include/asm/bitops.h +17
-4+ 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 /* arch/arm/lib/findbit.S +0
-0
arch/arm/lib/findbit.S line 22
Quoted 5 lines
arch/arm/lib/findbit.S +1
-1@@ -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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 23 lines · Uwe ?
Hello,
Quoted 20 lines · Chen Gang
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 <[email protected]>--- 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(-)
Quoted 15 lines
arch/arm/include/asm/bitops.h extern int _test_and_change_bit(int nr, volatile unsigned long * p); · line 164
Quoted 13 lines
arch/arm/include/asm/bitops.h +1
-4@@ -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.
Quoted 34 lines
Quoted 34 lines
arch/arm/include/asm/bitops.h +17
-4+ 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 /* arch/arm/lib/findbit.S +0
-0@@ -19,7 +19,8 @@
Quoted 6 lines
arch/arm/lib/findbit.S line 22
Quoted 4 lines
arch/arm/lib/findbit.S +1
-1/* * 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.
Signature · 3 lines
Chen Gang Asianux Corporation
Quoted 23 lines · Uwe �
Hello,
Quoted 20 lines · Chen Gang
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 <[email protected]>--- 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(-)
Quoted 15 lines
arch/arm/include/asm/bitops.h extern int _test_and_change_bit(int nr, volatile unsigned long * p); · line 164
Quoted 13 lines
arch/arm/include/asm/bitops.h +1
-4@@ -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.
Quoted 34 lines
Quoted 34 lines
arch/arm/include/asm/bitops.h +17
-4+ 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 /* arch/arm/lib/findbit.S +0
-0@@ -19,7 +19,8 @@
Quoted 6 lines
arch/arm/lib/findbit.S line 22
Quoted 4 lines
arch/arm/lib/findbit.S +1
-1/* * 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.
Signature · 3 lines
Chen Gang Asianux Corporation
Hello,
Quoted 6 lines · Chen Gang
Quoted 3 lines
Quoted 1 line
+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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Hello,
Quoted 6 lines · Chen Gang
Quoted 3 lines
Quoted 1 line
+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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 3 lines · Uwe �
Quoted 2 lines
Thank you very much for your carefully checking (could you tell me how
Quoted 1 line
do you find it ?) :-)
I have no tool for that, it just catched my eye
OK, thank again for your carefully checking.
Signature · 3 lines
Chen Gang Asianux Corporation
Quoted 3 lines · Uwe �
Quoted 2 lines
Thank you very much for your carefully checking (could you tell me how
Quoted 1 line
do you find it ?) :-)
I have no tool for that, it just catched my eye
OK, thank again for your carefully checking.
Signature · 3 lines
Chen Gang Asianux Corporation
PATCH v3 1/1 arch/*/asm/include/bitops.h: api issue, find_*_bit() defination are different with each other
In reply to Chen GangFor 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"
--- 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(-)
arch/arm/include/asm/bitops.h +18 -8
@@ -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 /*
arch/arm/lib/findbit.S +10 -4
@@ -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
arch/m68k/include/asm/bitops.h +14 -11
@@ -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;
Signature · 1 line
1.7.7.6
Hello related Maintainers:
Please help check this patch when you have time.
Thanks.
Quoted 173 lines · Chen Gang
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 <[email protected]>--- 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(-)arch/arm/include/asm/bitops.h +18
-8@@ -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 /* arch/arm/lib/findbit.S +10
-4@@ -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, #0arch/m68k/include/asm/bitops.h +14
-11@@ -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;
Signature · 3 lines
Chen Gang Asianux Corporation
Hello related Maintainers:
Please help check this patch when you have time.
Thanks.
Quoted 173 lines · Chen Gang
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 <[email protected]>--- 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(-)arch/arm/include/asm/bitops.h +18
-8@@ -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 /* arch/arm/lib/findbit.S +10
-4@@ -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, #0arch/m68k/include/asm/bitops.h +14
-11@@ -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;
Signature · 3 lines
Chen Gang Asianux Corporation
Hello Maintainers:
Please help check this patch whether OK, when you have time.
Thanks.
Quoted 182 lines · Chen Gang
Hello related Maintainers:
Please help check this patch when you have time.
Thanks.
Quoted 173 lines · Chen Gang
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 <[email protected]>--- 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(-)arch/arm/include/asm/bitops.h +18
-8@@ -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 /* arch/arm/lib/findbit.S +10
-4@@ -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, #0arch/m68k/include/asm/bitops.h +14
-11@@ -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;
Signature · 1 line
Chen Gang
Hello Maintainers:
Please help check this patch whether OK, when you have time.
Thanks.
Quoted 182 lines · Chen Gang
Hello related Maintainers:
Please help check this patch when you have time.
Thanks.
Quoted 173 lines · Chen Gang
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 <[email protected]>--- 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(-)arch/arm/include/asm/bitops.h +18
-8@@ -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 /* arch/arm/lib/findbit.S +10
-4@@ -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, #0arch/m68k/include/asm/bitops.h +14
-11@@ -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;
Signature · 1 line
Chen Gang