Skip to contentSkip to conversation

bitops: Change the bitmap index from int to unsigned long [frv]

PATCH Superseded Justin Chen 3 participants 8 messages Feb 25, 2009 – Feb 26, 2009 Generic include/asm header files

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 14/15 bitops: Change the bitmap index from int to unsigned long [frv]

Change the index to unsigned long in all bitops for [frv]

---
 include/asm-frv/bitops.h |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
include/asm-frv/bitops.h +15 -14
diff -Nru a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
@@ -112,7 +112,7 @@
 #define atomic_clear_mask(mask, v)	atomic_test_and_ANDNOT_mask((mask), (v))
 #define atomic_set_mask(mask, v)	atomic_test_and_OR_mask((mask), (v))
 
-static inline int test_and_clear_bit(int nr, volatile void *addr)
+static inline int test_and_clear_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *ptr = addr;
 	unsigned long mask = 1UL << (nr & 31);
@@ -120,7 +120,7 @@
 	return (atomic_test_and_ANDNOT_mask(mask, ptr) & mask) != 0;
 }
 
-static inline int test_and_set_bit(int nr, volatile void *addr)
+static inline int test_and_set_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *ptr = addr;
 	unsigned long mask = 1UL << (nr & 31);
@@ -128,7 +128,7 @@
 	return (atomic_test_and_OR_mask(mask, ptr) & mask) != 0;
 }
 
-static inline int test_and_change_bit(int nr, volatile void *addr)
+static inline int test_and_change_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *ptr = addr;
 	unsigned long mask = 1UL << (nr & 31);
@@ -136,22 +136,22 @@
 	return (atomic_test_and_XOR_mask(mask, ptr) & mask) != 0;
 }
 
-static inline void clear_bit(int nr, volatile void *addr)
+static inline void clear_bit(unsigned long nr, volatile void *addr)
 {
 	test_and_clear_bit(nr, addr);
 }
 
-static inline void set_bit(int nr, volatile void *addr)
+static inline void set_bit(unsigned long nr, volatile void *addr)
 {
 	test_and_set_bit(nr, addr);
 }
 
-static inline void change_bit(int nr, volatile void * addr)
+static inline void change_bit(unsigned long nr, volatile void *addr)
 {
 	test_and_change_bit(nr, addr);
 }
 
-static inline void __clear_bit(int nr, volatile void * addr)
+static inline void __clear_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *a = addr;
 	int mask;
@@ -161,7 +161,7 @@
 	*a &= ~mask;
 }
 
-static inline void __set_bit(int nr, volatile void * addr)
+static inline void __set_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *a = addr;
 	int mask;
@@ -171,7 +171,7 @@
 	*a |= mask;
 }
 
-static inline void __change_bit(int nr, volatile void *addr)
+static inline void __change_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *a = addr;
 	int mask;
@@ -181,7 +181,7 @@
 	*a ^= mask;
 }
 
-static inline int __test_and_clear_bit(int nr, volatile void * addr)
+static inline int __test_and_clear_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *a = addr;
 	int mask, retval;
@@ -193,7 +193,7 @@
 	return retval;
 }
 
-static inline int __test_and_set_bit(int nr, volatile void * addr)
+static inline int __test_and_set_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *a = addr;
 	int mask, retval;
@@ -205,7 +205,7 @@
 	return retval;
 }
 
