[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdZ1WwqakQs1b4fjH_6T6jaox61RdabRSAWNC5_9o2osKA@mail.gmail.com>
Date: Mon, 7 Aug 2017 14:56:44 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Julia Lawall <Julia.Lawall@...6.fr>
Cc: Wim Van Sebroeck <wim@...ana.be>, kernel-janitors@...r.kernel.org,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Alexandre Torgue <alexandre.torgue@...com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Guenter Roeck <linux@...ck-us.net>,
LINUXWATCHDOG <linux-watchdog@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] watchdog: constify watchdog_ops and watchdog_info structures
On Thu, Aug 3, 2017 at 11:21 PM, Julia Lawall <Julia.Lawall@...6.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@...6.fr>
Acked-by: Linus Walleij <linus.walleij@...aro.org>
Yours,
Linus Walleij
Powered by blists - more mailing lists