Resent-Date: Tue, 7 Sep 1999 22:25:24 +0200 (MET DST)
Date: Tue, 7 Sep 1999 22:25:11 +0200 (CEST)
From: Geert Uytterhoeven <geert@thomas.kotnet.org>
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>
Subject: 2.3.16: kill spinlock warnings
Resent-From: linux-m68k@phil.uni-sb.de


Kill more compiler warnings about unused variables.

--- m68k-2.3.16/include/asm-m68k/spinlock.h.orig	Mon Aug 16 10:13:18 1999
+++ m68k-2.3.16/include/asm-m68k/spinlock.h	Tue Sep  7 21:33:04 1999
@@ -16,20 +16,22 @@
 #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
 #endif
 
-#define spin_lock_init(lock)	do { } while(0)
+#define spin_lock_init(lock)	do { (void)(lock); } while(0)
 #define spin_lock(lock)		(void)(lock) /* Not "unused variable". */
-#define spin_trylock(lock)	(1)
-#define spin_unlock_wait(lock)	do { } while(0)
-#define spin_unlock(lock)	do { } while(0)
-#define spin_lock_irq(lock)	cli()
-#define spin_unlock_irq(lock)	sti()
-#define spin_lock_bh(lock)	local_bh_disable()
-#define spin_unlock_bh(lock)	local_bh_enable()
+#define spin_trylock(lock)	( (void)lock, (1) )
+#define spin_unlock_wait(lock)	do { (void)(lock); } while(0)
+#define spin_unlock(lock)	do { (void)(lock); } while(0)
+#define spin_lock_irq(lock)	do { cli(); (void)(lock); } while (0)
+#define spin_unlock_irq(lock)	do { sti(); (void)(lock); } while (0)
+#define spin_lock_bh(lock) \
+	do { local_bh_disable(); (void)(lock); } while (0)
+#define spin_unlock_bh(lock) \
+	do { local_bh_enable(); (void)(lock); } while (0)
 
 #define spin_lock_irqsave(lock, flags) \
-	do { save_flags(flags); cli(); } while (0)
+	do { save_flags(flags); cli(); (void)(lock); } while (0)
 #define spin_unlock_irqrestore(lock, flags) \
-	restore_flags(flags)
+	do { restore_flags(flags); (void)(lock); } while (0)
 
 /*
  * Read-write spinlocks, allowing multiple readers
@@ -52,21 +54,29 @@
 #endif
 
 #define read_lock(lock)		(void)(lock) /* Not "unused variable". */
-#define read_unlock(lock)	do { } while(0)
+#define read_unlock(lock)	do { (void)(lock); } while(0)
 #define write_lock(lock)	(void)(lock) /* Not "unused variable". */
-#define write_unlock(lock)	do { } while(0)
-#define read_lock_irq(lock)	cli()
-#define read_unlock_irq(lock)	sti()
-#define write_lock_irq(lock)	cli()
-#define write_unlock_irq(lock)	sti()
-#define read_lock_bh(lock)	local_bh_disable()
-#define read_unlock_bh(lock)	local_bh_enable()
-#define write_lock_bh(lock)	local_bh_disable()
-#define write_unlock_bh(lock)	local_bh_enable()
+#define write_unlock(lock)	do { (void)(lock); } while(0)
+#define read_lock_irq(lock)	do { cli(); (void)(lock); } while (0)
+#define read_unlock_irq(lock)	do { sti(); (void)(lock); } while (0)
+#define write_lock_irq(lock)	do { cli(); (void)(lock); } while (0)
+#define write_unlock_irq(lock)	do { sti(); (void)(lock); } while (0)
+#define read_lock_bh(lock) \
+	do { local_bh_disable(); (void)(lock); } while (0)
+#define read_unlock_bh(lock) \
+	do { local_bh_enable(); (void)(lock); } while (0)
+#define write_lock_bh(lock) \
+	do { local_bh_disable(); (void)(lock); } while (0)
+#define write_unlock_bh(lock) \
+	do { local_bh_enable(); (void)(lock); } while (0)
 
-#define read_lock_irqsave(lock, flags)		save_and_cli(flags)
-#define read_unlock_irqrestore(lock, flags)	restore_flags(flags)
-#define write_lock_irqsave(lock, flags)		save_and_cli(flags)
-#define write_unlock_irqrestore(lock, flags)	restore_flags(flags)
+#define read_lock_irqsave(lock, flags) \
+    do { save_and_cli(flags); (void)(lock); } while (0)
+#define read_unlock_irqrestore(lock, flags) \
+    do { restore_flags(flags); (void)(lock); } while (0)
+#define write_lock_irqsave(lock, flags) \
+    do { save_and_cli(flags); (void)(lock); } while (0)
+#define write_unlock_irqrestore(lock, flags) \
+    do { restore_flags(flags); (void)(lock); } while (0)
 
 #endif
 
Greetings,

						Geert

--
Geert Uytterhoeven                    Geert.Uytterhoeven@thomas.kotnet.org
Wavelets, Linux/{m68k~Amiga,PPC~CHRP} http://www.thomas.kotnet.org/~geert/
KotNET@Thomas Network Administration -- Make your bed part of Cyberspace!!

