Re: [PATCH 2/5] raid: Require designated initialization of structures

Started by NeilBrown on Aug 1, 2014 · 2 messages from 2 authors · Last reply Aug 1, 2014

open the first message on its own page

Message details and related content
On Thu, 31 Jul 2014 16:47:35 -0700 Josh Triplett [off-list ref]
wrote:
Mark raid6_calls and other structures containing function pointers with
__designated_init.  Fix implementations in lib/raid6/ to use designated
initializers; this also simplifies those initializers using the default
initialization of fields to 0.

Signed-off-by: Josh Triplett <redacted>
Looks like an excellent idea!
Feel free to forward this upstream on my behalf, or remind me once the first
patch is in -next, and I'll take this one myself - whichever you prefer.

 Acked-by: NeilBrown [off-list ref]

Thanks,
NeilBrown
quoted hunk
---
 include/linux/raid/pq.h    |  4 ++--
 include/linux/raid/xor.h   |  2 +-
 include/linux/raid_class.h |  2 +-
 lib/raid6/altivec.uc       |  7 +++----
 lib/raid6/avx2.c           | 24 ++++++++++++------------
 lib/raid6/int.uc           |  6 ++----
 lib/raid6/mmx.c            | 14 ++++++--------
 lib/raid6/neon.c           |  7 +++----
 lib/raid6/sse1.c           | 16 ++++++++--------
 lib/raid6/sse2.c           | 24 ++++++++++++------------
 lib/raid6/tilegx.uc        |  6 ++----
 11 files changed, 52 insertions(+), 60 deletions(-)
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 73069cb..2147bff 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -75,7 +75,7 @@ struct raid6_calls {
 	int  (*valid)(void);	/* Returns 1 if this routine set is usable */
 	const char *name;	/* Name of this routine set */
 	int prefer;		/* Has special performance attribute */
-};
+} __designated_init;
 
 /* Selected algorithm */
 extern struct raid6_calls raid6_call;
@@ -109,7 +109,7 @@ struct raid6_recov_calls {
 	int  (*valid)(void);
 	const char *name;
 	int priority;
-};
+} __designated_init;
 
 extern const struct raid6_recov_calls raid6_recov_intx1;
 extern const struct raid6_recov_calls raid6_recov_ssse3;
diff --git a/include/linux/raid/xor.h b/include/linux/raid/xor.h
index 5a21095..c7df59f 100644
--- a/include/linux/raid/xor.h
+++ b/include/linux/raid/xor.h

253 more quoted lines

Message details and related content
On Fri, Aug 01, 2014 at 11:10:55AM +1000, NeilBrown wrote:
On Thu, 31 Jul 2014 16:47:35 -0700 Josh Triplett [off-list ref]
wrote:
quoted
Mark raid6_calls and other structures containing function pointers with
__designated_init.  Fix implementations in lib/raid6/ to use designated
initializers; this also simplifies those initializers using the default
initialization of fields to 0.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Looks like an excellent idea!
Feel free to forward this upstream on my behalf, or remind me once the first
patch is in -next, and I'll take this one myself - whichever you prefer.

 Acked-by: NeilBrown [off-list ref]
Thanks!  Ideally, I'd like to see the whole series go in through one
tree, which is why I CCed Andrew.  I can easily produce several dozen
more patches like these, but I just included enough examples to motivate
patch 1, and I can send more in any order once that one goes in.

- Josh Triplett
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help