Commit 6c368932 authored by Bhumika Goyal's avatar Bhumika Goyal Committed by Guenter Roeck

watchdog: constify watchdog_info structures

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: default avatarBhumika Goyal <bhumirks@gmail.com>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarBaruch Siach <baruch@tkos.co.il>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent cb5f9d40
...@@ -101,7 +101,7 @@ static unsigned int bcm7038_wdt_get_timeleft(struct watchdog_device *wdog) ...@@ -101,7 +101,7 @@ static unsigned int bcm7038_wdt_get_timeleft(struct watchdog_device *wdog)
return time_left / wdt->rate; 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", .identity = "Broadcom BCM7038 Watchdog Timer",
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE WDIOF_MAGICCLOSE
......
...@@ -274,7 +274,7 @@ static struct watchdog_ops bcm_kona_wdt_ops = { ...@@ -274,7 +274,7 @@ static struct watchdog_ops bcm_kona_wdt_ops = {
.get_timeleft = bcm_kona_wdt_get_timeleft, .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 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
.identity = "Broadcom Kona Watchdog Timer", .identity = "Broadcom Kona Watchdog Timer",
......
...@@ -262,7 +262,7 @@ static irqreturn_t cdns_wdt_irq_handler(int irq, void *dev_id) ...@@ -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 * Info structure used to indicate the features supported by the device
* to the upper layers. This is defined in watchdog.h header file. * 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", .identity = "cdns_wdt watchdog",
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -140,7 +140,7 @@ static int da9052_wdt_ping(struct watchdog_device *wdt_dev) ...@@ -140,7 +140,7 @@ static int da9052_wdt_ping(struct watchdog_device *wdt_dev)
return ret; return ret;
} }
static struct watchdog_info da9052_wdt_info = { static const struct watchdog_info da9052_wdt_info = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
.identity = "DA9052 Watchdog", .identity = "DA9052 Watchdog",
}; };
......
...@@ -108,7 +108,7 @@ static int da9055_wdt_stop(struct watchdog_device *wdt_dev) ...@@ -108,7 +108,7 @@ static int da9055_wdt_stop(struct watchdog_device *wdt_dev)
return da9055_wdt_set_timeout(wdt_dev, 0); 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, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
.identity = "DA9055 Watchdog", .identity = "DA9055 Watchdog",
}; };
......
...@@ -105,7 +105,7 @@ static struct watchdog_ops dc_wdt_ops = { ...@@ -105,7 +105,7 @@ static struct watchdog_ops dc_wdt_ops = {
.restart = dc_wdt_restart, .restart = dc_wdt_restart,
}; };
static struct watchdog_info dc_wdt_info = { static const struct watchdog_info dc_wdt_info = {
.options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE
| WDIOF_KEEPALIVEPING, | WDIOF_KEEPALIVEPING,
.identity = "Conexant Digicolor Watchdog", .identity = "Conexant Digicolor Watchdog",
......
...@@ -161,7 +161,7 @@ static int pdc_wdt_restart(struct watchdog_device *wdt_dev, ...@@ -161,7 +161,7 @@ static int pdc_wdt_restart(struct watchdog_device *wdt_dev,
return 0; return 0;
} }
static struct watchdog_info pdc_wdt_info = { static const struct watchdog_info pdc_wdt_info = {
.identity = "IMG PDC Watchdog", .identity = "IMG PDC Watchdog",
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
......
...@@ -422,7 +422,7 @@ static int kempld_wdt_probe_stages(struct watchdog_device *wdd) ...@@ -422,7 +422,7 @@ static int kempld_wdt_probe_stages(struct watchdog_device *wdd)
return 0; return 0;
} }
static struct watchdog_info kempld_wdt_info = { static const struct watchdog_info kempld_wdt_info = {
.identity = "KEMPLD Watchdog", .identity = "KEMPLD Watchdog",
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
......
...@@ -181,7 +181,7 @@ static int lpc18xx_wdt_restart(struct watchdog_device *wdt_dev, ...@@ -181,7 +181,7 @@ static int lpc18xx_wdt_restart(struct watchdog_device *wdt_dev,
return 0; return 0;
} }
static struct watchdog_info lpc18xx_wdt_info = { static const struct watchdog_info lpc18xx_wdt_info = {
.identity = "NXP LPC18xx Watchdog", .identity = "NXP LPC18xx Watchdog",
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
......
...@@ -130,7 +130,7 @@ static int rn5t618_wdt_ping(struct watchdog_device *wdt_dev) ...@@ -130,7 +130,7 @@ static int rn5t618_wdt_ping(struct watchdog_device *wdt_dev)
RN5T618_PWRIRQ_IR_WDOG, 0); 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 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
.identity = DRIVER_NAME, .identity = DRIVER_NAME,
......
...@@ -207,7 +207,7 @@ static irqreturn_t sbsa_gwdt_interrupt(int irq, void *dev_id) ...@@ -207,7 +207,7 @@ static irqreturn_t sbsa_gwdt_interrupt(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static struct watchdog_info sbsa_gwdt_info = { static const struct watchdog_info sbsa_gwdt_info = {
.identity = WATCHDOG_NAME, .identity = WATCHDOG_NAME,
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
......
...@@ -297,7 +297,7 @@ static unsigned int wdt_get_time(struct watchdog_device *wdog) ...@@ -297,7 +297,7 @@ static unsigned int wdt_get_time(struct watchdog_device *wdog)
* Kernel Interfaces * Kernel Interfaces
*/ */
static struct watchdog_info wdt_info = { static const struct watchdog_info wdt_info = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.identity = "W83627HF Watchdog", .identity = "W83627HF Watchdog",
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment