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

mfd: Constify static struct resources

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>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Rikard Falkeborn and committed by
Lee Jones
c4a164f4 4bdcbbb9

+82 -82
+1 -1
drivers/mfd/88pm800.c
··· 121 121 }; 122 122 MODULE_DEVICE_TABLE(i2c, pm80x_id_table); 123 123 124 - static struct resource rtc_resources[] = { 124 + static const struct resource rtc_resources[] = { 125 125 { 126 126 .name = "88pm80x-rtc", 127 127 .start = PM800_IRQ_RTC,
+25 -25
drivers/mfd/88pm860x-core.c
··· 26 26 27 27 #define INT_STATUS_NUM 3 28 28 29 - static struct resource bk0_resources[] = { 29 + static const struct resource bk0_resources[] = { 30 30 {2, 2, "duty cycle", IORESOURCE_REG, }, 31 31 {3, 3, "always on", IORESOURCE_REG, }, 32 32 {3, 3, "current", IORESOURCE_REG, }, 33 33 }; 34 - static struct resource bk1_resources[] = { 34 + static const struct resource bk1_resources[] = { 35 35 {4, 4, "duty cycle", IORESOURCE_REG, }, 36 36 {5, 5, "always on", IORESOURCE_REG, }, 37 37 {5, 5, "current", IORESOURCE_REG, }, 38 38 }; 39 - static struct resource bk2_resources[] = { 39 + static const struct resource bk2_resources[] = { 40 40 {6, 6, "duty cycle", IORESOURCE_REG, }, 41 41 {7, 7, "always on", IORESOURCE_REG, }, 42 42 {5, 5, "current", IORESOURCE_REG, }, 43 43 }; 44 44 45 - static struct resource led0_resources[] = { 45 + static const struct resource led0_resources[] = { 46 46 /* RGB1 Red LED */ 47 47 {0xd, 0xd, "control", IORESOURCE_REG, }, 48 48 {0xc, 0xc, "blink", IORESOURCE_REG, }, 49 49 }; 50 - static struct resource led1_resources[] = { 50 + static const struct resource led1_resources[] = { 51 51 /* RGB1 Green LED */ 52 52 {0xe, 0xe, "control", IORESOURCE_REG, }, 53 53 {0xc, 0xc, "blink", IORESOURCE_REG, }, 54 54 }; 55 - static struct resource led2_resources[] = { 55 + static const struct resource led2_resources[] = { 56 56 /* RGB1 Blue LED */ 57 57 {0xf, 0xf, "control", IORESOURCE_REG, }, 58 58 {0xc, 0xc, "blink", IORESOURCE_REG, }, 59 59 }; 60 - static struct resource led3_resources[] = { 60 + static const struct resource led3_resources[] = { 61 61 /* RGB2 Red LED */ 62 62 {0x9, 0x9, "control", IORESOURCE_REG, }, 63 63 {0x8, 0x8, "blink", IORESOURCE_REG, }, 64 64 }; 65 - static struct resource led4_resources[] = { 65 + static const struct resource led4_resources[] = { 66 66 /* RGB2 Green LED */ 67 67 {0xa, 0xa, "control", IORESOURCE_REG, }, 68 68 {0x8, 0x8, "blink", IORESOURCE_REG, }, 69 69 }; 70 - static struct resource led5_resources[] = { 70 + static const struct resource led5_resources[] = { 71 71 /* RGB2 Blue LED */ 72 72 {0xb, 0xb, "control", IORESOURCE_REG, }, 73 73 {0x8, 0x8, "blink", IORESOURCE_REG, }, 74 74 }; 75 75 76 - static struct resource buck1_resources[] = { 76 + static const struct resource buck1_resources[] = { 77 77 {0x24, 0x24, "buck set", IORESOURCE_REG, }, 78 78 }; 79 - static struct resource buck2_resources[] = { 79 + static const struct resource buck2_resources[] = { 80 80 {0x25, 0x25, "buck set", IORESOURCE_REG, }, 81 81 }; 82 - static struct resource buck3_resources[] = { 82 + static const struct resource buck3_resources[] = { 83 83 {0x26, 0x26, "buck set", IORESOURCE_REG, }, 84 84 }; 85 - static struct resource ldo1_resources[] = { 85 + static const struct resource ldo1_resources[] = { 86 86 {0x10, 0x10, "ldo set", IORESOURCE_REG, }, 87 87 }; 88 - static struct resource ldo2_resources[] = { 88 + static const struct resource ldo2_resources[] = { 89 89 {0x11, 0x11, "ldo set", IORESOURCE_REG, }, 90 90 }; 91 - static struct resource ldo3_resources[] = { 91 + static const struct resource ldo3_resources[] = { 92 92 {0x12, 0x12, "ldo set", IORESOURCE_REG, }, 93 93 }; 94 - static struct resource ldo4_resources[] = { 94 + static const struct resource ldo4_resources[] = { 95 95 {0x13, 0x13, "ldo set", IORESOURCE_REG, }, 96 96 }; 97 - static struct resource ldo5_resources[] = { 97 + static const struct resource ldo5_resources[] = { 98 98 {0x14, 0x14, "ldo set", IORESOURCE_REG, }, 99 99 }; 100 - static struct resource ldo6_resources[] = { 100 + static const struct resource ldo6_resources[] = { 101 101 {0x15, 0x15, "ldo set", IORESOURCE_REG, }, 102 102 }; 103 - static struct resource ldo7_resources[] = { 103 + static const struct resource ldo7_resources[] = { 104 104 {0x16, 0x16, "ldo set", IORESOURCE_REG, }, 105 105 }; 106 - static struct resource ldo8_resources[] = { 106 + static const struct resource ldo8_resources[] = { 107 107 {0x17, 0x17, "ldo set", IORESOURCE_REG, }, 108 108 }; 109 - static struct resource ldo9_resources[] = { 109 + static const struct resource ldo9_resources[] = { 110 110 {0x18, 0x18, "ldo set", IORESOURCE_REG, }, 111 111 }; 112 - static struct resource ldo10_resources[] = { 112 + static const struct resource ldo10_resources[] = { 113 113 {0x19, 0x19, "ldo set", IORESOURCE_REG, }, 114 114 }; 115 - static struct resource ldo12_resources[] = { 115 + static const struct resource ldo12_resources[] = { 116 116 {0x1a, 0x1a, "ldo set", IORESOURCE_REG, }, 117 117 }; 118 - static struct resource ldo_vibrator_resources[] = { 118 + static const struct resource ldo_vibrator_resources[] = { 119 119 {0x28, 0x28, "ldo set", IORESOURCE_REG, }, 120 120 }; 121 - static struct resource ldo14_resources[] = { 121 + static const struct resource ldo14_resources[] = { 122 122 {0x1b, 0x1b, "ldo set", IORESOURCE_REG, }, 123 123 }; 124 124
+1 -1
drivers/mfd/hi655x-pmic.c
··· 49 49 .max_register = HI655X_BUS_ADDR(0x400) - HI655X_STRIDE, 50 50 }; 51 51 52 - static struct resource pwrkey_resources[] = { 52 + static const struct resource pwrkey_resources[] = { 53 53 { 54 54 .name = "down", 55 55 .start = PWRON_D20R_INT,
+2 -2
drivers/mfd/intel_quark_i2c_gpio.c
··· 72 72 {} 73 73 }; 74 74 75 - static struct resource intel_quark_i2c_res[] = { 75 + static const struct resource intel_quark_i2c_res[] = { 76 76 [INTEL_QUARK_IORES_MEM] = { 77 77 .flags = IORESOURCE_MEM, 78 78 }, ··· 85 85 .adr = MFD_ACPI_MATCH_I2C, 86 86 }; 87 87 88 - static struct resource intel_quark_gpio_res[] = { 88 + static const struct resource intel_quark_gpio_res[] = { 89 89 [INTEL_QUARK_IORES_MEM] = { 90 90 .flags = IORESOURCE_MEM, 91 91 },
+8 -8
drivers/mfd/ioc3.c
··· 158 158 return -ENOMEM; 159 159 } 160 160 161 - static struct resource ioc3_uarta_resources[] = { 161 + static const struct resource ioc3_uarta_resources[] = { 162 162 DEFINE_RES_MEM(offsetof(struct ioc3, sregs.uarta), 163 163 sizeof_field(struct ioc3, sregs.uarta)), 164 164 DEFINE_RES_IRQ(IOC3_IRQ_SERIAL_A) 165 165 }; 166 166 167 - static struct resource ioc3_uartb_resources[] = { 167 + static const struct resource ioc3_uartb_resources[] = { 168 168 DEFINE_RES_MEM(offsetof(struct ioc3, sregs.uartb), 169 169 sizeof_field(struct ioc3, sregs.uartb)), 170 170 DEFINE_RES_IRQ(IOC3_IRQ_SERIAL_B) ··· 213 213 return 0; 214 214 } 215 215 216 - static struct resource ioc3_kbd_resources[] = { 216 + static const struct resource ioc3_kbd_resources[] = { 217 217 DEFINE_RES_MEM(offsetof(struct ioc3, serio), 218 218 sizeof_field(struct ioc3, serio)), 219 219 DEFINE_RES_IRQ(IOC3_IRQ_KBD) ··· 242 242 return 0; 243 243 } 244 244 245 - static struct resource ioc3_eth_resources[] = { 245 + static const struct resource ioc3_eth_resources[] = { 246 246 DEFINE_RES_MEM(offsetof(struct ioc3, eth), 247 247 sizeof_field(struct ioc3, eth)), 248 248 DEFINE_RES_MEM(offsetof(struct ioc3, ssram), ··· 250 250 DEFINE_RES_IRQ(0) 251 251 }; 252 252 253 - static struct resource ioc3_w1_resources[] = { 253 + static const struct resource ioc3_w1_resources[] = { 254 254 DEFINE_RES_MEM(offsetof(struct ioc3, mcr), 255 255 sizeof_field(struct ioc3, mcr)), 256 256 }; ··· 294 294 return 0; 295 295 } 296 296 297 - static struct resource ioc3_m48t35_resources[] = { 297 + static const struct resource ioc3_m48t35_resources[] = { 298 298 DEFINE_RES_MEM(IOC3_BYTEBUS_DEV0, M48T35_REG_SIZE) 299 299 }; 300 300 ··· 326 326 .access_type = ds1685_reg_indirect, 327 327 }; 328 328 329 - static struct resource ioc3_rtc_ds1685_resources[] = { 329 + static const struct resource ioc3_rtc_ds1685_resources[] = { 330 330 DEFINE_RES_MEM(IOC3_BYTEBUS_DEV1, 1), 331 331 DEFINE_RES_MEM(IOC3_BYTEBUS_DEV2, 1), 332 332 DEFINE_RES_IRQ(0) ··· 359 359 }; 360 360 361 361 362 - static struct resource ioc3_leds_resources[] = { 362 + static const struct resource ioc3_leds_resources[] = { 363 363 DEFINE_RES_MEM(offsetof(struct ioc3, gppr[0]), 364 364 sizeof_field(struct ioc3, gppr[0])), 365 365 DEFINE_RES_MEM(offsetof(struct ioc3, gppr[1]),
+28 -28
drivers/mfd/max8925-core.c
··· 19 19 #include <linux/of.h> 20 20 #include <linux/of_platform.h> 21 21 22 - static struct resource bk_resources[] = { 22 + static const struct resource bk_resources[] = { 23 23 { 0x84, 0x84, "mode control", IORESOURCE_REG, }, 24 24 { 0x85, 0x85, "control", IORESOURCE_REG, }, 25 25 }; ··· 33 33 }, 34 34 }; 35 35 36 - static struct resource touch_resources[] = { 36 + static const struct resource touch_resources[] = { 37 37 { 38 38 .name = "max8925-tsc", 39 39 .start = MAX8925_TSC_IRQ, ··· 51 51 }, 52 52 }; 53 53 54 - static struct resource power_supply_resources[] = { 54 + static const struct resource power_supply_resources[] = { 55 55 { 56 56 .name = "max8925-power", 57 57 .start = MAX8925_CHG_IRQ1, ··· 69 69 }, 70 70 }; 71 71 72 - static struct resource rtc_resources[] = { 72 + static const struct resource rtc_resources[] = { 73 73 { 74 74 .name = "max8925-rtc", 75 75 .start = MAX8925_IRQ_RTC_ALARM0, ··· 87 87 }, 88 88 }; 89 89 90 - static struct resource onkey_resources[] = { 90 + static const struct resource onkey_resources[] = { 91 91 { 92 92 .name = "max8925-onkey", 93 93 .start = MAX8925_IRQ_GPM_SW_R, ··· 110 110 }, 111 111 }; 112 112 113 - static struct resource sd1_resources[] = { 113 + static const struct resource sd1_resources[] = { 114 114 {0x06, 0x06, "sdv", IORESOURCE_REG, }, 115 115 }; 116 116 117 - static struct resource sd2_resources[] = { 117 + static const struct resource sd2_resources[] = { 118 118 {0x09, 0x09, "sdv", IORESOURCE_REG, }, 119 119 }; 120 120 121 - static struct resource sd3_resources[] = { 121 + static const struct resource sd3_resources[] = { 122 122 {0x0c, 0x0c, "sdv", IORESOURCE_REG, }, 123 123 }; 124 124 125 - static struct resource ldo1_resources[] = { 125 + static const struct resource ldo1_resources[] = { 126 126 {0x1a, 0x1a, "ldov", IORESOURCE_REG, }, 127 127 }; 128 128 129 - static struct resource ldo2_resources[] = { 129 + static const struct resource ldo2_resources[] = { 130 130 {0x1e, 0x1e, "ldov", IORESOURCE_REG, }, 131 131 }; 132 132 133 - static struct resource ldo3_resources[] = { 133 + static const struct resource ldo3_resources[] = { 134 134 {0x22, 0x22, "ldov", IORESOURCE_REG, }, 135 135 }; 136 136 137 - static struct resource ldo4_resources[] = { 137 + static const struct resource ldo4_resources[] = { 138 138 {0x26, 0x26, "ldov", IORESOURCE_REG, }, 139 139 }; 140 140 141 - static struct resource ldo5_resources[] = { 141 + static const struct resource ldo5_resources[] = { 142 142 {0x2a, 0x2a, "ldov", IORESOURCE_REG, }, 143 143 }; 144 144 145 - static struct resource ldo6_resources[] = { 145 + static const struct resource ldo6_resources[] = { 146 146 {0x2e, 0x2e, "ldov", IORESOURCE_REG, }, 147 147 }; 148 148 149 - static struct resource ldo7_resources[] = { 149 + static const struct resource ldo7_resources[] = { 150 150 {0x32, 0x32, "ldov", IORESOURCE_REG, }, 151 151 }; 152 152 153 - static struct resource ldo8_resources[] = { 153 + static const struct resource ldo8_resources[] = { 154 154 {0x36, 0x36, "ldov", IORESOURCE_REG, }, 155 155 }; 156 156 157 - static struct resource ldo9_resources[] = { 157 + static const struct resource ldo9_resources[] = { 158 158 {0x3a, 0x3a, "ldov", IORESOURCE_REG, }, 159 159 }; 160 160 161 - static struct resource ldo10_resources[] = { 161 + static const struct resource ldo10_resources[] = { 162 162 {0x3e, 0x3e, "ldov", IORESOURCE_REG, }, 163 163 }; 164 164 165 - static struct resource ldo11_resources[] = { 165 + static const struct resource ldo11_resources[] = { 166 166 {0x42, 0x42, "ldov", IORESOURCE_REG, }, 167 167 }; 168 168 169 - static struct resource ldo12_resources[] = { 169 + static const struct resource ldo12_resources[] = { 170 170 {0x46, 0x46, "ldov", IORESOURCE_REG, }, 171 171 }; 172 172 173 - static struct resource ldo13_resources[] = { 173 + static const struct resource ldo13_resources[] = { 174 174 {0x4a, 0x4a, "ldov", IORESOURCE_REG, }, 175 175 }; 176 176 177 - static struct resource ldo14_resources[] = { 177 + static const struct resource ldo14_resources[] = { 178 178 {0x4e, 0x4e, "ldov", IORESOURCE_REG, }, 179 179 }; 180 180 181 - static struct resource ldo15_resources[] = { 181 + static const struct resource ldo15_resources[] = { 182 182 {0x52, 0x52, "ldov", IORESOURCE_REG, }, 183 183 }; 184 184 185 - static struct resource ldo16_resources[] = { 185 + static const struct resource ldo16_resources[] = { 186 186 {0x12, 0x12, "ldov", IORESOURCE_REG, }, 187 187 }; 188 188 189 - static struct resource ldo17_resources[] = { 189 + static const struct resource ldo17_resources[] = { 190 190 {0x16, 0x16, "ldov", IORESOURCE_REG, }, 191 191 }; 192 192 193 - static struct resource ldo18_resources[] = { 193 + static const struct resource ldo18_resources[] = { 194 194 {0x74, 0x74, "ldov", IORESOURCE_REG, }, 195 195 }; 196 196 197 - static struct resource ldo19_resources[] = { 197 + static const struct resource ldo19_resources[] = { 198 198 {0x5e, 0x5e, "ldov", IORESOURCE_REG, }, 199 199 }; 200 200 201 - static struct resource ldo20_resources[] = { 201 + static const struct resource ldo20_resources[] = { 202 202 {0x9e, 0x9e, "ldov", IORESOURCE_REG, }, 203 203 }; 204 204
+2 -2
drivers/mfd/rdc321x-southbridge.c
··· 14 14 15 15 static struct rdc321x_wdt_pdata rdc321x_wdt_pdata; 16 16 17 - static struct resource rdc321x_wdt_resource[] = { 17 + static const struct resource rdc321x_wdt_resource[] = { 18 18 { 19 19 .name = "wdt-reg", 20 20 .start = RDC321X_WDT_CTRL, ··· 27 27 .max_gpios = RDC321X_NUM_GPIO, 28 28 }; 29 29 30 - static struct resource rdc321x_gpio_resources[] = { 30 + static const struct resource rdc321x_gpio_resources[] = { 31 31 { 32 32 .name = "gpio-reg1", 33 33 .start = RDC321X_GPIO_CTRL_REG1,
+2 -2
drivers/mfd/retu-mfd.c
··· 45 45 struct regmap_irq_chip_data *irq_data; 46 46 }; 47 47 48 - static struct resource retu_pwrbutton_res[] = { 48 + static const struct resource retu_pwrbutton_res[] = { 49 49 { 50 50 .name = "retu-pwrbutton", 51 51 .start = RETU_INT_PWR, ··· 84 84 /* Retu device registered for the power off. */ 85 85 static struct retu_dev *retu_pm_power_off; 86 86 87 - static struct resource tahvo_usb_res[] = { 87 + static const struct resource tahvo_usb_res[] = { 88 88 { 89 89 .name = "tahvo-usb", 90 90 .start = TAHVO_INT_VBUS,
+4 -4
drivers/mfd/rk808.c
··· 107 107 .volatile_reg = rk817_is_volatile_reg, 108 108 }; 109 109 110 - static struct resource rtc_resources[] = { 110 + static const struct resource rtc_resources[] = { 111 111 DEFINE_RES_IRQ(RK808_IRQ_RTC_ALARM), 112 112 }; 113 113 114 - static struct resource rk817_rtc_resources[] = { 114 + static const struct resource rk817_rtc_resources[] = { 115 115 DEFINE_RES_IRQ(RK817_IRQ_RTC_ALARM), 116 116 }; 117 117 118 - static struct resource rk805_key_resources[] = { 118 + static const struct resource rk805_key_resources[] = { 119 119 DEFINE_RES_IRQ(RK805_IRQ_PWRON_RISE), 120 120 DEFINE_RES_IRQ(RK805_IRQ_PWRON_FALL), 121 121 }; 122 122 123 - static struct resource rk817_pwrkey_resources[] = { 123 + static const struct resource rk817_pwrkey_resources[] = { 124 124 DEFINE_RES_IRQ(RK817_IRQ_PWRON_RISE), 125 125 DEFINE_RES_IRQ(RK817_IRQ_PWRON_FALL), 126 126 };
+2 -2
drivers/mfd/tc3589x.c
··· 141 141 } 142 142 EXPORT_SYMBOL_GPL(tc3589x_set_bits); 143 143 144 - static struct resource gpio_resources[] = { 144 + static const struct resource gpio_resources[] = { 145 145 { 146 146 .start = TC3589x_INT_GPIIRQ, 147 147 .end = TC3589x_INT_GPIIRQ, ··· 149 149 }, 150 150 }; 151 151 152 - static struct resource keypad_resources[] = { 152 + static const struct resource keypad_resources[] = { 153 153 { 154 154 .start = TC3589x_INT_KBDIRQ, 155 155 .end = TC3589x_INT_KBDIRQ,
+1 -1
drivers/mfd/tc6387xb.c
··· 25 25 struct resource rscr; 26 26 }; 27 27 28 - static struct resource tc6387xb_mmc_resources[] = { 28 + static const struct resource tc6387xb_mmc_resources[] = { 29 29 { 30 30 .start = 0x800, 31 31 .end = 0x9ff,
+3 -3
drivers/mfd/tc6393xb.c
··· 133 133 return 0; 134 134 } 135 135 136 - static struct resource tc6393xb_nand_resources[] = { 136 + static const struct resource tc6393xb_nand_resources[] = { 137 137 { 138 138 .start = 0x1000, 139 139 .end = 0x1007, ··· 151 151 }, 152 152 }; 153 153 154 - static struct resource tc6393xb_mmc_resources[] = { 154 + static const struct resource tc6393xb_mmc_resources[] = { 155 155 { 156 156 .start = 0x800, 157 157 .end = 0x9ff, ··· 192 192 }, 193 193 }; 194 194 195 - static struct resource tc6393xb_fb_resources[] = { 195 + static const struct resource tc6393xb_fb_resources[] = { 196 196 { 197 197 .start = 0x5000, 198 198 .end = 0x51ff,
+1 -1
drivers/mfd/tps65090.c
··· 38 38 #define TPS65090_INT2_MASK_OVERLOAD_FET6 6 39 39 #define TPS65090_INT2_MASK_OVERLOAD_FET7 7 40 40 41 - static struct resource charger_resources[] = { 41 + static const struct resource charger_resources[] = { 42 42 { 43 43 .start = TPS65090_IRQ_VAC_STATUS_CHANGE, 44 44 .end = TPS65090_IRQ_VAC_STATUS_CHANGE,
+1 -1
drivers/mfd/tps6586x.c
··· 92 92 [TPS6586X_INT_RTC_ALM2] = TPS6586X_IRQ(TPS6586X_INT_MASK4, 1 << 1), 93 93 }; 94 94 95 - static struct resource tps6586x_rtc_resources[] = { 95 + static const struct resource tps6586x_rtc_resources[] = { 96 96 { 97 97 .start = TPS6586X_INT_RTC_ALM1, 98 98 .end = TPS6586X_INT_RTC_ALM1,
+1 -1
drivers/mfd/tps80031.c
··· 34 34 #include <linux/regmap.h> 35 35 #include <linux/slab.h> 36 36 37 - static struct resource tps80031_rtc_resources[] = { 37 + static const struct resource tps80031_rtc_resources[] = { 38 38 { 39 39 .start = TPS80031_INT_RTC_ALARM, 40 40 .end = TPS80031_INT_RTC_ALARM,