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

regulator: ad5398: Convert to devm_regulator_register

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

authored by

Axel Lin and committed by
Mark Brown
9b2cdac7 b1a613d5

+3 -16
+3 -16
drivers/regulator/ad5398.c
··· 219 219 struct ad5398_chip_info *chip; 220 220 const struct ad5398_current_data_format *df = 221 221 (struct ad5398_current_data_format *)id->driver_data; 222 - int ret; 223 222 224 223 if (!init_data) 225 224 return -EINVAL; ··· 239 240 chip->current_offset = df->current_offset; 240 241 chip->current_mask = (chip->current_level - 1) << chip->current_offset; 241 242 242 - chip->rdev = regulator_register(&ad5398_reg, &config); 243 + chip->rdev = devm_regulator_register(&client->dev, &ad5398_reg, 244 + &config); 243 245 if (IS_ERR(chip->rdev)) { 244 - ret = PTR_ERR(chip->rdev); 245 246 dev_err(&client->dev, "failed to register %s %s\n", 246 247 id->name, ad5398_reg.name); 247 - goto err; 248 + return PTR_ERR(chip->rdev); 248 249 } 249 250 250 251 i2c_set_clientdata(client, chip); 251 252 dev_dbg(&client->dev, "%s regulator driver is registered.\n", id->name); 252 253 return 0; 253 - 254 - err: 255 - return ret; 256 - } 257 - 258 - static int ad5398_remove(struct i2c_client *client) 259 - { 260 - struct ad5398_chip_info *chip = i2c_get_clientdata(client); 261 - 262 - regulator_unregister(chip->rdev); 263 - return 0; 264 254 } 265 255 266 256 static struct i2c_driver ad5398_driver = { 267 257 .probe = ad5398_probe, 268 - .remove = ad5398_remove, 269 258 .driver = { 270 259 .name = "ad5398", 271 260 },