diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2017-01-28 13:11:17 +0530 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2017-02-24 14:00:23 -0800 |
commit | b893e344bfbd01a3df5df32ecb9f7bf8f1271d46 (patch) | |
tree | 7b88bb84140a7bd17b13696fe094264001cc07a9 /drivers/watchdog/mt7621_wdt.c | |
parent | bb292ac1c6028344013309a309b44dc691581825 (diff) | |
download | lwn-b893e344bfbd01a3df5df32ecb9f7bf8f1271d46.tar.gz lwn-b893e344bfbd01a3df5df32ecb9f7bf8f1271d46.zip |
watchdog: constify watchdog_ops structures
Declare watchdog_ops structures as const as they are only stored in the
ops field of a watchdog_device structure. This field is of type const, so
watchdog_ops structures having this property can be made const too.
Done using Coccinelle:
@r disable optional_qualifier@
identifier x;
position p;
@@
static struct watchdog_ops x@p={...};
@ok@
struct watchdog_device w;
identifier r.x;
position p;
@@
w.ops=&x@p;
@bad@
position p != {r.p,ok.p};
identifier r.x;
@@
x@p
@depends on !bad disable optional_qualifier@
identifier r.x;
@@
+const
struct watchdog_ops x;
File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.
text data bss dec hex filename
1340 544 0 1884 75c drivers/watchdog/bcm_kona_wdt.o
1436 440 0 1876 754 drivers/watchdog/bcm_kona_wdt.o
1176 544 4 1724 6bc drivers/watchdog/digicolor_wdt.o
1272 440 4 1716 6b4 drivers/watchdog/digicolor_wdt.o
925 580 89 1594 63a drivers/watchdog/ep93xx_wdt.o
1021 476 89 1586 632 drivers/watchdog/ep93xx_wdt.o
4932 288 17 5237 1475 drivers/watchdog/s3c2410_wdt.o
5028 192 17 5237 1475 drivers/watchdog/s3c2410_wdt.o
1977 292 1 2270 8de drivers/watchdog/sama5d4_wdt.o
2073 196 1 2270 8de drivers/watchdog/sama5d4_wdt.o
1375 484 1 1860 744 drivers/watchdog/sirfsoc_wdt.o
1471 380 1 1852 73c drivers/watchdog/sirfsoc_wdt.o
Size remains the same for the files drivers/watchdog/diag288_wdt.o
drivers/watchdog/asm9260_wdt.o and drivers/watchdog/atlas7_wdt.o
The following .o files did not compile:
drivers/watchdog/sun4v_wdt.o, drivers/watchdog/sbsa_gwdt.o,
drivers/watchdog/rt2880_wdt.o, drivers/watchdog/booke_wdt.o
drivers/watchdog/mt7621_wdt.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/watchdog/mt7621_wdt.c')
-rw-r--r-- | drivers/watchdog/mt7621_wdt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/watchdog/mt7621_wdt.c b/drivers/watchdog/mt7621_wdt.c index 2fb5a3085521..48a06067075d 100644 --- a/drivers/watchdog/mt7621_wdt.c +++ b/drivers/watchdog/mt7621_wdt.c @@ -110,7 +110,7 @@ static struct watchdog_info mt7621_wdt_info = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, }; -static struct watchdog_ops mt7621_wdt_ops = { +static const struct watchdog_ops mt7621_wdt_ops = { .owner = THIS_MODULE, .start = mt7621_wdt_start, .stop = mt7621_wdt_stop, |