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

mfd: da9xxx-core: Constify static struct resource

Constify a number of static struct resource. The only usage of the
structs are to assign their address to the resources field in the
mfd_cell struct. This allows the compiler to put them in read-only
memory. Done with the help of Coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Rikard Falkeborn and committed by
Lee Jones
a0fa0abe f8d86e29

+23 -23
+4 -4
drivers/mfd/da9055-core.c
··· 254 254 }; 255 255 EXPORT_SYMBOL_GPL(da9055_regmap_config); 256 256 257 - static struct resource da9055_onkey_resource = { 257 + static const struct resource da9055_onkey_resource = { 258 258 .name = "ONKEY", 259 259 .start = DA9055_IRQ_NONKEY, 260 260 .end = DA9055_IRQ_NONKEY, 261 261 .flags = IORESOURCE_IRQ, 262 262 }; 263 263 264 - static struct resource da9055_rtc_resource[] = { 264 + static const struct resource da9055_rtc_resource[] = { 265 265 { 266 266 .name = "ALM", 267 267 .start = DA9055_IRQ_ALARM, ··· 276 276 }, 277 277 }; 278 278 279 - static struct resource da9055_hwmon_resource = { 279 + static const struct resource da9055_hwmon_resource = { 280 280 .name = "HWMON", 281 281 .start = DA9055_IRQ_HWMON, 282 282 .end = DA9055_IRQ_HWMON, 283 283 .flags = IORESOURCE_IRQ, 284 284 }; 285 285 286 - static struct resource da9055_ld05_6_resource = { 286 + static const struct resource da9055_ld05_6_resource = { 287 287 .name = "REGULATOR", 288 288 .start = DA9055_IRQ_REGULATOR, 289 289 .end = DA9055_IRQ_REGULATOR,
+12 -12
drivers/mfd/da9062-core.c
··· 160 160 .ack_base = DA9062AA_EVENT_A, 161 161 }; 162 162 163 - static struct resource da9061_core_resources[] = { 163 + static const struct resource da9061_core_resources[] = { 164 164 DEFINE_RES_IRQ_NAMED(DA9061_IRQ_VDD_WARN, "VDD_WARN"), 165 165 }; 166 166 167 - static struct resource da9061_regulators_resources[] = { 167 + static const struct resource da9061_regulators_resources[] = { 168 168 DEFINE_RES_IRQ_NAMED(DA9061_IRQ_LDO_LIM, "LDO_LIM"), 169 169 }; 170 170 171 - static struct resource da9061_thermal_resources[] = { 171 + static const struct resource da9061_thermal_resources[] = { 172 172 DEFINE_RES_IRQ_NAMED(DA9061_IRQ_TEMP, "THERMAL"), 173 173 }; 174 174 175 - static struct resource da9061_wdt_resources[] = { 175 + static const struct resource da9061_wdt_resources[] = { 176 176 DEFINE_RES_IRQ_NAMED(DA9061_IRQ_WDG_WARN, "WD_WARN"), 177 177 }; 178 178 179 - static struct resource da9061_onkey_resources[] = { 179 + static const struct resource da9061_onkey_resources[] = { 180 180 DEFINE_RES_IRQ_NAMED(DA9061_IRQ_ONKEY, "ONKEY"), 181 181 }; 182 182 ··· 211 211 }, 212 212 }; 213 213 214 - static struct resource da9062_core_resources[] = { 214 + static const struct resource da9062_core_resources[] = { 215 215 DEFINE_RES_NAMED(DA9062_IRQ_VDD_WARN, 1, "VDD_WARN", IORESOURCE_IRQ), 216 216 }; 217 217 218 - static struct resource da9062_regulators_resources[] = { 218 + static const struct resource da9062_regulators_resources[] = { 219 219 DEFINE_RES_NAMED(DA9062_IRQ_LDO_LIM, 1, "LDO_LIM", IORESOURCE_IRQ), 220 220 }; 221 221 222 - static struct resource da9062_thermal_resources[] = { 222 + static const struct resource da9062_thermal_resources[] = { 223 223 DEFINE_RES_NAMED(DA9062_IRQ_TEMP, 1, "THERMAL", IORESOURCE_IRQ), 224 224 }; 225 225 226 - static struct resource da9062_wdt_resources[] = { 226 + static const struct resource da9062_wdt_resources[] = { 227 227 DEFINE_RES_NAMED(DA9062_IRQ_WDG_WARN, 1, "WD_WARN", IORESOURCE_IRQ), 228 228 }; 229 229 230 - static struct resource da9062_rtc_resources[] = { 230 + static const struct resource da9062_rtc_resources[] = { 231 231 DEFINE_RES_NAMED(DA9062_IRQ_ALARM, 1, "ALARM", IORESOURCE_IRQ), 232 232 DEFINE_RES_NAMED(DA9062_IRQ_TICK, 1, "TICK", IORESOURCE_IRQ), 233 233 }; 234 234 235 - static struct resource da9062_onkey_resources[] = { 235 + static const struct resource da9062_onkey_resources[] = { 236 236 DEFINE_RES_NAMED(DA9062_IRQ_ONKEY, 1, "ONKEY", IORESOURCE_IRQ), 237 237 }; 238 238 239 - static struct resource da9062_gpio_resources[] = { 239 + static const struct resource da9062_gpio_resources[] = { 240 240 DEFINE_RES_NAMED(DA9062_IRQ_GPI0, 1, "GPI0", IORESOURCE_IRQ), 241 241 DEFINE_RES_NAMED(DA9062_IRQ_GPI1, 1, "GPI1", IORESOURCE_IRQ), 242 242 DEFINE_RES_NAMED(DA9062_IRQ_GPI2, 1, "GPI2", IORESOURCE_IRQ),
+4 -4
drivers/mfd/da9063-core.c
··· 29 29 #include <linux/uaccess.h> 30 30 31 31 32 - static struct resource da9063_regulators_resources[] = { 32 + static const struct resource da9063_regulators_resources[] = { 33 33 { 34 34 .name = "LDO_LIM", 35 35 .start = DA9063_IRQ_LDO_LIM, ··· 38 38 }, 39 39 }; 40 40 41 - static struct resource da9063_rtc_resources[] = { 41 + static const struct resource da9063_rtc_resources[] = { 42 42 { 43 43 .name = "ALARM", 44 44 .start = DA9063_IRQ_ALARM, ··· 53 53 } 54 54 }; 55 55 56 - static struct resource da9063_onkey_resources[] = { 56 + static const struct resource da9063_onkey_resources[] = { 57 57 { 58 58 .name = "ONKEY", 59 59 .start = DA9063_IRQ_ONKEY, ··· 62 62 }, 63 63 }; 64 64 65 - static struct resource da9063_hwmon_resources[] = { 65 + static const struct resource da9063_hwmon_resources[] = { 66 66 { 67 67 .start = DA9063_IRQ_ADC_RDY, 68 68 .end = DA9063_IRQ_ADC_RDY,
+3 -3
drivers/mfd/da9150-core.c
··· 350 350 .num_irqs = ARRAY_SIZE(da9150_irqs), 351 351 }; 352 352 353 - static struct resource da9150_gpadc_resources[] = { 353 + static const struct resource da9150_gpadc_resources[] = { 354 354 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_GPADC, "GPADC"), 355 355 }; 356 356 357 - static struct resource da9150_charger_resources[] = { 357 + static const struct resource da9150_charger_resources[] = { 358 358 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_CHG, "CHG_STATUS"), 359 359 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_TJUNC, "CHG_TJUNC"), 360 360 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_VFAULT, "CHG_VFAULT"), 361 361 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_VBUS, "CHG_VBUS"), 362 362 }; 363 363 364 - static struct resource da9150_fg_resources[] = { 364 + static const struct resource da9150_fg_resources[] = { 365 365 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_FG, "FG"), 366 366 }; 367 367