Skip to contentSkip to conversation

generic rw_semaphores, compile warnings patch

PATCH In review D.W.Howells 4 participants 5 messages Apr 19, 2001 – Apr 20, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic rw_semaphores, compile warnings patch

This patch (made against linux-2.4.4-pre4) gets rid of some warnings obtained when using the generic rwsem implementation.

David

include/linux/rwsem.h +10 -6
diff -uNr linux-2.4.4-pre4/include/linux/rwsem.h linux/include/linux/rwsem.h
@@ -42,20 +42,24 @@
 #include <asm/atomic.h>
 #include <linux/wait.h>
 
-#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
-#include <linux/rwsem-spinlock.h> /* use a generic implementation */
-#else
-#include <asm/rwsem.h> /* use an arch-specific implementation */
-#endif
+struct rw_semaphore;
 
 /* defined contention handler functions for the generic case
  * - these are also used for the exchange-and-add based algorithm
  */
-#if defined(CONFIG_RWSEM_GENERIC) || defined(CONFIG_RWSEM_XCHGADD_ALGORITHM)
+#if defined(CONFIG_RWSEM_GENERIC_SPINLOCK) || defined(CONFIG_RWSEM_XCHGADD_ALGORITHM)
 /* we use FASTCALL convention for the helpers */
 extern struct rw_semaphore *FASTCALL(rwsem_down_read_failed(struct rw_semaphore *sem));
 extern struct rw_semaphore *FASTCALL(rwsem_down_write_failed(struct rw_semaphore *sem));
 extern struct rw_semaphore *FASTCALL(rwsem_wake(struct rw_semaphore *sem));
+#endif
+
+/* access the actual implementation of the rwsems
+ */
+#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
+#include <linux/rwsem-spinlock.h> /* use a generic implementation */
+#else
+#include <asm/rwsem.h> /* use an arch-specific implementation */
 #endif
 
 #ifndef rwsemtrace
#1 lore raw
Quoted 2 lines · D.W.Howells

This patch (made against linux-2.4.4-pre4) gets rid of some warnings obtained when using the generic rwsem implementation.

Have a look at pre5, this is already fixed.

Later,
David S. Miller
[email protected]

#2 lore raw
Quoted 5 lines · David S. Miller
Quoted 2 lines · D.W.Howells

This patch (made against linux-2.4.4-pre4) gets rid of some warnings obtained when using the generic rwsem implementation.

Have a look at pre5, this is already fixed.

Not entirely so...

There's also a missing "struct rw_semaphore;" declaration in linux/rwsem.h. It needs to go in the gap below "#include <linux/wait.h>". Otherwise the declarations for the contention handling functions will give warnings about the struct being declared in the parameter list.

David

#3 lore raw
Quoted 4 lines · David Howells

There's also a missing "struct rw_semaphore;" declaration in linux/rwsem.h. It needs to go in the gap below "#include <linux/wait.h>". Otherwise the declarations for the contention handling functions will give warnings about the struct being declared in the parameter list.

Indeed, I didn't see this in my setup on sparc64 for some reason.

Later,
David S. Miller
[email protected]

#4 lore raw
In reply to David S. Miller
Quoted 4 lines · David Howells

There's also a missing "struct rw_semaphore;" declaration in linux/rwsem.h. It needs to go in the gap below "#include <linux/wait.h>". Otherwise the declarations for the contention handling functions will give warnings about the struct being declared in the parameter list.

Also on alpha __u16 is undeclared in rwsem.c, and old rwsem code wasn't cleaned up properly.

Ivan.

include/linux/rwsem-spinlock.h +2 -0
@@ -14,6 +14,8 @@
 
 #ifdef __KERNEL__
 
+#include <linux/types.h>
+
 /*
  * the semaphore definition
  */
include/asm-alpha/semaphore.h +0 -2
@@ -225,5 +225,3 @@ extern inline void up(struct semaphore *
 #endif
 
 #endif
-
-#endif
arch/alpha/kernel/alpha_ksyms.c +0 -3
@@ -173,9 +173,6 @@ EXPORT_SYMBOL(down);
 EXPORT_SYMBOL(down_interruptible);
 EXPORT_SYMBOL(down_trylock);
 EXPORT_SYMBOL(up);
-EXPORT_SYMBOL(__down_read_failed);
-EXPORT_SYMBOL(__down_write_failed);
-EXPORT_SYMBOL(__rwsem_wake);
 EXPORT_SYMBOL(down_read);
 EXPORT_SYMBOL(down_write);
 EXPORT_SYMBOL(up_read);