-static inline int __test_and_change_bit(int nr, volatile void * addr)
+static inline int __test_and_change_bit(unsigned long nr, volatile void *addr)
 {
 	volatile unsigned long *a = addr;
 	int mask, retval;
@@ -220,12 +220,13 @@
 /*
  * This routine doesn't need to be atomic.
  */
-static inline int __constant_test_bit(int nr, const volatile void * addr)
+static inline int
+__constant_test_bit(unsigned long nr, const volatile void *addr)
 {
 	return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
 }
 
-static inline int __test_bit(int nr, const volatile void * addr)
+static inline int __test_bit(unsigned long nr, const volatile void *addr)
 {
 	int 	* a = (int *) addr;
 	int	mask;
Acked-by on v1 14/15
#1 lore raw
Quoted 4 lines · Justin Chen

Change the index to unsigned long in all bitops for [frv]

Mostly okay, apart from:

include/asm-frv/bitops.h line 224

Quoted 3 lines
include/asm-frv/bitops.h +2 -1
-static inline int __constant_test_bit(int nr, const volatile void * addr)
+static inline int
+__constant_test_bit(unsigned long nr, const volatile void *addr)

Please move the return type onto the next line also. Other than that:

#2 lore raw
Quoted 8 lines · David Howells

include/asm-frv/bitops.h line 224

Quoted 4 lines
include/asm-frv/bitops.h +2 -1
-static inline int __constant_test_bit(int nr, const volatile void * addr)
+static inline int
+__constant_test_bit(unsigned long nr, const volatile void *addr)

Please move the return type onto the next line also. Other than that:

What makes you say that, in particular? A casual grep finds no less than 3524 instances of "static inline <type>" -- presumably with a function name following -- and only 447 instances of "static inline" without a type in the kernel.

-hpa

#3 lore raw
Quoted 1 line · H. Peter Anvin

What makes you say that, in particular?

I prefer it. Actually, I'd prefer it all to be on one line, but some people get picky about the 80 char limit.

Besides, that "static inline" is merely a qualifier to the declaration of the function. The return type, name and args are part of the declaration of the function and belong together more.

Quoted 3 lines

A casual grep finds no less than 3524 instances of "static inline <type>" -- presumably with a function name following -- and only 447 instances of "static inline" without a type in the kernel.

But how does it break down between "static inline type\nfunction_name" and "static inline\ntype function_name"? That's more to the point.

David

#4 lore raw
Quoted 8 lines · David Howells
Quoted 4 lines

A casual grep finds no less than 3524 instances of "static inline <type>" -- presumably with a function name following -- and only 447 instances of "static inline" without a type in the kernel.

But how does it break down between "static inline type\nfunction_name" and "static inline\ntype function_name"? That's more to the point.

I believe that is the breakdown is roughly what you see above, i.e. over 8:1; the pattern I used was looking for "^static inline[^;(]*$", and a visual examination of the results shows that even if my line count is slighly off the lopsidedness is still dramatic.

-hpa

#7 lore raw
In reply to David Howells
Quoted 8 lines · David Howells
Quoted 4 lines

A casual grep finds no less than 3524 instances of "static inline <type>" -- presumably with a function name following -- and only 447 instances of "static inline" without a type in the kernel.

But how does it break down between "static inline type\nfunction_name" and "static inline\ntype function_name"? That's more to the point.

I believe that is the breakdown is roughly what you see above, i.e. over 8:1; the pattern I used was looking for "^static inline[^;(]*$", and a visual examination of the results shows that even if my line count is slighly off the lopsidedness is still dramatic.

-hpa

#5 lore raw
In reply to H. Peter Anvin
Quoted 8 lines · H. Peter Anvin
Quoted 3 lines

But how does it break down between "static inline type\nfunction_name" and "static inline\ntype function_name"? That's more to the point.

I believe that is the breakdown is roughly what you see above, i.e. over 8:1; the pattern I used was looking for "^static inline[^;(]*$", and a visual examination of the results shows that even if my line count is slighly off the lopsidedness is still dramatic.

Sorry, I meant:

"static inline type\nfunction_name" vs "static inline type function_name"

David

#6 lore raw
Quoted 5 lines · David Howells
Quoted 3 lines · H. Peter Anvin
Quoted 3 lines

But how does it break down between "static inline type\nfunction_name" and "static inline\ntype function_name"? That's more to the point.

Quoted 9 lines
Quoted 4 lines

I believe that is the breakdown is roughly what you see above, i.e. over 8:1; the pattern I used was looking for "^static inline[^;(]*$", and a visual examination of the results shows that even if my line count is slighly off the lopsidedness is still dramatic.

Sorry, I meant:

"static inline type\nfunction_name" vs "static inline type function_name"

Well, the latter is obviously in vast majority, but that doesn't seem to have anything to do with anything at all here...

-hpa