]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
watchdog: constify watchdog_ops structures
authorBhumika Goyal <bhumirks@gmail.com>
Sat, 28 Jan 2017 07:41:17 +0000 (13:11 +0530)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 24 Feb 2017 22:00:23 +0000 (14:00 -0800)
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>
14 files changed:
drivers/watchdog/asm9260_wdt.c
drivers/watchdog/atlas7_wdt.c
drivers/watchdog/bcm_kona_wdt.c
drivers/watchdog/booke_wdt.c
drivers/watchdog/diag288_wdt.c
drivers/watchdog/digicolor_wdt.c
drivers/watchdog/ep93xx_wdt.c
drivers/watchdog/mt7621_wdt.c
drivers/watchdog/rt2880_wdt.c
drivers/watchdog/s3c2410_wdt.c
drivers/watchdog/sama5d4_wdt.c
drivers/watchdog/sbsa_gwdt.c
drivers/watchdog/sirfsoc_wdt.c
drivers/watchdog/sun4v_wdt.c

index 028feb6f6e53554bdfc4f6c697bb618738274148..53da001f0838eeb09303bce1725d316068b369c1 100644 (file)
@@ -186,7 +186,7 @@ static const struct watchdog_info asm9260_wdt_ident = {
        .identity         =     "Alphascale asm9260 Watchdog",
 };
 
