]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
watchdog: constify watchdog_info structures
authorBhumika Goyal <bhumirks@gmail.com>
Mon, 26 Dec 2016 17:05:11 +0000 (22:35 +0530)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 24 Feb 2017 22:00:23 +0000 (14:00 -0800)
Declare watchdog_info structures as const as they are only stored in the
info field of watchdog_device structures. This field is of type const
struct watchdog_info *, so watchdog_info structures having this property
can be declared const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct watchdog_info i@p={...};

@ok@
identifier r1.i;
position p;
struct watchdog_device obj;
@@
obj.info=&i@p;

@bad@
position p!={r1.p,ok.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct watchdog_info i;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
12 files changed:
drivers/watchdog/bcm7038_wdt.c
drivers/watchdog/bcm_kona_wdt.c
drivers/watchdog/cadence_wdt.c
drivers/watchdog/da9052_wdt.c
drivers/watchdog/da9055_wdt.c
drivers/watchdog/digicolor_wdt.c
drivers/watchdog/imgpdc_wdt.c
drivers/watchdog/kempld_wdt.c
drivers/watchdog/lpc18xx_wdt.c
drivers/watchdog/rn5t618_wdt.c
drivers/watchdog/sbsa_gwdt.c
drivers/watchdog/w83627hf_wdt.c

index 4814c00b32f6de8c47b6c112988ce3837ffe7f81..c1b8e534fb5585ad52c2b4d9693981d33b448dff 100644 (file)
@@ -101,7 +101,7 @@ static unsigned int bcm7038_wdt_get_timeleft(struct watchdog_device *wdog)
        return time_left / wdt->rate;
 }
 
