patch-2.3.13 linux/include/asm-sparc64/spinlock.h

Next file: linux/include/asm-sparc64/system.h
Previous file: linux/include/asm-sparc64/smp.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.12/linux/include/asm-sparc64/spinlock.h linux/include/asm-sparc64/spinlock.h
@@ -10,11 +10,16 @@
 
 #ifndef __SMP__
 
-typedef unsigned char spinlock_t;
-#define SPIN_LOCK_UNLOCKED 0
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+  typedef struct { } spinlock_t;
+# define SPIN_LOCK_UNLOCKED (spinlock_t) { }
+#else
+  typedef unsigned char spinlock_t;
+# define SPIN_LOCK_UNLOCKED 0
+#endif
 
 #define spin_lock_init(lock)	do { } while(0)
-#define spin_lock(lock)		do { } while(0)
+#define spin_lock(lock)		(void)(lock)	/* Avoid warnings about unused variable */
 #define spin_trylock(lock)	(1)
 #define spin_unlock_wait(lock)	do { } while(0)
 #define spin_unlock(lock)	do { } while(0)
@@ -42,12 +47,17 @@
  * irq-safe write-lock, but readers can get non-irqsafe
  * read-locks.
  */
-typedef unsigned int rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+  typedef struct { } rwlock_t;
+# define RW_LOCK_UNLOCKED (rwlock_t) { }
+#else
+  typedef unsigned int rwlock_t;
+# define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
+#endif
 
-#define read_lock(lock)		do { } while(0)
+#define read_lock(lock)		(void)(lock)	/* Avoid warnings about unused variable */
 #define read_unlock(lock)	do { } while(0)
-#define write_lock(lock)	do { } while(0)
+#define write_lock(lock)	(void)(lock)	/* Likewise */
 #define write_unlock(lock)	do { } while(0)
 #define read_lock_irq(lock)	cli()
 #define read_unlock_irq(lock)	sti()
@@ -372,4 +382,4 @@
 
 #endif /* !(__ASSEMBLY__) */
 
-#endif /* !(__SPARC64_SPIN%0_H) */
+#endif /* !(__SPARC64_SPINLOCK_H) */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)