lkml.org 
[lkml]   [2020]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] rwsem: fix commas in initialisation
On Sat, Jul 11, 2020 at 05:59:54PM +0300, Alexey Dobriyan wrote:
> Leading comma prevents arbitrary reordering of initialisation clauses.
> The whole point of C99 initialisation is to allow any such reordering.

I'm conflicted on this argument, the only reason I'd be inclined to take
this patch is that it allows fixing the initialization order to not be
random.

That is, I'd fold in the below.

--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -89,9 +89,9 @@ static inline int rwsem_is_locked(struct
#define __RWSEM_INITIALIZER(name) \
{ __RWSEM_INIT_COUNT(name), \
.owner = ATOMIC_LONG_INIT(0), \
- .wait_list = LIST_HEAD_INIT((name).wait_list), \
- .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),\
__RWSEM_OPT_INIT(name) \
+ .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),\
+ .wait_list = LIST_HEAD_INIT((name).wait_list), \
__DEBUG_RWSEM_INITIALIZER(name) \
__RWSEM_DEP_MAP_INIT(name) }

\
 
 \ /
  Last update: 2020-07-13 13:52    [W:1.517 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site