* [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
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 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 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: 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] 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 1/9] [media] v4l: ti-vpe: " 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 1/9] [media] v4l: ti-vpe: " 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