linux-pwm.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 3/9] pwm: lpss: " Julia Lawall
  2014-08-23 15:21 ` [PATCH 0/9] " Josh Triplett
  0 siblings, 2 replies; 4+ 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] 4+ 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 ` Julia Lawall
  2014-08-25  9:44   ` Thierry Reding
  2014-08-23 15:21 ` [PATCH 0/9] " Josh Triplett
  1 sibling, 1 reply; 4+ 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] 4+ 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 3/9] pwm: lpss: " Julia Lawall
@ 2014-08-23 15:21 ` Josh Triplett
  1 sibling, 0 replies; 4+ 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] 4+ 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; 4+ 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] 4+ messages in thread

end of thread, other threads:[~2014-08-25  9:44 UTC | newest]

Thread overview: 4+ 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 3/9] pwm: lpss: " Julia Lawall
2014-08-25  9:44   ` Thierry Reding
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).