linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] use c99 initializers in structures
@ 2014-08-23 11:20 Julia Lawall
  2014-08-23 11:20 ` [PATCH 1/9] [media] v4l: ti-vpe: " Julia Lawall
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: dri-devel
  Cc: josh, kernel-janitors, linux-nfc, linux-wireless, linux-fbdev,
	linux-kernel, linux-media, linux-pwm, devel, linux-omap,
	rtc-linux

These patches add labels in the initializations of structure fields (c99
initializers).  The complete semantic patch thta makes this change is shown
below.  This rule ignores cases where the initialization is just 0 or NULL,
where some of the fields already use labels, and where there are nested
structures.

// <smpl>
@ok1@
identifier i1,i2;
position p;
@@

struct i1 i2@p = { \(0\|NULL\) };

@ok2@
identifier i1,i2,i3;
position p;
expression e;
@@

struct i1 i2@p = { ..., .i3 = e, ... };

@ok3@
identifier i1,i2;
position p;
@@

struct i1 i2@p = { ..., { ... }, ... };

@decl@
identifier i1,fld;
type T;
field list[n] fs;
@@

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

@bad@
identifier decl.i1,i2;
expression e;
position p != {ok1.p,ok2.p,ok3.p};
constant nm;
initializer list[decl.n] is;
position fix;
@@

struct i1 i2@p = { is,
(
 nm(...)
|
 e@fix
)
 ,...};

@@
identifier decl.i1,i2,decl.fld;
expression e;
position bad.p, bad.fix;
@@

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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/9] [media] v4l: ti-vpe: use c99 initializers in structures
  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 ` [PATCH 2/9] video: fbdev: matrox: " Julia Lawall
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: josh, kernel-janitors, linux-media, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

Not compiled.

 drivers/media/platform/ti-vpe/vpe.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c
index 972f43f..20dd7ea 100644
--- a/drivers/media/platform/ti-vpe/vpe.c
+++ b/drivers/media/platform/ti-vpe/vpe.c
@@ -138,12 +138,12 @@ struct vpe_dei_regs {
  * default expert DEI register values, unlikely to be modified.
  */
 static const struct vpe_dei_regs dei_regs = {
-	0x020C0804u,
-	0x0118100Fu,
-	0x08040200u,
-	0x1010100Cu,
-	0x10101010u,
-	0x10101010u,
+	.mdt_spacial_freq_thr_reg = 0x020C0804u,
+	.edi_config_reg = 0x0118100Fu,
+	.edi_lut_reg0 = 0x08040200u,
+	.edi_lut_reg1 = 0x1010100Cu,
+	.edi_lut_reg2 = 0x10101010u,
+	.edi_lut_reg3 = 0x10101010u,
 };
 
 /*


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/9] video: fbdev: matrox: use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures 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 3/9] pwm: lpss: " Julia Lawall
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: Jean-Christophe Plagniol-Villard
  Cc: josh, kernel-janitors, Tomi Valkeinen, linux-fbdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

 drivers/video/fbdev/matrox/matroxfb_maven.c |   20 +++++-----
 drivers/video/fbdev/matrox/matroxfb_base.c  |   52 ++++++++++++++++++++++++----
 2 files changed, 56 insertions(+), 16 deletions(-)

diff --git a/drivers/video/fbdev/matrox/matroxfb_maven.c b/drivers/video/fbdev/matrox/matroxfb_maven.c
index ee41a0f..bf5ce04 100644
--- a/drivers/video/fbdev/matrox/matroxfb_maven.c
+++ b/drivers/video/fbdev/matrox/matroxfb_maven.c
@@ -201,21 +201,23 @@ struct matrox_pll_ctl {
 };
 
 static const struct matrox_pll_features2 maven1000_pll = {
-	 50000000,
-	300000000,
-	 5, 128,
-	 3,  32,
-	 3
+	.vco_freq_min = 50000000,
+	.vco_freq_max = 300000000,
+	.feed_div_min = 5,
+	.feed_div_max = 128,
+	.in_div_min = 3,
+	.in_div_max = 32,
+	.post_shift_max = 3
 };
 
 static const struct matrox_pll_ctl maven_PAL = {
-	540000,
-	    50
+	.ref_freq = 540000,
+	.den = 50
 };
 
 static const struct matrox_pll_ctl maven_NTSC = {
-	450450,	/* 27027000/60 == 27000000/59.94005994 */
-	    60
+	.ref_freq = 450450,	/* 27027000/60 == 27000000/59.94005994 */
+	.den = 60
 };
 
 static int matroxfb_PLL_mavenclock(const struct matrox_pll_features2* pll,
diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c
index 7116c53..62539ca 100644
--- a/drivers/video/fbdev/matrox/matroxfb_base.c
+++ b/drivers/video/fbdev/matrox/matroxfb_base.c
@@ -1341,19 +1341,57 @@ struct video_board {
 	struct matrox_switch* lowlevel;
 		 };
 #ifdef CONFIG_FB_MATROX_MILLENIUM
-static struct video_board vbMillennium		= {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGA2064W,	&matrox_millennium};
-static struct video_board vbMillennium2		= {0x1000000, 0x0800000, FB_ACCEL_MATROX_MGA2164W,	&matrox_millennium};
-static struct video_board vbMillennium2A	= {0x1000000, 0x0800000, FB_ACCEL_MATROX_MGA2164W_AGP,	&matrox_millennium};
+static struct video_board vbMillennium = {
+	.maxvram = 0x0800000,
+	.maxdisplayable = 0x0800000,
+	.accelID = FB_ACCEL_MATROX_MGA2064W,
+	.lowlevel = &matrox_millennium
+};
+
+static struct video_board vbMillennium2 = {
+	.maxvram = 0x1000000,
+	.maxdisplayable = 0x0800000,
+	.accelID = FB_ACCEL_MATROX_MGA2164W,
+	.lowlevel = &matrox_millennium
+};
+
+static struct video_board vbMillennium2A = {
+	.maxvram = 0x1000000,
+	.maxdisplayable = 0x0800000,
+	.accelID = FB_ACCEL_MATROX_MGA2164W_AGP,
+	.lowlevel = &matrox_millennium
+};
 #endif	/* CONFIG_FB_MATROX_MILLENIUM */
 #ifdef CONFIG_FB_MATROX_MYSTIQUE
-static struct video_board vbMystique		= {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGA1064SG,	&matrox_mystique};
+static struct video_board vbMystique = {
+	.maxvram = 0x0800000,
+	.maxdisplayable = 0x0800000,
+	.accelID = FB_ACCEL_MATROX_MGA1064SG,
+	.lowlevel = &matrox_mystique
+};
 #endif	/* CONFIG_FB_MATROX_MYSTIQUE */
 #ifdef CONFIG_FB_MATROX_G
-static struct video_board vbG100		= {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGAG100,	&matrox_G100};
-static struct video_board vbG200		= {0x1000000, 0x1000000, FB_ACCEL_MATROX_MGAG200,	&matrox_G100};
+static struct video_board vbG100 = {
+	.maxvram = 0x0800000,
+	.maxdisplayable = 0x0800000,
+	.accelID = FB_ACCEL_MATROX_MGAG100,
+	.lowlevel = &matrox_G100
+};
+
+static struct video_board vbG200 = {
+	.maxvram = 0x1000000,
+	.maxdisplayable = 0x1000000,
+	.accelID = FB_ACCEL_MATROX_MGAG200,
+	.lowlevel = &matrox_G100
+};
 /* from doc it looks like that accelerator can draw only to low 16MB :-( Direct accesses & displaying are OK for
    whole 32MB */
-static struct video_board vbG400		= {0x2000000, 0x1000000, FB_ACCEL_MATROX_MGAG400,	&matrox_G100};
+static struct video_board vbG400 = {
+	.maxvram = 0x2000000,
+	.maxdisplayable = 0x1000000,
+	.accelID = FB_ACCEL_MATROX_MGAG400,
+	.lowlevel = &matrox_G100
+};
 #endif
 
 #define DEVF_VIDEO64BIT		0x0001


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/9] pwm: lpss: use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
  2014-08-23 11:20 ` [PATCH 1/9] [media] v4l: ti-vpe: " Julia Lawall
  2014-08-23 11:20 ` [PATCH 2/9] video: fbdev: matrox: " Julia Lawall
@ 2014-08-23 11:20 ` Julia Lawall
  2014-08-25  9:44   ` Thierry Reding
  2014-08-23 11:20 ` [PATCH 4/9] NFC: " Julia Lawall
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: Thierry Reding; +Cc: josh, kernel-janitors, linux-pwm, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

 drivers/pwm/pwm-lpss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
index 4df994f..441a046 100644
--- a/drivers/pwm/pwm-lpss.c
+++ b/drivers/pwm/pwm-lpss.c
@@ -45,7 +45,7 @@ struct pwm_lpss_boardinfo {
 
 /* BayTrail */
 static const struct pwm_lpss_boardinfo byt_info = {
-	25000000
+	.clk_rate = 25000000
 };
 
 static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip)


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/9] NFC: use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
                   ` (2 preceding siblings ...)
  2014-08-23 11:20 ` [PATCH 3/9] pwm: lpss: " Julia Lawall
@ 2014-08-23 11:20 ` Julia Lawall
  2014-08-23 11:20 ` [PATCH 5/9] lustre: obdclass: " Julia Lawall
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: Lauro Ramos Venancio
  Cc: josh, kernel-janitors, Aloisio Almeida Jr, Samuel Ortiz,
	linux-wireless, linux-nfc, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

 drivers/nfc/nfcwilink.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/nfc/nfcwilink.c b/drivers/nfc/nfcwilink.c
index 683671a..e83df00 100644
--- a/drivers/nfc/nfcwilink.c
+++ b/drivers/nfc/nfcwilink.c
@@ -461,7 +461,11 @@ static int nfcwilink_close(struct nci_dev *ndev)
 static int nfcwilink_send(struct nci_dev *ndev, struct sk_buff *skb)
 {
 	struct nfcwilink *drv = nci_get_drvdata(ndev);
-	struct nfcwilink_hdr hdr = {NFCWILINK_CHNL, NFCWILINK_OPCODE, 0x0000};
+	struct nfcwilink_hdr hdr = {
+		.chnl = NFCWILINK_CHNL,
+		.opcode = NFCWILINK_OPCODE,
+		.len = 0x0000
+	};
 	long len;
 
 	dev_dbg(&drv->pdev->dev, "send entry, len %d\n", skb->len);


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 5/9] lustre: obdclass: use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
                   ` (3 preceding siblings ...)
  2014-08-23 11:20 ` [PATCH 4/9] NFC: " Julia Lawall
@ 2014-08-23 11:20 ` Julia Lawall
  2014-08-23 11:20 ` [PATCH 6/9] drm: " Julia Lawall
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: josh, kernel-janitors, devel, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

 drivers/staging/lustre/lustre/obdclass/obd_mount.c      |   10 ++++++++--
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c |    5 ++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index d972f71..54ba8df 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -1276,7 +1276,10 @@ EXPORT_SYMBOL(lustre_register_kill_super_cb);
 struct dentry *lustre_mount(struct file_system_type *fs_type, int flags,
 				const char *devname, void *data)
 {
-	struct lustre_mount_data2 lmd2 = { data, NULL };
+	struct lustre_mount_data2 lmd2 = {
+		.lmd2_data = data,
+		.lmd2_mnt = NULL
+	};
 
 	return mount_nodev(fs_type, flags, &lmd2, lustre_fill_super);
 }
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 8309d4c..1c5c1c9 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1572,7 +1572,10 @@ lproc_exp_hash_seq_show(struct seq_file *m, void *unused)
 {
 	struct nid_stat *stats = (struct nid_stat *)m->private;
 	struct obd_device *obd = stats->nid_obd;
-	struct exp_hash_cb_data cb_data = {m, true};
+	struct exp_hash_cb_data cb_data = {
+		.m = m,
+		.first = true
+	};
 
 	cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
 			      lprocfs_exp_print_hash, &cb_data);


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 6/9] drm: use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
                   ` (4 preceding siblings ...)
  2014-08-23 11:20 ` [PATCH 5/9] lustre: obdclass: " Julia Lawall
@ 2014-08-23 11:20 ` Julia Lawall
  2014-08-23 15:16   ` Josh Triplett
  2014-08-23 11:20 ` [PATCH 7/9] OMAPDSS: DSI: " Julia Lawall
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: David Airlie; +Cc: josh, kernel-janitors, dri-devel, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

 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))


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 7/9] OMAPDSS: DSI: use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
                   ` (5 preceding siblings ...)
  2014-08-23 11:20 ` [PATCH 6/9] drm: " Julia Lawall
@ 2014-08-23 11:20 ` Julia Lawall
  2014-08-23 11:20 ` [PATCH 8/9] video: fbdev: aty: " Julia Lawall
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: josh, kernel-janitors, Jean-Christophe Plagniol-Villard,
	linux-omap, linux-fbdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

Not compiled.

 drivers/video/fbdev/omap2/dss/dsi.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c
index 56b9244..b6f6ae1 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -2571,7 +2571,10 @@ static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel)
 {
 	struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
 	DECLARE_COMPLETION_ONSTACK(completion);
-	struct dsi_packet_sent_handler_data vp_data = { dsidev, &completion };
+	struct dsi_packet_sent_handler_data vp_data = {
+		.dsidev = dsidev,
+		.completion = &completion
+	};
 	int r = 0;
 	u8 bit;
 
@@ -2617,7 +2620,10 @@ static void dsi_packet_sent_handler_l4(void *data, u32 mask)
 static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel)
 {
 	DECLARE_COMPLETION_ONSTACK(completion);
-	struct dsi_packet_sent_handler_data l4_data = { dsidev, &completion };
+	struct dsi_packet_sent_handler_data l4_data = {
+		.dsidev = dsidev,
+		.completion = &completion
+	};
 	int r = 0;
 
 	r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4,


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 8/9] video: fbdev: aty: use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
                   ` (6 preceding siblings ...)
  2014-08-23 11:20 ` [PATCH 7/9] OMAPDSS: DSI: " Julia Lawall
@ 2014-08-23 11:20 ` Julia Lawall
  2014-08-23 15:20   ` Josh Triplett
  2014-08-23 11:20 ` [PATCH 9/9] rtc: " Julia Lawall
  2014-08-23 15:21 ` [PATCH 0/9] " Josh Triplett
  9 siblings, 1 reply; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: josh, kernel-janitors, Jean-Christophe Plagniol-Villard,
	Tomi Valkeinen, linux-fbdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

 drivers/video/fbdev/aty/aty128fb.c |   59 +++++++++++++++++++++++++++++++------
 1 file changed, 51 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index ff60701..5a72fbd 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -324,14 +324,57 @@ struct aty128_meminfo {
 };
 
 /* various memory configurations */
-static const struct aty128_meminfo sdr_128   =
-	{ 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" };
-static const struct aty128_meminfo sdr_64    =
-	{ 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" };
-static const struct aty128_meminfo sdr_sgram =
-	{ 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" };
-static const struct aty128_meminfo ddr_sgram =
-	{ 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
+static const struct aty128_meminfo sdr_128 = {
+	.ML = 4,
+	.MB = 4,
+	.Trcd = 3,
+	.Trp = 3,
+	.Twr = 1,
+	.CL = 3,
+	.Tr2w = 1,
+	.LoopLatency = 16,
+	.DspOn = 30,
+	.Rloop = 16,
+	.name = "128-bit SDR SGRAM (1:1)" };
+
+static const struct aty128_meminfo sdr_64 = {
+	.ML = 4,
+	.MB = 8,
+	.Trcd = 3,
+	.Trp = 3,
+	.Twr = 1,
+	.CL = 3,
+	.Tr2w = 1,
+	.LoopLatency = 17,
+	.DspOn = 46,
+	.Rloop = 17,
+	.name = "64-bit SDR SGRAM (1:1)" };
+
+static const struct aty128_meminfo sdr_sgram = {
+	.ML = 4,
+	.MB = 4,
+	.Trcd = 1,
+	.Trp = 2,
+	.Twr = 1,
+	.CL = 2,
+	.Tr2w = 1,
+	.LoopLatency = 16,
+	.DspOn = 24,
+	.Rloop = 16,
+	.name = "64-bit SDR SGRAM (2:1)" };
+
+static const struct aty128_meminfo ddr_sgram = {
+	.ML = 4,
+	.MB = 4,
+	.Trcd = 3,
+	.Trp = 3,
+	.Twr = 2,
+	.CL = 3,
+	.Tr2w = 1,
+	.LoopLatency = 16,
+	.DspOn = 31,
+	.Rloop = 16,
+	.name = "64-bit DDR SGRAM" };
 
 static struct fb_fix_screeninfo aty128fb_fix = {
 	.id		= "ATY Rage128",


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 9/9] rtc: use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
                   ` (7 preceding siblings ...)
  2014-08-23 11:20 ` [PATCH 8/9] video: fbdev: aty: " Julia Lawall
@ 2014-08-23 11:20 ` Julia Lawall
  2014-08-23 15:21 ` [PATCH 0/9] " Josh Triplett
  9 siblings, 0 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: Alessandro Zummo; +Cc: josh, kernel-janitors, rtc-linux, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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.

 drivers/rtc/rtc-pcf8583.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c
index c263984..5911a6d 100644
--- a/drivers/rtc/rtc-pcf8583.c
+++ b/drivers/rtc/rtc-pcf8583.c
@@ -176,7 +176,11 @@ static int pcf8583_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	unsigned char ctrl, year[2];
-	struct rtc_mem mem = { CMOS_YEAR, sizeof(year), year };
+	struct rtc_mem mem = {
+		.loc = CMOS_YEAR,
+		.nr = sizeof(year),
+		.data = year
+	};
 	int real_year, year_offset, err;
 
 	/*
@@ -222,8 +226,16 @@ static int pcf8583_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	unsigned char year[2], chk;
-	struct rtc_mem cmos_year  = { CMOS_YEAR, sizeof(year), year };
-	struct rtc_mem cmos_check = { CMOS_CHECKSUM, 1, &chk };
+	struct rtc_mem cmos_year  = {
+		.loc = CMOS_YEAR,
+		.nr = sizeof(year),
+		.data = year
+	};
+	struct rtc_mem cmos_check = {
+		.loc = CMOS_CHECKSUM,
+		.nr = 1,
+		.data = &chk
+	};
 	unsigned int proper_year = tm->tm_year + 1900;
 	int ret;
 


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 6/9] drm: use c99 initializers in structures
  2014-08-23 11:20 ` [PATCH 6/9] drm: " Julia Lawall
@ 2014-08-23 15:16   ` Josh Triplett
  2014-08-23 16:09     ` [PATCH 6/9 v2] " Julia Lawall
  0 siblings, 1 reply; 22+ messages in thread
From: Josh Triplett @ 2014-08-23 15:16 UTC (permalink / raw)
  To: Julia Lawall; +Cc: David Airlie, kernel-janitors, dri-devel, linux-kernel

On Sat, Aug 23, 2014 at 01:20:28PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Use c99 initializers for structures.
> 
> A simplified version of the semantic match that finds this 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>

For this patch, I think it would make sense to drop
initializations of preferred/quirks/modes to 0, since a designated
initializer may skip fields to leave them initialized to 0.

With that change:
Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> 
>  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))
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 8/9] video: fbdev: aty: use c99 initializers in structures
  2014-08-23 11:20 ` [PATCH 8/9] video: fbdev: aty: " Julia Lawall
@ 2014-08-23 15:20   ` Josh Triplett
  2014-08-23 15:32     ` Julia Lawall
  2014-08-23 15:50     ` [PATCH 8/9 v2] " Julia Lawall
  0 siblings, 2 replies; 22+ messages in thread
From: Josh Triplett @ 2014-08-23 15:20 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Paul Mackerras, kernel-janitors,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
	linux-kernel

On Sat, Aug 23, 2014 at 01:20:30PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Use c99 initializers for structures.
> 
> A simplified version of the semantic match that finds this 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>

One comment below about formatting.  With that addressed:
Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> --- a/drivers/video/fbdev/aty/aty128fb.c
> +++ b/drivers/video/fbdev/aty/aty128fb.c
> @@ -324,14 +324,57 @@ struct aty128_meminfo {
>  };
>  
>  /* various memory configurations */
> -static const struct aty128_meminfo sdr_128   =
> -	{ 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" };
> -static const struct aty128_meminfo sdr_64    =
> -	{ 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" };
> -static const struct aty128_meminfo sdr_sgram =
> -	{ 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" };
> -static const struct aty128_meminfo ddr_sgram =
> -	{ 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
> +static const struct aty128_meminfo sdr_128 = {
> +	.ML = 4,
> +	.MB = 4,
> +	.Trcd = 3,
> +	.Trp = 3,
> +	.Twr = 1,
> +	.CL = 3,
> +	.Tr2w = 1,
> +	.LoopLatency = 16,
> +	.DspOn = 30,
> +	.Rloop = 16,
> +	.name = "128-bit SDR SGRAM (1:1)" };

The closing brace should be in column 0 of the next line.  Also, the
final field initializer should have a comma after it. (Likewise for the
remaining changes in this file.)

- Josh Triplett

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/9] use c99 initializers in structures
  2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
                   ` (8 preceding siblings ...)
  2014-08-23 11:20 ` [PATCH 9/9] rtc: " Julia Lawall
@ 2014-08-23 15:21 ` Josh Triplett
  9 siblings, 0 replies; 22+ messages in thread
From: Josh Triplett @ 2014-08-23 15:21 UTC (permalink / raw)
  To: Julia Lawall
  Cc: dri-devel, kernel-janitors, linux-nfc, linux-wireless,
	linux-fbdev, linux-kernel, linux-media, linux-pwm, devel,
	linux-omap, rtc-linux

On Sat, Aug 23, 2014 at 01:20:22PM +0200, Julia Lawall wrote:
> These patches add labels in the initializations of structure fields (c99
> initializers).  The complete semantic patch thta makes this change is shown
> below.  This rule ignores cases where the initialization is just 0 or NULL,
> where some of the fields already use labels, and where there are nested
> structures.

I responded to patches 6 and 8 with comments; for the rest (1-5, 7, 9):
Reviewed-by: Josh Triplett <josh@joshtriplett.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 8/9] video: fbdev: aty: use c99 initializers in structures
  2014-08-23 15:20   ` Josh Triplett
@ 2014-08-23 15:32     ` Julia Lawall
  2014-08-23 16:03       ` Josh Triplett
  2014-08-25 10:16       ` Dan Carpenter
  2014-08-23 15:50     ` [PATCH 8/9 v2] " Julia Lawall
  1 sibling, 2 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 15:32 UTC (permalink / raw)
  To: Josh Triplett
  Cc: Paul Mackerras, kernel-janitors,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
	linux-kernel



On Sat, 23 Aug 2014, Josh Triplett wrote:

> On Sat, Aug 23, 2014 at 01:20:30PM +0200, Julia Lawall wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> > 
> > Use c99 initializers for structures.
> > 
> > A simplified version of the semantic match that finds this 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>
> 
> One comment below about formatting.  With that addressed:
> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
> 
> > --- a/drivers/video/fbdev/aty/aty128fb.c
> > +++ b/drivers/video/fbdev/aty/aty128fb.c
> > @@ -324,14 +324,57 @@ struct aty128_meminfo {
> >  };
> >  
> >  /* various memory configurations */
> > -static const struct aty128_meminfo sdr_128   =
> > -	{ 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" };
> > -static const struct aty128_meminfo sdr_64    =
> > -	{ 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" };
> > -static const struct aty128_meminfo sdr_sgram =
> > -	{ 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" };
> > -static const struct aty128_meminfo ddr_sgram =
> > -	{ 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
> > +static const struct aty128_meminfo sdr_128 = {
> > +	.ML = 4,
> > +	.MB = 4,
> > +	.Trcd = 3,
> > +	.Trp = 3,
> > +	.Twr = 1,
> > +	.CL = 3,
> > +	.Tr2w = 1,
> > +	.LoopLatency = 16,
> > +	.DspOn = 30,
> > +	.Rloop = 16,
> > +	.name = "128-bit SDR SGRAM (1:1)" };
> 
> The closing brace should be in column 0 of the next line.  Also, the
> final field initializer should have a comma after it. (Likewise for the
> remaining changes in this file.)

In general, I haven't changed the presence or absence of trailing commas.  
Should I add them everywhere?

julia

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 8/9 v2] video: fbdev: aty: use c99 initializers in structures
  2014-08-23 15:20   ` Josh Triplett
  2014-08-23 15:32     ` Julia Lawall
@ 2014-08-23 15:50     ` Julia Lawall
  2014-08-23 16:03       ` Josh Triplett
  2014-08-26 10:43       ` Tomi Valkeinen
  1 sibling, 2 replies; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 15:50 UTC (permalink / raw)
  To: Josh Triplett
  Cc: Paul Mackerras, kernel-janitors,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
	linux-kernel

>From nobody Sat Aug 23 12:48:19 CEST 2014
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Paul Mackerras <paulus@samba.org>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,Tomi Valkeinen <tomi.valkeinen@ti.com>,linux-fbdev@vger.kernel.org,linux-kernel@vger.kernel.org
Subject: [PATCH 8/9] video: fbdev: aty: use c99 initializers in structures

From: Julia Lawall <Julia.Lawall@lip6.fr>

Use c99 initializers for structures.

A simplified version of the semantic match that finds this 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: Move close braces down to the next line and add trailing commas, as 
suggested by Josh Triplett.

diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index ff60701..aedf2fb 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -324,14 +324,61 @@ struct aty128_meminfo {
 };
 
 /* various memory configurations */
-static const struct aty128_meminfo sdr_128   =
-	{ 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" };
-static const struct aty128_meminfo sdr_64    =
-	{ 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" };
-static const struct aty128_meminfo sdr_sgram =
-	{ 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" };
-static const struct aty128_meminfo ddr_sgram =
-	{ 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
+static const struct aty128_meminfo sdr_128 = {
+	.ML = 4,
+	.MB = 4,
+	.Trcd = 3,
+	.Trp = 3,
+	.Twr = 1,
+	.CL = 3,
+	.Tr2w = 1,
+	.LoopLatency = 16,
+	.DspOn = 30,
+	.Rloop = 16,
+	.name = "128-bit SDR SGRAM (1:1)",
+};
+
+static const struct aty128_meminfo sdr_64 = {
+	.ML = 4,
+	.MB = 8,
+	.Trcd = 3,
+	.Trp = 3,
+	.Twr = 1,
+	.CL = 3,
+	.Tr2w = 1,
+	.LoopLatency = 17,
+	.DspOn = 46,
+	.Rloop = 17,
+	.name = "64-bit SDR SGRAM (1:1)",
+};
+
+static const struct aty128_meminfo sdr_sgram = {
+	.ML = 4,
+	.MB = 4,
+	.Trcd = 1,
+	.Trp = 2,
+	.Twr = 1,
+	.CL = 2,
+	.Tr2w = 1,
+	.LoopLatency = 16,
+	.DspOn = 24,
+	.Rloop = 16,
+	.name = "64-bit SDR SGRAM (2:1)",
+};
+
+static const struct aty128_meminfo ddr_sgram = {
+	.ML = 4,
+	.MB = 4,
+	.Trcd = 3,
+	.Trp = 3,
+	.Twr = 2,
+	.CL = 3,
+	.Tr2w = 1,
+	.LoopLatency = 16,
+	.DspOn = 31,
+	.Rloop = 16,
+	.name = "64-bit DDR SGRAM",
+};
 
 static struct fb_fix_screeninfo aty128fb_fix = {
 	.id		= "ATY Rage128",

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 8/9] video: fbdev: aty: use c99 initializers in structures
  2014-08-23 15:32     ` Julia Lawall
@ 2014-08-23 16:03       ` Josh Triplett
  2014-08-25 10:16       ` Dan Carpenter
  1 sibling, 0 replies; 22+ messages in thread
From: Josh Triplett @ 2014-08-23 16:03 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Paul Mackerras, kernel-janitors,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
	linux-kernel

On Sat, Aug 23, 2014 at 05:32:37PM +0200, Julia Lawall wrote:
> On Sat, 23 Aug 2014, Josh Triplett wrote:
> > On Sat, Aug 23, 2014 at 01:20:30PM +0200, Julia Lawall wrote:
> > > From: Julia Lawall <Julia.Lawall@lip6.fr>
> > > 
> > > Use c99 initializers for structures.
> > > 
> > > A simplified version of the semantic match that finds this 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>
> > 
> > One comment below about formatting.  With that addressed:
> > Reviewed-by: Josh Triplett <josh@joshtriplett.org>
> > 
> > > --- a/drivers/video/fbdev/aty/aty128fb.c
> > > +++ b/drivers/video/fbdev/aty/aty128fb.c
> > > @@ -324,14 +324,57 @@ struct aty128_meminfo {
> > >  };
> > >  
> > >  /* various memory configurations */
> > > -static const struct aty128_meminfo sdr_128   =
> > > -	{ 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" };
> > > -static const struct aty128_meminfo sdr_64    =
> > > -	{ 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" };
> > > -static const struct aty128_meminfo sdr_sgram =
> > > -	{ 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" };
> > > -static const struct aty128_meminfo ddr_sgram =
> > > -	{ 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
> > > +static const struct aty128_meminfo sdr_128 = {
> > > +	.ML = 4,
> > > +	.MB = 4,
> > > +	.Trcd = 3,
> > > +	.Trp = 3,
> > > +	.Twr = 1,
> > > +	.CL = 3,
> > > +	.Tr2w = 1,
> > > +	.LoopLatency = 16,
> > > +	.DspOn = 30,
> > > +	.Rloop = 16,
> > > +	.name = "128-bit SDR SGRAM (1:1)" };
> > 
> > The closing brace should be in column 0 of the next line.  Also, the
> > final field initializer should have a comma after it. (Likewise for the
> > remaining changes in this file.)
> 
> In general, I haven't changed the presence or absence of trailing commas.  
> Should I add them everywhere?

In general, I'd suggest using trailing commas; they make the initializer
order no longer matter, and avoid the need to patch the last line if
adding another initializer.  However, I wouldn't suggest going out of
your way to change existing initializers, just adding them as part of
initializers you're changing already.

- Josh Triplett

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 8/9 v2] video: fbdev: aty: use c99 initializers in structures
  2014-08-23 15:50     ` [PATCH 8/9 v2] " Julia Lawall
@ 2014-08-23 16:03       ` Josh Triplett
  2014-08-26 10:43       ` Tomi Valkeinen
  1 sibling, 0 replies; 22+ messages in thread
From: Josh Triplett @ 2014-08-23 16:03 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Paul Mackerras, kernel-janitors,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
	linux-kernel

On Sat, Aug 23, 2014 at 05:50:28PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Use c99 initializers for structures.
> 
> A simplified version of the semantic match that finds this 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>

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> v2: Move close braces down to the next line and add trailing commas, as 
> suggested by Josh Triplett.
> 
> diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
> index ff60701..aedf2fb 100644
> --- a/drivers/video/fbdev/aty/aty128fb.c
> +++ b/drivers/video/fbdev/aty/aty128fb.c
> @@ -324,14 +324,61 @@ struct aty128_meminfo {
>  };
>  
>  /* various memory configurations */
> -static const struct aty128_meminfo sdr_128   =
> -	{ 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" };
> -static const struct aty128_meminfo sdr_64    =
> -	{ 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" };
> -static const struct aty128_meminfo sdr_sgram =
> -	{ 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" };
> -static const struct aty128_meminfo ddr_sgram =
> -	{ 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
> +static const struct aty128_meminfo sdr_128 = {
> +	.ML = 4,
> +	.MB = 4,
> +	.Trcd = 3,
> +	.Trp = 3,
> +	.Twr = 1,
> +	.CL = 3,
> +	.Tr2w = 1,
> +	.LoopLatency = 16,
> +	.DspOn = 30,
> +	.Rloop = 16,
> +	.name = "128-bit SDR SGRAM (1:1)",
> +};
> +
> +static const struct aty128_meminfo sdr_64 = {
> +	.ML = 4,
> +	.MB = 8,
> +	.Trcd = 3,
> +	.Trp = 3,
> +	.Twr = 1,
> +	.CL = 3,
> +	.Tr2w = 1,
> +	.LoopLatency = 17,
> +	.DspOn = 46,
> +	.Rloop = 17,
> +	.name = "64-bit SDR SGRAM (1:1)",
> +};
> +
> +static const struct aty128_meminfo sdr_sgram = {
> +	.ML = 4,
> +	.MB = 4,
> +	.Trcd = 1,
> +	.Trp = 2,
> +	.Twr = 1,
> +	.CL = 2,
> +	.Tr2w = 1,
> +	.LoopLatency = 16,
> +	.DspOn = 24,
> +	.Rloop = 16,
> +	.name = "64-bit SDR SGRAM (2:1)",
> +};
> +
> +static const struct aty128_meminfo ddr_sgram = {
> +	.ML = 4,
> +	.MB = 4,
> +	.Trcd = 3,
> +	.Trp = 3,
> +	.Twr = 2,
> +	.CL = 3,
> +	.Tr2w = 1,
> +	.LoopLatency = 16,
> +	.DspOn = 31,
> +	.Rloop = 16,
> +	.name = "64-bit DDR SGRAM",
> +};
>  
>  static struct fb_fix_screeninfo aty128fb_fix = {
>  	.id		= "ATY Rage128",

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 6/9 v2] drm: use c99 initializers in structures
  2014-08-23 15:16   ` Josh Triplett
@ 2014-08-23 16:09     ` Julia Lawall
  2014-08-25 13:18       ` Daniel Vetter
  0 siblings, 1 reply; 22+ messages in thread
From: Julia Lawall @ 2014-08-23 16:09 UTC (permalink / raw)
  To: Josh Triplett; +Cc: David Airlie, kernel-janitors, dri-devel, linux-kernel

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.

 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))

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/9] pwm: lpss: use c99 initializers in structures
  2014-08-23 11:20 ` [PATCH 3/9] pwm: lpss: " Julia Lawall
@ 2014-08-25  9:44   ` Thierry Reding
  0 siblings, 0 replies; 22+ messages in thread
From: Thierry Reding @ 2014-08-25  9:44 UTC (permalink / raw)
  To: Julia Lawall; +Cc: josh, kernel-janitors, linux-pwm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

On Sat, Aug 23, 2014 at 01:20:25PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Use c99 initializers for structures.
> 
> A simplified version of the semantic match that finds this 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.
> 
>  drivers/pwm/pwm-lpss.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
> index 4df994f..441a046 100644
> --- a/drivers/pwm/pwm-lpss.c
> +++ b/drivers/pwm/pwm-lpss.c
> @@ -45,7 +45,7 @@ struct pwm_lpss_boardinfo {
>  
>  /* BayTrail */
>  static const struct pwm_lpss_boardinfo byt_info = {
> -	25000000
> +	.clk_rate = 25000000
>  };
>  
>  static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip)

I've applied this patch to the for-next branch of the PWM tree. There
was a conflict due to a patch that was recently applied, but it was
trivial to fix it up, so I did.

Thanks,
Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 8/9] video: fbdev: aty: use c99 initializers in structures
  2014-08-23 15:32     ` Julia Lawall
  2014-08-23 16:03       ` Josh Triplett
@ 2014-08-25 10:16       ` Dan Carpenter
  1 sibling, 0 replies; 22+ messages in thread
From: Dan Carpenter @ 2014-08-25 10:16 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Josh Triplett, Paul Mackerras, kernel-janitors,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
	linux-kernel

On Sat, Aug 23, 2014 at 05:32:37PM +0200, Julia Lawall wrote:
> > 
> > The closing brace should be in column 0 of the next line.  Also, the
> > final field initializer should have a comma after it. (Likewise for the
> > remaining changes in this file.)
> 
> In general, I haven't changed the presence or absence of trailing commas.
> Should I add them everywhere?

Probably, yeah.  Trailing commas are better.

It's not worth resending, but the script should add them I think.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 6/9 v2] drm: use c99 initializers in structures
  2014-08-23 16:09     ` [PATCH 6/9 v2] " Julia Lawall
@ 2014-08-25 13:18       ` Daniel Vetter
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2014-08-25 13:18 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Josh Triplett, kernel-janitors, linux-kernel, dri-devel

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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 8/9 v2] video: fbdev: aty: use c99 initializers in structures
  2014-08-23 15:50     ` [PATCH 8/9 v2] " Julia Lawall
  2014-08-23 16:03       ` Josh Triplett
@ 2014-08-26 10:43       ` Tomi Valkeinen
  1 sibling, 0 replies; 22+ messages in thread
From: Tomi Valkeinen @ 2014-08-26 10:43 UTC (permalink / raw)
  To: Julia Lawall, Josh Triplett
  Cc: Paul Mackerras, kernel-janitors,
	Jean-Christophe Plagniol-Villard, linux-fbdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

Hi,

On 23/08/14 18:50, Julia Lawall wrote:
> From nobody Sat Aug 23 12:48:19 CEST 2014
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> To: Paul Mackerras <paulus@samba.org>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,Tomi Valkeinen <tomi.valkeinen@ti.com>,linux-fbdev@vger.kernel.org,linux-kernel@vger.kernel.org
> Subject: [PATCH 8/9] video: fbdev: aty: use c99 initializers in structures
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Use c99 initializers for structures.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)

This mail had some extra stuff above (From nobody... etc). I cleaned it
up, hopefully correctly.

I've applied the fbdev patches from this series, 2, 7 and 8, for v3.18.

Thanks!

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2014-08-26 10:43 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-23 11:20 [PATCH 0/9] use c99 initializers in structures Julia Lawall
2014-08-23 11:20 ` [PATCH 1/9] [media] v4l: ti-vpe: " Julia Lawall
2014-08-23 11:20 ` [PATCH 2/9] video: fbdev: matrox: " Julia Lawall
2014-08-23 11:20 ` [PATCH 3/9] pwm: lpss: " Julia Lawall
2014-08-25  9:44   ` Thierry Reding
2014-08-23 11:20 ` [PATCH 4/9] NFC: " Julia Lawall
2014-08-23 11:20 ` [PATCH 5/9] lustre: obdclass: " Julia Lawall
2014-08-23 11:20 ` [PATCH 6/9] drm: " Julia Lawall
2014-08-23 15:16   ` Josh Triplett
2014-08-23 16:09     ` [PATCH 6/9 v2] " Julia Lawall
2014-08-25 13:18       ` Daniel Vetter
2014-08-23 11:20 ` [PATCH 7/9] OMAPDSS: DSI: " Julia Lawall
2014-08-23 11:20 ` [PATCH 8/9] video: fbdev: aty: " Julia Lawall
2014-08-23 15:20   ` Josh Triplett
2014-08-23 15:32     ` Julia Lawall
2014-08-23 16:03       ` Josh Triplett
2014-08-25 10:16       ` Dan Carpenter
2014-08-23 15:50     ` [PATCH 8/9 v2] " Julia Lawall
2014-08-23 16:03       ` Josh Triplett
2014-08-26 10:43       ` Tomi Valkeinen
2014-08-23 11:20 ` [PATCH 9/9] rtc: " Julia Lawall
2014-08-23 15:21 ` [PATCH 0/9] " Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).