Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1475441

Re: [PATCH] rtc: constify rtc_class_ops structures

From Alexandre Belloni <alexandre.belloni@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH] rtc: constify rtc_class_ops structures
Date 2016-09-02 22:40 +0200
Message-ID <sd3pL-4ey-19@gated-at.bofh.it> (permalink)
References <sc94e-8tQ-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 31/08/2016 at 10:05:25 +0200, Julia Lawall wrote :
> Check for rtc_class_ops structures that are only passed to
> devm_rtc_device_register, rtc_device_register,
> platform_device_register_data, all of which declare the corresponding
> parameter as const.  Declare rtc_class_ops structures that have these
> properties as const.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct rtc_class_ops i@p = { ... };
> 
> @ok@
> identifier r.i;
> expression e1,e2,e3,e4;
> position p;
> @@
> (
> devm_rtc_device_register(e1,e2,&i@p,e3)
> |
> rtc_device_register(e1,e2,&i@p,e3)
> |
> platform_device_register_data(e1,e2,e3,&i@p,e4)
> )
> 
> @bad@
> position p != {r.p,ok.p};
> identifier r.i;
> @@
> i@p
> 
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
>  struct rtc_class_ops i = { ... };
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/rtc/rtc-at32ap700x.c |    2 +-
>  drivers/rtc/rtc-coh901331.c  |    2 +-
>  drivers/rtc/rtc-davinci.c    |    2 +-
>  drivers/rtc/rtc-digicolor.c  |    2 +-
>  drivers/rtc/rtc-ds1302.c     |    2 +-
>  drivers/rtc/rtc-gemini.c     |    2 +-
>  drivers/rtc/rtc-jz4740.c     |    2 +-
>  drivers/rtc/rtc-mcp795.c     |    2 +-
>  drivers/rtc/rtc-mt6397.c     |    2 +-
>  drivers/rtc/rtc-nuc900.c     |    2 +-
>  drivers/rtc/rtc-omap.c       |    2 +-
>  drivers/rtc/rtc-palmas.c     |    2 +-
>  drivers/rtc/rtc-pcf50633.c   |    2 +-
>  drivers/rtc/rtc-rx6110.c     |    2 +-
>  drivers/rtc/rtc-rx8025.c     |    2 +-
>  drivers/rtc/rtc-spear.c      |    2 +-
>  drivers/rtc/rtc-stmp3xxx.c   |    2 +-
>  drivers/rtc/rtc-tegra.c      |    2 +-
>  drivers/rtc/rtc-twl.c        |    2 +-
>  19 files changed, 19 insertions(+), 19 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] rtc: constify rtc_class_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-08-31 10:30 +0200
  Re: [PATCH] rtc: constify rtc_class_ops structures Baruch Siach <baruch@tkos.co.il> - 2016-08-31 20:00 +0200
  Re: [PATCH] rtc: constify rtc_class_ops structures Hans Ulli Kroll <ulli.kroll@googlemail.com> - 2016-09-01 12:30 +0200
  Re: [PATCH] rtc: constify rtc_class_ops structures Linus Walleij <linus.walleij@linaro.org> - 2016-09-01 12:40 +0200
  Re: [PATCH] rtc: constify rtc_class_ops structures Thierry Reding <thierry.reding@gmail.com> - 2016-09-01 13:40 +0200
  Re: [PATCH] rtc: constify rtc_class_ops structures Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-09-02 22:40 +0200

csiph-web