[PATCH 08/14] backport: prevent unused subclass variable warning in < 3.18

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Luca Coelho <luciano.coelho@xxxxxxxxx>

In kernels earlier than 3.18, the raw_spin_lock defininition when
CONFIG_DEBUG_LOCK_ALLOC is not enabled, was dropping one of the
parameters, which caused a few "unused variable" warnings at places
where this argument was only used in the call to
raw_spin_lock_nested().  Take the latest definition which evaluates
the argument to avoid compiler warnings.

Signed-off-by: Luca Coelho <luciano.coelho@xxxxxxxxx>
 backport/backport-include/linux/spinlock.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/backport/backport-include/linux/spinlock.h b/backport/backport-include/linux/spinlock.h
index 07daa358e25d..a46f6e33b241 100644
--- a/backport/backport-include/linux/spinlock.h
+++ b/backport/backport-include/linux/spinlock.h
@@ -2,6 +2,21 @@
 #include_next <linux/spinlock.h>
+#undef raw_spin_lock_nested
+ * Always evaluate the 'subclass' argument to avoid that the compiler
+ * warns about set-but-not-used variables when building with
+ * CONFIG_DEBUG_LOCK_ALLOC=n and with W=1.
+ */
+# define raw_spin_lock_nested(lock, subclass)		\
+	_raw_spin_lock(((void)(subclass), (lock)))
+# define raw_spin_lock_nest_lock(lock, nest_lock)	_raw_spin_lock(lock)
+#endif /* LINUX_VERSION_IS_LESS(3,18,0) */
 int alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask,
 			   size_t max_size, unsigned int cpu_mult,

To unsubscribe from this list: send the line "unsubscribe backports" in

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux