public inbox for linux-omap@vger.kernel.org
 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 7/9] OMAPDSS: DSI: " Julia Lawall
  2014-08-23 15:21 ` [PATCH 0/9] " Josh Triplett
  0 siblings, 2 replies; 3+ messages in thread
From: Julia Lawall @ 2014-08-23 11:20 UTC (permalink / raw)
  To: dri-devel
  Cc: devel, linux-pwm, linux-fbdev, rtc-linux, linux-nfc,
	kernel-janitors, linux-wireless, josh, linux-kernel, linux-omap,
	linux-media

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] 3+ 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
@ 2014-08-23 11:20 ` Julia Lawall
  2014-08-23 15:21 ` [PATCH 0/9] " Josh Triplett
  1 sibling, 0 replies; 3+ 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] 3+ 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
  2014-08-23 11:20 ` [PATCH 7/9] OMAPDSS: DSI: " Julia Lawall
@ 2014-08-23 15:21 ` Josh Triplett
  1 sibling, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2014-08-23 15:21 UTC | newest]

Thread overview: 3+ 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 7/9] OMAPDSS: DSI: " 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