-static struct watchdog_ops asm9260_wdt_ops = {
+static const struct watchdog_ops asm9260_wdt_ops = {
        .owner          = THIS_MODULE,
        .start          = asm9260_wdt_enable,
        .stop           = asm9260_wdt_disable,
index ed80734befae16ea294b97fa6f1bfc5249a5d6bc..4abdcabd8219e61ddc8adbbba23ac804f2f54f2c 100644 (file)
@@ -105,7 +105,7 @@ static const struct watchdog_info atlas7_wdt_ident = {
        .identity = "atlas7 Watchdog",
 };
 
-static struct watchdog_ops atlas7_wdt_ops = {
+static const struct watchdog_ops atlas7_wdt_ops = {
        .owner = THIS_MODULE,
        .start = atlas7_wdt_enable,
        .stop = atlas7_wdt_disable,
index 76b00805cd873f96d6cb31324a91987888aa11f2..6fce17d5b9f1a27f94e711d0e69d9844c920a91d 100644 (file)
@@ -266,7 +266,7 @@ static int bcm_kona_wdt_stop(struct watchdog_device *wdog)
                                            SECWDOG_SRSTEN_MASK, 0);
 }
 
-static struct watchdog_ops bcm_kona_wdt_ops = {
+static const struct watchdog_ops bcm_kona_wdt_ops = {
        .owner =        THIS_MODULE,
        .start =        bcm_kona_wdt_start,
        .stop =         bcm_kona_wdt_stop,
index ae034bb1e55140bb2c86e715dd9f4da76e636e4f..3ad1e44bef44b16cf653eaeac430ee8316916f68 100644 (file)
@@ -197,7 +197,7 @@ static struct watchdog_info booke_wdt_info __ro_after_init = {
        .identity = "PowerPC Book-E Watchdog",
 };
 
-static struct watchdog_ops booke_wdt_ops = {
+static const struct watchdog_ops booke_wdt_ops = {
        .owner = THIS_MODULE,
        .start = booke_wdt_start,
        .stop = booke_wdt_stop,
index 861d3d3133f8cac99ed2c07188ffb68947304e08..6f591084bb7af2fb64510171a8ba872c919f53b1 100644 (file)
@@ -205,7 +205,7 @@ static int wdt_set_timeout(struct watchdog_device * dev, unsigned int new_to)
        return wdt_ping(dev);
 }
 
-static struct watchdog_ops wdt_ops = {
+static const struct watchdog_ops wdt_ops = {
        .owner = THIS_MODULE,
        .start = wdt_start,
        .stop = wdt_stop,
index 870694d9ebc7f848ecdbd759bcf21148b8aca8a7..5e4ef93caa02b603998a2ab4b5f71cbf5c2ca4df 100644 (file)
@@ -96,7 +96,7 @@ static unsigned int dc_wdt_get_timeleft(struct watchdog_device *wdog)
        return count / clk_get_rate(wdt->clk);
 }
 
-static struct watchdog_ops dc_wdt_ops = {
+static const struct watchdog_ops dc_wdt_ops = {
        .owner          = THIS_MODULE,
        .start          = dc_wdt_start,
        .stop           = dc_wdt_stop,
index 0a4d7cc05d5439346ae0b77633089a08ea0464d6..8a6e1a7c63ae399748726966f23f133058fade61 100644 (file)
@@ -99,7 +99,7 @@ static const struct watchdog_info ep93xx_wdt_ident = {
        .identity       = "EP93xx Watchdog",
 };
 
-static struct watchdog_ops ep93xx_wdt_ops = {
+static const struct watchdog_ops ep93xx_wdt_ops = {
        .owner          = THIS_MODULE,
        .start          = ep93xx_wdt_start,
        .stop           = ep93xx_wdt_stop,
index 2fb5a30855216af32b44506ff7942637d1949376..48a06067075d56c2f90358527cdd351575992ea1 100644 (file)
@@ -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,
index 4c471fe7b8544de7388a176813f47df3b9cf30f8..05524baf7dccba28fa84360a909bea22127f0ddc 100644 (file)
@@ -124,7 +124,7 @@ static struct watchdog_info rt288x_wdt_info = {
        .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
 };
 
-static struct watchdog_ops rt288x_wdt_ops = {
+static const struct watchdog_ops rt288x_wdt_ops = {
        .owner = THIS_MODULE,
        .start = rt288x_wdt_start,
        .stop = rt288x_wdt_stop,
index 59e95762a6de776ba9a6bcc793138eccb8396675..d48ba2590641cb2cb64be5b9b7c805a3edab45ba 100644 (file)
@@ -394,7 +394,7 @@ static const struct watchdog_info s3c2410_wdt_ident = {
        .identity         =     "S3C2410 Watchdog",
 };
 
-static struct watchdog_ops s3c2410wdt_ops = {
+static const struct watchdog_ops s3c2410wdt_ops = {
        .owner = THIS_MODULE,
        .start = s3c2410wdt_start,
        .stop = s3c2410wdt_stop,
index a49634cdc1ccbc987576bae3480f6669db3c0cde..dc4c76b660daf11ae4b39f1b2b6d475c23c4bb9e 100644 (file)
@@ -107,7 +107,7 @@ static const struct watchdog_info sama5d4_wdt_info = {
        .identity = "Atmel SAMA5D4 Watchdog",
 };
 
-static struct watchdog_ops sama5d4_wdt_ops = {
+static const struct watchdog_ops sama5d4_wdt_ops = {
        .owner = THIS_MODULE,
        .start = sama5d4_wdt_start,
        .stop = sama5d4_wdt_stop,
index e9966bc8c23e7bd6ffb129aad1a2ce8220e45adf..316c2eb122d23d335d738947a63fc2f9db2e4f1b 100644 (file)
@@ -215,7 +215,7 @@ static const struct watchdog_info sbsa_gwdt_info = {
                          WDIOF_CARDRESET,
 };
 
-static struct watchdog_ops sbsa_gwdt_ops = {
+static const struct watchdog_ops sbsa_gwdt_ops = {
        .owner          = THIS_MODULE,
        .start          = sbsa_gwdt_start,
        .stop           = sbsa_gwdt_stop,
index 3050a0031479f4737a3358d9152d973ad347fff1..4eea351e09b0d205d20e771e2349abc04d6310f8 100644 (file)
@@ -127,7 +127,7 @@ static const struct watchdog_info sirfsoc_wdt_ident = {
        .identity         =     "SiRFSOC Watchdog",
 };
 
-static struct watchdog_ops sirfsoc_wdt_ops = {
+static const struct watchdog_ops sirfsoc_wdt_ops = {
        .owner = THIS_MODULE,
        .start = sirfsoc_wdt_enable,
        .stop = sirfsoc_wdt_disable,
index 1467fe50a76fad5399d3eb25babc4cdaed1d0049..00907973608c6ff7ef8a571c36f64af30945f3d9 100644 (file)
@@ -77,7 +77,7 @@ static const struct watchdog_info sun4v_wdt_ident = {
        .firmware_version = 0,
 };
 
-static struct watchdog_ops sun4v_wdt_ops = {
+static const struct watchdog_ops sun4v_wdt_ops = {
        .owner =        THIS_MODULE,
        .start =        sun4v_wdt_ping,
        .stop =         sun4v_wdt_stop,