From patchwork Sat Aug 23 11:20:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 4770131 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 877C4C0338 for ; Sun, 24 Aug 2014 04:13:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A1BC201DC for ; Sun, 24 Aug 2014 04:13:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3FC5C201CE for ; Sun, 24 Aug 2014 04:13:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DD9E6E146; Sat, 23 Aug 2014 21:13:23 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTP id EB79B6E22E for ; Sat, 23 Aug 2014 04:34:52 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.04,386,1406584800"; d="scan'208";a="90829921" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Aug 2014 13:24:53 +0200 From: Julia Lawall To: David Airlie Subject: [PATCH 6/9] drm: use c99 initializers in structures Date: Sat, 23 Aug 2014 13:20:28 +0200 Message-Id: <1408792831-25615-7-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1408792831-25615-1-git-send-email-Julia.Lawall@lip6.fr> References: <1408792831-25615-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailman-Approved-At: Sat, 23 Aug 2014 21:13:20 -0700 Cc: kernel-janitors@vger.kernel.org, josh@joshtriplett.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Julia Lawall Use c99 initializers for structures. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @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 ,...}; // Signed-off-by: Julia Lawall Reviewed-by: Josh Triplett --- The patches in this series do not depend on each other. drivers/gpu/drm/sti/sti_vtac.c | 12 ++++++++++-- drivers/gpu/drm/drm_edid.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 35 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..a28c330 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2103,7 +2103,11 @@ 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, + .preferred = 0, + .quirks = 0, + .modes = 0 }; if (version_greater(edid, 1, 0)) @@ -2169,7 +2173,11 @@ 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, + .preferred = 0, + .quirks = 0, + .modes = 0 }; for (i = 0; i <= EDID_EST_TIMINGS; i++) { @@ -2227,7 +2235,11 @@ 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, + .preferred = 0, + .quirks = 0, + .modes = 0 }; for (i = 0; i < EDID_STD_TIMINGS; i++) { @@ -2313,7 +2325,11 @@ 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, + .preferred = 0, + .quirks = 0, + .modes = 0 }; if (version_greater(edid, 1, 2)) @@ -2357,11 +2373,11 @@ 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, + .modes = 0 }; if (closure.preferred && !version_greater(edid, 1, 3))