From: Daniel Vetter <daniel@ffwll.ch> To: Julia Lawall <julia.lawall@lip6.fr> Cc: Josh Triplett <josh@joshtriplett.org>, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 6/9 v2] drm: use c99 initializers in structures Date: Mon, 25 Aug 2014 15:18:23 +0200 [thread overview] Message-ID: <20140825131823.GH15520@phenom.ffwll.local> (raw) In-Reply-To: <alpine.DEB.2.02.1408231808400.2068@localhost6.localdomain6> On Sat, Aug 23, 2014 at 06:09:56PM +0200, Julia Lawall wrote: > From: Julia Lawall <Julia.Lawall@lip6.fr> > > 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> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > --- > The patches in this series do not depend on each other. > > v2: Drop 0 initializers and add trailing commas at the suggestions of Josh > Triplett. Slurped into my drm topic branch for 3.18 to make sure it doesn't get lost. -Daniel > > drivers/gpu/drm/drm_edid.c | 21 ++++++++++++--------- > drivers/gpu/drm/sti/sti_vtac.c | 12 ++++++++++-- > 2 files changed, 22 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/sti/sti_vtac.c b/drivers/gpu/drm/sti/sti_vtac.c > index 82a51d4..4576536 100644 > --- a/drivers/gpu/drm/sti/sti_vtac.c > +++ b/drivers/gpu/drm/sti/sti_vtac.c > @@ -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 > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 1dbf3bc..859ae1c 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -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)) > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch> To: Julia Lawall <julia.lawall@lip6.fr> Cc: Josh Triplett <josh@joshtriplett.org>, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 6/9 v2] drm: use c99 initializers in structures Date: Mon, 25 Aug 2014 13:18:23 +0000 [thread overview] Message-ID: <20140825131823.GH15520@phenom.ffwll.local> (raw) In-Reply-To: <alpine.DEB.2.02.1408231808400.2068@localhost6.localdomain6> On Sat, Aug 23, 2014 at 06:09:56PM +0200, Julia Lawall wrote: > From: Julia Lawall <Julia.Lawall@lip6.fr> > > 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> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > --- > The patches in this series do not depend on each other. > > v2: Drop 0 initializers and add trailing commas at the suggestions of Josh > Triplett. Slurped into my drm topic branch for 3.18 to make sure it doesn't get lost. -Daniel > > drivers/gpu/drm/drm_edid.c | 21 ++++++++++++--------- > drivers/gpu/drm/sti/sti_vtac.c | 12 ++++++++++-- > 2 files changed, 22 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/sti/sti_vtac.c b/drivers/gpu/drm/sti/sti_vtac.c > index 82a51d4..4576536 100644 > --- a/drivers/gpu/drm/sti/sti_vtac.c > +++ b/drivers/gpu/drm/sti/sti_vtac.c > @@ -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 > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 1dbf3bc..859ae1c 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -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)) > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-08-25 13:18 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` [PATCH 1/9] [media] v4l: ti-vpe: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` [PATCH 2/9] video: fbdev: matrox: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` [PATCH 3/9] pwm: lpss: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-25 9:44 ` Thierry Reding 2014-08-25 9:44 ` Thierry Reding 2014-08-23 11:20 ` [PATCH 4/9] NFC: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` [PATCH 5/9] lustre: obdclass: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` [PATCH 6/9] drm: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 15:16 ` Josh Triplett 2014-08-23 15:16 ` Josh Triplett 2014-08-23 16:09 ` [PATCH 6/9 v2] " Julia Lawall 2014-08-23 16:09 ` Julia Lawall 2014-08-25 13:18 ` Daniel Vetter [this message] 2014-08-25 13:18 ` Daniel Vetter 2014-08-23 11:20 ` [PATCH 7/9] OMAPDSS: DSI: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 11:20 ` [PATCH 8/9] video: fbdev: aty: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 15:20 ` Josh Triplett 2014-08-23 15:20 ` Josh Triplett 2014-08-23 15:32 ` Julia Lawall 2014-08-23 15:32 ` Julia Lawall 2014-08-23 16:03 ` Josh Triplett 2014-08-23 16:03 ` Josh Triplett 2014-08-25 10:16 ` Dan Carpenter 2014-08-25 10:16 ` Dan Carpenter 2014-08-23 15:50 ` [PATCH 8/9 v2] " Julia Lawall 2014-08-23 15:50 ` Julia Lawall 2014-08-23 16:03 ` Josh Triplett 2014-08-23 16:03 ` Josh Triplett 2014-08-26 10:43 ` Tomi Valkeinen 2014-08-26 10:43 ` Tomi Valkeinen 2014-08-23 11:20 ` [PATCH 9/9] rtc: " Julia Lawall 2014-08-23 11:20 ` Julia Lawall 2014-08-23 15:21 ` [PATCH 0/9] " Josh Triplett 2014-08-23 15:21 ` Josh Triplett 2014-08-23 15:21 ` Josh Triplett
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20140825131823.GH15520@phenom.ffwll.local \ --to=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=josh@joshtriplett.org \ --cc=julia.lawall@lip6.fr \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.