History

rwsem: fix commas in initialisation

Leading comma prevents arbitrary reordering of initialisation clauses. The whole point of C99 initialisation is to allow any such reordering.

Alexey Dobriyan committed 6 years ago

Commit a9232dc1 parent 482cbb61 file · +10 −10Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/rwsem.h+10−10
@@ -60,39 +60,39 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) · 59 unmodified lines
6060 }
6161
6262 #define RWSEM_UNLOCKED_VALUE 0L
63−#define __RWSEM_INIT_COUNT(name) .count = ATOMIC_LONG_INIT(RWSEM_UNLOCKED_VALUE)
63+#define __RWSEM_COUNT_INIT(name) .count = ATOMIC_LONG_INIT(RWSEM_UNLOCKED_VALUE)
6464
6565 /* Common initializer macros and functions */
6666
6767 #ifdef CONFIG_DEBUG_LOCK_ALLOC
6868 # define __RWSEM_DEP_MAP_INIT(lockname) \
69− , .dep_map = { \
69+ .dep_map = { \
7070 .name = #lockname, \
7171 .wait_type_inner = LD_WAIT_SLEEP, \
72− }
72+ },
7373 #else
7474 # define __RWSEM_DEP_MAP_INIT(lockname)
7575 #endif
7676
7777 #ifdef CONFIG_DEBUG_RWSEMS
78−# define __DEBUG_RWSEM_INITIALIZER(lockname) , .magic = &lockname
78+# define __RWSEM_DEBUG_INIT(lockname) .magic = &lockname,
7979 #else
80−# define __DEBUG_RWSEM_INITIALIZER(lockname)
80+# define __RWSEM_DEBUG_INIT(lockname)
8181 #endif
8282
8383 #ifdef CONFIG_RWSEM_SPIN_ON_OWNER
84−#define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED
84+#define __RWSEM_OPT_INIT(lockname) .osq = OSQ_LOCK_UNLOCKED,
8585 #else
8686 #define __RWSEM_OPT_INIT(lockname)
8787 #endif
8888
8989 #define __RWSEM_INITIALIZER(name) \
90− { __RWSEM_INIT_COUNT(name), \
90+ { __RWSEM_COUNT_INIT(name), \
9191 .owner = ATOMIC_LONG_INIT(0), \
92− .wait_list = LIST_HEAD_INIT((name).wait_list), \
93− .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock) \
9492 __RWSEM_OPT_INIT(name) \
95− __DEBUG_RWSEM_INITIALIZER(name) \
93+ .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),\
94+ .wait_list = LIST_HEAD_INIT((name).wait_list), \
95+ __RWSEM_DEBUG_INIT(name) \
9696 __RWSEM_DEP_MAP_INIT(name) }
9797
9898 #define DECLARE_RWSEM(name) \