Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1705471
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] watchdog: constify watchdog_ops and watchdog_info structures |
| Date | 2017-08-07 15:00 +0200 |
| Message-ID | <ubPNx-8kD-25@gated-at.bofh.it> (permalink) |
| References | <uawad-5UG-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Aug 3, 2017 at 11:21 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> These watchdog_ops and watchdog_info structures are only stored
> in the ops and info fields of a watchdog_device structure,
> respectively, which are const. Thus make the watchdog_ops and
> watchdog_info structures const as well.
>
> Done with the help of Coccinelle. The rules for the watchdog_ops case are
> as follows:
>
> // <smpl>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct watchdog_ops i@p = { ... };
>
> @ok@
> identifier r.i;
> struct watchdog_device e;
> position p;
> @@
> e.ops = &i@p;
>
> @bad@
> position p != {r.p,ok.p};
> identifier r.i;
> struct watchdog_ops e;
> @@
> e@i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
> struct watchdog_ops i = { ... };
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] watchdog: constify watchdog_ops and watchdog_info structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-08-03 23:50 +0200 Re: [PATCH] watchdog: constify watchdog_ops and watchdog_info structures Linus Walleij <linus.walleij@linaro.org> - 2017-08-07 15:00 +0200
csiph-web