From: Randy Dunlap <randy.dunlap@oracle.com>
Can we expand this macro definition, or should I look for a way to
fool^W teach kernel-doc about this?scripts/kernel-doc says:
Error(linux-2.6.24-rc1//include/asm-x86/bitops_32.h:188): cannot understand prototype: 'test_and_set_bit_lock test_and_set_bit 'Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
include/asm-x86/bitops_32.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)--- linux-2.6.24-rc1.orig/include/asm-x86/bitops_32.h
+++ linux-2.6.24-rc1/include/asm-x86/bitops_32.h
@@ -185,7 +185,7 @@ static inline int test_and_set_bit(int n
*
* This is the same as test_and_set_bit on x86
*/
-#define test_and_set_bit_lock test_and_set_bit
+#define test_and_set_bit_lock(nr, addr) test_and_set_bit(nr, addr)/**
* __test_and_set_bit - Set a bit and return its old value
---
~Randy
-
Actually, it probably looks a bit nicer like this anyway. If you grep
for it, then you can actually see the parameters...On third thoughts, an inline function might be the best thing to do,
-
---
From: Randy Dunlap <randy.dunlap@oracle.com>
Use duplicated inline functions for test_and_set_bit_lock() on x86
instead of #define macros, thus avoiding a bad example. This allows
kernel-doc to run cleanly instead of terminating with an error:Error(linux-2.6.24-rc1//include/asm-x86/bitops_32.h:188): cannot understand prototype: 'test_and_set_bit_lock test_and_set_bit '
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
include/asm-x86/bitops_32.h | 13 +++++++++++--
include/asm-x86/bitops_64.h | 13 +++++++++++--
2 files changed, 22 insertions(+), 4 deletions(-)--- linux-2.6.24-rc1.orig/include/asm-x86/bitops_32.h
+++ linux-2.6.24-rc1/include/asm-x86/bitops_32.h
@@ -183,9 +183,18 @@ static inline int test_and_set_bit(int n
* @nr: Bit to set
* @addr: Address to count from
*
- * This is the same as test_and_set_bit on x86
+ * This is the same as test_and_set_bit on x86.
*/
-#define test_and_set_bit_lock test_and_set_bit
+static inline int test_and_set_bit_lock(int nr, volatile unsigned long * addr)
+{
+ int oldbit;
+
+ __asm__ __volatile__( LOCK_PREFIX
+ "btsl %2,%1\n\tsbbl %0,%0"
+ :"=r" (oldbit),"+m" (ADDR)
+ :"Ir" (nr) : "memory");
+ return oldbit;
+}/**
* __test_and_set_bit - Set a bit and return its old value
--- linux-2.6.24-rc1.orig/include/asm-x86/bitops_64.h
+++ linux-2.6.24-rc1/include/asm-x86/bitops_64.h
@@ -173,9 +173,18 @@ static __inline__ int test_and_set_bit(i
* @nr: Bit to set
* @addr: Address to count from
*
- * This is the same as test_and_set_bit on x86
+ * This is the same as test_and_set_bit on x86.
*/
-#define test_and_set_bit_lock test_and_set_bit
+static __inline__ int test_and_set_bit_lock(int nr, volatile void * addr)
+{
+ int oldbit;
+
+ __asm__ __volatile__( LOCK_PREFIX
+ "btsl %2,%1\n\tsbbl %0,%0"
+ :"=r" (oldbit),ADDR
+ :"dIr" (nr) : "memory");
+ return oldbit;
+}/**
* __test_and_set_bit - Set a bit and return its old value
-
Hmm, can we simply do
static inline int test_and_set_bit_lock(int nr, volatile unsigned long * addr)
{
return test_and_set_bit(nr, addr);
}please ?
-
Certainly. That does look better.
---
From: Randy Dunlap <randy.dunlap@oracle.com>
Use duplicated inline functions for test_and_set_bit_lock() on x86
instead of #define macros, thus avoiding a bad example. This allows
kernel-doc to run cleanly instead of terminating with an error:Error(linux-2.6.24-rc1//include/asm-x86/bitops_32.h:188): cannot understand prototype: 'test_and_set_bit_lock test_and_set_bit '
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
include/asm-x86/bitops_32.h | 7 +++++--
include/asm-x86/bitops_64.h | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)--- linux-2.6.24-rc1.orig/include/asm-x86/bitops_32.h
+++ linux-2.6.24-rc1/include/asm-x86/bitops_32.h
@@ -183,9 +183,12 @@ static inline int test_and_set_bit(int n
* @nr: Bit to set
* @addr: Address to count from
*
- * This is the same as test_and_set_bit on x86
+ * This is the same as test_and_set_bit on x86.
*/
-#define test_and_set_bit_lock test_and_set_bit
+static inline int test_and_set_bit_lock(int nr, volatile unsigned long * addr)
+{
+ return test_and_set_bit(nr, addr);
+}/**
* __test_and_set_bit - Set a bit and return its old value
--- linux-2.6.24-rc1.orig/include/asm-x86/bitops_64.h
+++ linux-2.6.24-rc1/include/asm-x86/bitops_64.h
@@ -173,9 +173,12 @@ static __inline__ int test_and_set_bit(i
* @nr: Bit to set
* @addr: Address to count from
*
- * This is the same as test_and_set_bit on x86
+ * This is the same as test_and_set_bit on x86.
*/
-#define test_and_set_bit_lock test_and_set_bit
+static __inline__ int test_and_set_bit_lock(int nr, volatile void * addr)
+{
+ return test_and_set_bit(nr, addr);
+}/**
* __test_and_set_bit - Set a bit and return its old value
-
-
On Thu, 25 Oct 2007 09:55:40 -0700
mutter.
ERROR: "foo * bar" should be "foo *bar"
#80: FILE: include/asm-x86/bitops_32.h:188:
+static inline int test_and_set_bit_lock(int nr, volatile unsigned long * addr)WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#80: FILE: include/asm-x86/bitops_32.h:188:
+static inline int test_and_set_bit_lock(int nr, volatile unsigned long * addr)ERROR: "foo * bar" should be "foo *bar"
#97: FILE: include/asm-x86/bitops_64.h:178:
+static __inline__ int test_and_set_bit_lock(int nr, volatile void * addr)WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#97: FILE: include/asm-x86/bitops_64.h:178:
+static __inline__ int test_and_set_bit_lock(int nr, volatile void * addr)total: 2 errors, 2 warnings, 28 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.We might as well clean stuff up as we're churning the code.
Andy, I thought we were going to whine about __inline__ and __inline, too?
-
Hmmm, I don't remember that coming up, but I'll add it to the todo. I
am assuming plain 'inline' is preferred over both of these -- yell if
you meant something else.-apw
-
Yes, use __inline__ if and only if it is exported to userspace.
-hpa
-
Ok, this will be in the next release and is in -next.
WARNING: plain inline is preferred over __inline
#4: FILE: tmp/testset-28768.c:1:
+static __inline int foo(void)-apw
-
Thomas, can you replace the previous patch with this one?
Usage of __inline__ is fixed in the next patch (after this one).
---
From: Randy Dunlap <randy.dunlap@oracle.com>
Use duplicated inline functions for test_and_set_bit_lock() on x86
instead of #define macros, thus avoiding a bad example. This allows
kernel-doc to run cleanly instead of terminating with an error:Error(linux-2.6.24-rc1//include/asm-x86/bitops_32.h:188): cannot understand prototype: 'test_and_set_bit_lock test_and_set_bit '
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
include/asm-x86/bitops_32.h | 7 +++++--
include/asm-x86/bitops_64.h | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)--- linux-2.6.24-rc1.orig/include/asm-x86/bitops_32.h
+++ linux-2.6.24-rc1/include/asm-x86/bitops_32.h
@@ -183,9 +183,12 @@ static inline int test_and_set_bit(int n
* @nr: Bit to set
* @addr: Address to count from
*
- * This is the same as test_and_set_bit on x86
+ * This is the same as test_and_set_bit on x86.
*/
-#define test_and_set_bit_lock test_and_set_bit
+static inline int test_and_set_bit_lock(int nr, volatile unsigned long *addr)
+{
+ return test_and_set_bit(nr, addr);
+}/**
* __test_and_set_bit - Set a bit and return its old value
--- linux-2.6.24-rc1.orig/include/asm-x86/bitops_64.h
+++ linux-2.6.24-rc1/include/asm-x86/bitops_64.h
@@ -173,9 +173,12 @@ static __inline__ int test_and_set_bit(i
* @nr: Bit to set
* @addr: Address to count from
*
- * This is the same as test_and_set_bit on x86
+ * This is the same as test_and_set_bit on x86.
*/
-#define test_and_set_bit_lock test_and_set_bit
+static __inline__ int test_and_set_bit_lock(int nr, volatile void *addr)
+{
+ return test_and_set_bit(nr, addr);
+}/**
* __test_and_set_bit - Set a bit and return its old value
-
Randy,
Sure. Darn, I did not run yours through the usual procedure :)
-
Yup. Applied, thanks
-
That's probably best, yes.
---
~Randy
-
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Matt Mackall | Re: [PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker.c compiling |
| James Bottomley | Re: Integration of SCST in the mainstream Linux kernel |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | [GIT]: Networking |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Natalie Protasevich | [BUG] New Kernel Bugs |
git: | |