-static struct watchdog_info bcm7038_wdt_info = {
+static const struct watchdog_info bcm7038_wdt_info = {
        .identity       = "Broadcom BCM7038 Watchdog Timer",
        .options        = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
                                WDIOF_MAGICCLOSE
index e0c98423f2c9d0c2203a14933a0061f3026b224e..76b00805cd873f96d6cb31324a91987888aa11f2 100644 (file)
@@ -274,7 +274,7 @@ static struct watchdog_ops bcm_kona_wdt_ops = {
        .get_timeleft = bcm_kona_wdt_get_timeleft,
 };
 
-static struct watchdog_info bcm_kona_wdt_info = {
+static const struct watchdog_info bcm_kona_wdt_info = {
        .options =      WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
                        WDIOF_KEEPALIVEPING,
        .identity =     "Broadcom Kona Watchdog Timer",
index 98acef72334d7760296ab98ef30fa1d417a6ad83..8d61e8bfe60b1a418eab489e966652840dedccff 100644 (file)
@@ -262,7 +262,7 @@ static irqreturn_t cdns_wdt_irq_handler(int irq, void *dev_id)
  * Info structure used to indicate the features supported by the device
  * to the upper layers. This is defined in watchdog.h header file.
  */
-static struct watchdog_info cdns_wdt_info = {
+static const struct watchdog_info cdns_wdt_info = {
        .identity       = "cdns_wdt watchdog",
        .options        = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
                          WDIOF_MAGICCLOSE,
index 2fc19a32a320bfcd49113c30e441bb837054d588..d86a57e3d17df7ba957977097ae37798cf9a79a8 100644 (file)
@@ -140,7 +140,7 @@ static int da9052_wdt_ping(struct watchdog_device *wdt_dev)
        return ret;
 }
 
-static struct watchdog_info da9052_wdt_info = {
+static const struct watchdog_info da9052_wdt_info = {
        .options        = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
        .identity       = "DA9052 Watchdog",
 };
index 8377c43f3f20ff0c7537642b05ac580badffdd71..4f30818cf93f84f45970bbf17c731a68660042c5 100644 (file)
@@ -108,7 +108,7 @@ static int da9055_wdt_stop(struct watchdog_device *wdt_dev)
        return da9055_wdt_set_timeout(wdt_dev, 0);
 }
 
-static struct watchdog_info da9055_wdt_info = {
+static const struct watchdog_info da9055_wdt_info = {
        .options        = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
        .identity       = "DA9055 Watchdog",
 };
index 77df772406b084b93104f13221bdc248d7317bef..dfe72944822dd937091761d4edb5721049c40b53 100644 (file)
@@ -105,7 +105,7 @@ static struct watchdog_ops dc_wdt_ops = {
        .restart        = dc_wdt_restart,
 };
 
-static struct watchdog_info dc_wdt_info = {
+static const struct watchdog_info dc_wdt_info = {
        .options        = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE
                        | WDIOF_KEEPALIVEPING,
        .identity       = "Conexant Digicolor Watchdog",
index 516fbef00856edeceb59fba31968c1c2328bd24e..6ed39dee995f4f713845ce4bd60ac44d6e9d64fd 100644 (file)
@@ -161,7 +161,7 @@ static int pdc_wdt_restart(struct watchdog_device *wdt_dev,
        return 0;
 }
 
-static struct watchdog_info pdc_wdt_info = {
+static const struct watchdog_info pdc_wdt_info = {
        .identity       = "IMG PDC Watchdog",
        .options        = WDIOF_SETTIMEOUT |
                          WDIOF_KEEPALIVEPING |
index 8e302d0e346c9b6a617fd0c1f3a64c65f0a084df..73c46b3a09ab3ec80db0bfb7577fe289fc811b51 100644 (file)
@@ -422,7 +422,7 @@ static int kempld_wdt_probe_stages(struct watchdog_device *wdd)
        return 0;
 }
 
-static struct watchdog_info kempld_wdt_info = {
+static const struct watchdog_info kempld_wdt_info = {
        .identity       = "KEMPLD Watchdog",
        .options        = WDIOF_SETTIMEOUT |
                        WDIOF_KEEPALIVEPING |
index fd171e6caa167457777ced3220d6bd277f0dde34..3b8bb59adf027bddf5fde1013c3621f4b480e9a3 100644 (file)
@@ -181,7 +181,7 @@ static int lpc18xx_wdt_restart(struct watchdog_device *wdt_dev,
        return 0;
 }
 
-static struct watchdog_info lpc18xx_wdt_info = {
+static const struct watchdog_info lpc18xx_wdt_info = {
        .identity       = "NXP LPC18xx Watchdog",
        .options        = WDIOF_SETTIMEOUT |
                          WDIOF_KEEPALIVEPING |
index 0805ee2acd7a94bb913472f5bd33bea5d95bc0c8..e60f55702ab79d111078dae1b253799dfdc4684d 100644 (file)
@@ -130,7 +130,7 @@ static int rn5t618_wdt_ping(struct watchdog_device *wdt_dev)
                                  RN5T618_PWRIRQ_IR_WDOG, 0);
 }
 
-static struct watchdog_info rn5t618_wdt_info = {
+static const struct watchdog_info rn5t618_wdt_info = {
        .options        = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
                          WDIOF_KEEPALIVEPING,
        .identity       = DRIVER_NAME,
index ce0c38bd0f0078eb32826b9377724432530efcf3..e9966bc8c23e7bd6ffb129aad1a2ce8220e45adf 100644 (file)
@@ -207,7 +207,7 @@ static irqreturn_t sbsa_gwdt_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static struct watchdog_info sbsa_gwdt_info = {
+static const struct watchdog_info sbsa_gwdt_info = {
        .identity       = WATCHDOG_NAME,
        .options        = WDIOF_SETTIMEOUT |
                          WDIOF_KEEPALIVEPING |
index ef2ecaf53a147e54ca96c862b43e4c87e59903b6..98fd186c6878833c830b7a45779789912c0c7973 100644 (file)
@@ -297,7 +297,7 @@ static unsigned int wdt_get_time(struct watchdog_device *wdog)
  *     Kernel Interfaces
  */
 
-static struct watchdog_info wdt_info = {
+static const struct watchdog_info wdt_info = {
        .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
        .identity = "W83627HF Watchdog",
 };