diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2017-08-03 23:21:31 +0200 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2017-09-09 20:29:53 +0200 |
commit | 323edb2e27e8e02b0ce25e7caa8288a90a438b99 (patch) | |
tree | d2ba52987dd3e544921debf539074873f4fcc961 /drivers/watchdog/diag288_wdt.c | |
parent | d94fa4655ed79784388cb49c17c5e9967ddfb4b9 (diff) | |
download | lwn-323edb2e27e8e02b0ce25e7caa8288a90a438b99.tar.gz lwn-323edb2e27e8e02b0ce25e7caa8288a90a438b99.zip |
watchdog: constify watchdog_ops and watchdog_info structures
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>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/diag288_wdt.c')
-rw-r--r-- | drivers/watchdog/diag288_wdt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c index 6f591084bb7a..806a04a676b7 100644 --- a/drivers/watchdog/diag288_wdt.c +++ b/drivers/watchdog/diag288_wdt.c @@ -213,7 +213,7 @@ static const struct watchdog_ops wdt_ops = { .set_timeout = wdt_set_timeout, }; -static struct watchdog_info wdt_info = { +static const struct watchdog_info wdt_info = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .firmware_version = 0, .identity = "z Watchdog", |