[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170118104936.GJ18989@ulmo.ba.sec>
Date: Wed, 18 Jan 2017 11:49:36 +0100
From: Thierry Reding <thierry.reding@...il.com>
To: Bhumika Goyal <bhumirks@...il.com>
Cc: julia.lawall@...6.fr, linux@...sktech.co.nz,
linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] pwm: constify pwm_ops structures
On Tue, Jan 10, 2017 at 11:42:06PM +0530, Bhumika Goyal wrote:
> Declare pwm_ops structures as const as they are only stored in the ops
> field of a pwm_chip structure. This field is of type const struct pwm_ops
> *, so pwm_ops structures having this property can be declared as const.
> Done using Coccinelle:
>
> @r1 disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct pwm_ops i@......};
>
> @ok1@
> identifier r1.i;
> position p;
> struct pxa_pwm_chip pwm;
> struct bfin_pwm_chip bwm;
> struct vt8500_chip vp;
> struct imx_chip icp;
> @@
> (
> pwm.chip.ops=&i@p
> |
> bwm.chip.ops=&i@p
> |
> vp.chip.ops=&i@p
> |
> icp.chip.ops=&i@p
> )
>
> @bad@
> position p!={r1.p,ok1.p};
> identifier r1.i;
> @@
> i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> +const
> struct pwm_ops i;
>
> File size details:
>
> text data bss dec hex filename
> 1646 328 0 1974 7b6 drivers/pwm/pwm-imx.o
> 1742 224 0 1966 7ae drivers/pwm/pwm-imx.o
>
> 1941 296 0 2237 8bd drivers/pwm/pwm-pxa.o
> 2037 192 0 2229 8b5 drivers/pwm/pwm-pxa.o
>
> 1946 296 0 2242 8c2 drivers/pwm/pwm-vt8500.o
> 2050 192 0 2242 8c2 drivers/pwm/pwm-vt8500.o
>
> The drivers/pwm/pwm-bfin.o file did not compile.
>
> Signed-off-by: Bhumika Goyal <bhumirks@...il.com>
> ---
> File: drivers/pwm/pwm-bfin.c is not tested
>
> drivers/pwm/pwm-bfin.c | 2 +-
> drivers/pwm/pwm-imx.c | 2 +-
> drivers/pwm/pwm-pxa.c | 2 +-
> drivers/pwm/pwm-vt8500.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
Applied, thanks.
Thierry
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists