linux-wireless.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 4/9] NFC: " 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: 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] 3+ 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
@ 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: 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] 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 4/9] NFC: " 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 4/9] NFC: " 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).