Skip to content

Commit dbb5eaf

Browse files
Davidlohr BuesoIngo Molnar
Davidlohr Bueso
authored and
Ingo Molnar
committed
locking/rwsem: Fix warnings for CONFIG_RWSEM_GENERIC_SPINLOCK
Optimistic spinning is only used by the xadd variant of rw-semaphores. Make sure that we use the old version of the __RWSEM_INITIALIZER macro for systems that rely on the spinlock one, otherwise warnings can be triggered, such as the following reported on an arm box: ipc/ipcns_notifier.c:22:8: warning: excess elements in struct initializer [enabled by default] ipc/ipcns_notifier.c:22:8: warning: (near initialization for 'ipcns_chain.rwsem') [enabled by default] ipc/ipcns_notifier.c:22:8: warning: excess elements in struct initializer [enabled by default] ipc/ipcns_notifier.c:22:8: warning: (near initialization for 'ipcns_chain.rwsem') [enabled by default] Signed-off-by: Davidlohr Bueso <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Cc: Tim Chen <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Paul McKenney <[email protected]> Cc: Michel Lespinasse <[email protected]> Cc: Peter Hurley <[email protected]> Cc: Alex Shi <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Jason Low <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Chris Mason <[email protected]> Cc: Josef Bacik <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 4fc828e commit dbb5eaf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/rwsem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem)
6464
# define __RWSEM_DEP_MAP_INIT(lockname)
6565
#endif
6666

67-
#ifdef CONFIG_SMP
67+
#if defined(CONFIG_SMP) && !defined(CONFIG_RWSEM_GENERIC_SPINLOCK)
6868
#define __RWSEM_INITIALIZER(name) \
6969
{ RWSEM_UNLOCKED_VALUE, \
7070
__RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \

0 commit comments

Comments
 (0)