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

regulator: as3711: Remove struct as3711_regulator_info and as3711_regulator

This driver does not really need struct as3711_regulator_info and
struct as3711_regulator, remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Axel Lin and committed by
Mark Brown
f668a1db f4192c2c

+7 -30
+7 -30
drivers/regulator/as3711-regulator.c
··· 17 17 #include <linux/regulator/of_regulator.h> 18 18 #include <linux/slab.h> 19 19 20 - struct as3711_regulator_info { 21 - struct regulator_desc desc; 22 - }; 23 - 24 - struct as3711_regulator { 25 - struct as3711_regulator_info *reg_info; 26 - }; 27 - 28 20 /* 29 21 * The regulator API supports 4 modes of operataion: FAST, NORMAL, IDLE and 30 22 * STANDBY. We map them in the following way to AS3711 SD1-4 DCDC modes: ··· 121 129 122 130 #define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _sfx) \ 123 131 [AS3711_REGULATOR_ ## _id] = { \ 124 - .desc = { \ 125 132 .name = "as3711-regulator-" # _id, \ 126 133 .id = AS3711_REGULATOR_ ## _id, \ 127 134 .n_voltages = (_vmask + 1), \ ··· 133 142 .enable_mask = BIT(_en_bit), \ 134 143 .linear_ranges = as3711_ ## _sfx ## _ranges, \ 135 144 .n_linear_ranges = ARRAY_SIZE(as3711_ ## _sfx ## _ranges), \ 136 - }, \ 137 145 } 138 146 139 - static struct as3711_regulator_info as3711_reg_info[] = { 147 + static const struct regulator_desc as3711_reg_desc[] = { 140 148 AS3711_REG(SD_1, SD_CONTROL, 0, 0x7f, sd), 141 149 AS3711_REG(SD_2, SD_CONTROL, 1, 0x7f, sd), 142 150 AS3711_REG(SD_3, SD_CONTROL, 2, 0x7f, sd), ··· 151 161 /* StepUp output voltage depends on supplying regulator */ 152 162 }; 153 163 154 - #define AS3711_REGULATOR_NUM ARRAY_SIZE(as3711_reg_info) 164 + #define AS3711_REGULATOR_NUM ARRAY_SIZE(as3711_reg_desc) 155 165 156 166 static struct of_regulator_match 157 167 as3711_regulator_matches[AS3711_REGULATOR_NUM] = { ··· 205 215 struct as3711_regulator_pdata *pdata = dev_get_platdata(&pdev->dev); 206 216 struct as3711 *as3711 = dev_get_drvdata(pdev->dev.parent); 207 217 struct regulator_config config = {.dev = &pdev->dev,}; 208 - struct as3711_regulator *reg = NULL; 209 - struct as3711_regulator *regs; 210 218 struct device_node *of_node[AS3711_REGULATOR_NUM] = {}; 211 219 struct regulator_dev *rdev; 212 - struct as3711_regulator_info *ri; 213 220 int ret; 214 221 int id; 215 222 ··· 223 236 } 224 237 } 225 238 226 - regs = devm_kcalloc(&pdev->dev, 227 - AS3711_REGULATOR_NUM, 228 - sizeof(struct as3711_regulator), 229 - GFP_KERNEL); 230 - if (!regs) 231 - return -ENOMEM; 232 - 233 - for (id = 0, ri = as3711_reg_info; id < AS3711_REGULATOR_NUM; ++id, ri++) { 234 - reg = &regs[id]; 235 - reg->reg_info = ri; 236 - 239 + for (id = 0; id < AS3711_REGULATOR_NUM; id++) { 237 240 config.init_data = pdata->init_data[id]; 238 - config.driver_data = reg; 239 241 config.regmap = as3711->regmap; 240 242 config.of_node = of_node[id]; 241 243 242 - rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config); 244 + rdev = devm_regulator_register(&pdev->dev, &as3711_reg_desc[id], 245 + &config); 243 246 if (IS_ERR(rdev)) { 244 247 dev_err(&pdev->dev, "Failed to register regulator %s\n", 245 - ri->desc.name); 248 + as3711_reg_desc[id].name); 246 249 return PTR_ERR(rdev); 247 250 } 248 251 } 249 - platform_set_drvdata(pdev, regs); 252 + 250 253 return 0; 251 254 } 252 255