drm: use c99 initializers in structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 23 Aug 2014 16:09:56 +0000 (18:09 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 12 Sep 2014 14:49:34 +0000 (16:49 +0200)
Use c99 initializers for structures.

Drop 0 initializers in drivers/gpu/drm/sti/sti_vtac.c.  A 0x0 initializer
is left in vtac_mode_aux in drivers/gpu/drm/sti/sti_vtac.c to highlight the
relation to vtac_mode_main.

A simplified version of the semantic match that finds the first problem is
as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@decl@
identifier i1,fld;
type T;
field list[n] fs;
@@

struct i1 {
 fs
 T fld;
 ...};

@bad@
identifier decl.i1,i2;
expression e;
initializer list[decl.n] is;
@@

struct i1 i2 = { is,
+ .fld = e
- e
 ,...};
// </smpl>

v2: Drop 0 initializers and add trailing commas at the suggestions of Josh
Triplett.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/sti/sti_vtac.c

index f905c63c0f688c9e0a3d5e03eba1f566e740649d..daf3cd8094328c91a361418abeace05508f119e7 100644 (file)
@@ -2103,7 +2103,8 @@ static int
 add_inferred_modes(struct drm_connector *connector, struct edid *edid)
 {
        struct detailed_mode_closure closure = {
-               connector, edid, 0, 0, 0
+               .connector = connector,
+               .edid = edid,
        };
 
        if (version_greater(edid, 1, 0))
@@ -2169,7 +2170,8 @@ add_established_modes(struct drm_connector *connector, struct edid *edid)
                ((edid->established_timings.mfg_rsvd & 0x80) << 9);
        int i, modes = 0;
        struct detailed_mode_closure closure = {
-               connector, edid, 0, 0, 0
+               .connector = connector,
+               .edid = edid,
        };
 
        for (i = 0; i <= EDID_EST_TIMINGS; i++) {
@@ -2227,7 +2229,8 @@ add_standard_modes(struct drm_connector *connector, struct edid *edid)
 {
        int i, modes = 0;
        struct detailed_mode_closure closure = {
-               connector, edid, 0, 0, 0
+               .connector = connector,
+               .edid = edid,
        };
 
        for (i = 0; i < EDID_STD_TIMINGS; i++) {
@@ -2313,7 +2316,8 @@ static int
 add_cvt_modes(struct drm_connector *connector, struct edid *edid)
 {      
        struct detailed_mode_closure closure = {
-               connector, edid, 0, 0, 0
+               .connector = connector,
+               .edid = edid,
        };
 
        if (version_greater(edid, 1, 2))
@@ -2357,11 +2361,10 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
                   u32 quirks)
 {
        struct detailed_mode_closure closure = {
-               connector,
-               edid,
-               1,
-               quirks,
-               0
+               .connector = connector,
+               .edid = edid,
+               .preferred = 1,
+               .quirks = quirks,
        };
 
        if (closure.preferred && !version_greater(edid, 1, 3))
index 82a51d4884341fac791ad0d41f9371387f6f4666..97bcdac23ae1f0733d87b3cc6f3b071834d1bdba 100644 (file)
@@ -56,8 +56,16 @@ struct sti_vtac_mode {
        u32 phyts_per_pixel;
 };
 
-static const struct sti_vtac_mode vtac_mode_main = {0x2, 0x2, VTAC_5_PPP};
-static const struct sti_vtac_mode vtac_mode_aux = {0x1, 0x0, VTAC_17_PPP};
+static const struct sti_vtac_mode vtac_mode_main = {
+       .vid_in_width = 0x2,
+       .phyts_width = 0x2,
+       .phyts_per_pixel = VTAC_5_PPP,
+};
+static const struct sti_vtac_mode vtac_mode_aux = {
+       .vid_in_width = 0x1,
+       .phyts_width = 0x0,
+       .phyts_per_pixel = VTAC_17_PPP,
+};
 
 /**
  * VTAC structure