Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Bhumika Goyal and committed by
Guenter Roeck
6c368932 cb5f9d40

+12 -12
+1 -1
drivers/watchdog/bcm7038_wdt.c
··· 101 101 return time_left / wdt->rate; 102 102 } 103 103 104 - static struct watchdog_info bcm7038_wdt_info = { 104 + static const struct watchdog_info bcm7038_wdt_info = { 105 105 .identity = "Broadcom BCM7038 Watchdog Timer", 106 106 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | 107 107 WDIOF_MAGICCLOSE
+1 -1
drivers/watchdog/bcm_kona_wdt.c
··· 274 274 .get_timeleft = bcm_kona_wdt_get_timeleft, 275 275 }; 276 276 277 - static struct watchdog_info bcm_kona_wdt_info = { 277 + static const struct watchdog_info bcm_kona_wdt_info = { 278 278 .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | 279 279 WDIOF_KEEPALIVEPING, 280 280 .identity = "Broadcom Kona Watchdog Timer",
+1 -1
drivers/watchdog/cadence_wdt.c
··· 262 262 * Info structure used to indicate the features supported by the device 263 263 * to the upper layers. This is defined in watchdog.h header file. 264 264 */ 265 - static struct watchdog_info cdns_wdt_info = { 265 + static const struct watchdog_info cdns_wdt_info = { 266 266 .identity = "cdns_wdt watchdog", 267 267 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | 268 268 WDIOF_MAGICCLOSE,
+1 -1
drivers/watchdog/da9052_wdt.c
··· 140 140 return ret; 141 141 } 142 142 143 - static struct watchdog_info da9052_wdt_info = { 143 + static const struct watchdog_info da9052_wdt_info = { 144 144 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, 145 145 .identity = "DA9052 Watchdog", 146 146 };
+1 -1
drivers/watchdog/da9055_wdt.c
··· 108 108 return da9055_wdt_set_timeout(wdt_dev, 0); 109 109 } 110 110 111 - static struct watchdog_info da9055_wdt_info = { 111 + static const struct watchdog_info da9055_wdt_info = { 112 112 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, 113 113 .identity = "DA9055 Watchdog", 114 114 };
+1 -1
drivers/watchdog/digicolor_wdt.c
··· 105 105 .restart = dc_wdt_restart, 106 106 }; 107 107 108 - static struct watchdog_info dc_wdt_info = { 108 + static const struct watchdog_info dc_wdt_info = { 109 109 .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE 110 110 | WDIOF_KEEPALIVEPING, 111 111 .identity = "Conexant Digicolor Watchdog",
+1 -1
drivers/watchdog/imgpdc_wdt.c
··· 161 161 return 0; 162 162 } 163 163 164 - static struct watchdog_info pdc_wdt_info = { 164 + static const struct watchdog_info pdc_wdt_info = { 165 165 .identity = "IMG PDC Watchdog", 166 166 .options = WDIOF_SETTIMEOUT | 167 167 WDIOF_KEEPALIVEPING |
+1 -1
drivers/watchdog/kempld_wdt.c
··· 422 422 return 0; 423 423 } 424 424 425 - static struct watchdog_info kempld_wdt_info = { 425 + static const struct watchdog_info kempld_wdt_info = { 426 426 .identity = "KEMPLD Watchdog", 427 427 .options = WDIOF_SETTIMEOUT | 428 428 WDIOF_KEEPALIVEPING |
+1 -1
drivers/watchdog/lpc18xx_wdt.c
··· 181 181 return 0; 182 182 } 183 183 184 - static struct watchdog_info lpc18xx_wdt_info = { 184 + static const struct watchdog_info lpc18xx_wdt_info = { 185 185 .identity = "NXP LPC18xx Watchdog", 186 186 .options = WDIOF_SETTIMEOUT | 187 187 WDIOF_KEEPALIVEPING |
+1 -1
drivers/watchdog/rn5t618_wdt.c
··· 130 130 RN5T618_PWRIRQ_IR_WDOG, 0); 131 131 } 132 132 133 - static struct watchdog_info rn5t618_wdt_info = { 133 + static const struct watchdog_info rn5t618_wdt_info = { 134 134 .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | 135 135 WDIOF_KEEPALIVEPING, 136 136 .identity = DRIVER_NAME,
+1 -1
drivers/watchdog/sbsa_gwdt.c
··· 207 207 return IRQ_HANDLED; 208 208 } 209 209 210 - static struct watchdog_info sbsa_gwdt_info = { 210 + static const struct watchdog_info sbsa_gwdt_info = { 211 211 .identity = WATCHDOG_NAME, 212 212 .options = WDIOF_SETTIMEOUT | 213 213 WDIOF_KEEPALIVEPING |
+1 -1
drivers/watchdog/w83627hf_wdt.c
··· 297 297 * Kernel Interfaces 298 298 */ 299 299 300 - static struct watchdog_info wdt_info = { 300 + static const struct watchdog_info wdt_info = { 301 301 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, 302 302 .identity = "W83627HF Watchdog", 303 303 };