diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-09-03 02:20:25 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-16 19:27:55 -0400 |
commit | 9b2cdac712448ca182dabeffd36bd532c53f3935 (patch) | |
tree | 479fb246f53aeeb3ca627c92d68f718d51fa4d68 | |
parent | b1a613d505c53ad4f4af4cf228841a1784a50011 (diff) |
regulator: ad5398: Convert to devm_regulator_register
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/regulator/ad5398.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index b2b203cb6b2f..48016a050d5f 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c | |||
@@ -219,7 +219,6 @@ static int ad5398_probe(struct i2c_client *client, | |||
219 | struct ad5398_chip_info *chip; | 219 | struct ad5398_chip_info *chip; |
220 | const struct ad5398_current_data_format *df = | 220 | const struct ad5398_current_data_format *df = |
221 | (struct ad5398_current_data_format *)id->driver_data; | 221 | (struct ad5398_current_data_format *)id->driver_data; |
222 | int ret; | ||
223 | 222 | ||
224 | if (!init_data) | 223 | if (!init_data) |
225 | return -EINVAL; | 224 | return -EINVAL; |
@@ -240,33 +239,21 @@ static int ad5398_probe(struct i2c_client *client, | |||
240 | chip->current_offset = df->current_offset; | 239 | chip->current_offset = df->current_offset; |
241 | chip->current_mask = (chip->current_level - 1) << chip->current_offset; | 240 | chip->current_mask = (chip->current_level - 1) << chip->current_offset; |
242 | 241 | ||
243 | chip->rdev = regulator_register(&ad5398_reg, &config); | 242 | chip->rdev = devm_regulator_register(&client->dev, &ad5398_reg, |
243 | &config); | ||
244 | if (IS_ERR(chip->rdev)) { | 244 | if (IS_ERR(chip->rdev)) { |
245 | ret = PTR_ERR(chip->rdev); | ||
246 | dev_err(&client->dev, "failed to register %s %s\n", | 245 | dev_err(&client->dev, "failed to register %s %s\n", |
247 | id->name, ad5398_reg.name); | 246 | id->name, ad5398_reg.name); |
248 | goto err; | 247 | return PTR_ERR(chip->rdev); |
249 | } | 248 | } |
250 | 249 | ||
251 | i2c_set_clientdata(client, chip); | 250 | i2c_set_clientdata(client, chip); |
252 | dev_dbg(&client->dev, "%s regulator driver is registered.\n", id->name); | 251 | dev_dbg(&client->dev, "%s regulator driver is registered.\n", id->name); |
253 | return 0; | 252 | return 0; |
254 | |||
255 | err: | ||
256 | return ret; | ||
257 | } | ||
258 | |||
259 | static int ad5398_remove(struct i2c_client *client) | ||
260 | { | ||
261 | struct ad5398_chip_info *chip = i2c_get_clientdata(client); | ||
262 | |||
263 | regulator_unregister(chip->rdev); | ||
264 | return 0; | ||
265 | } | 253 | } |
266 | 254 | ||
267 | static struct i2c_driver ad5398_driver = { | 255 | static struct i2c_driver ad5398_driver = { |
268 | .probe = ad5398_probe, | 256 | .probe = ad5398_probe, |
269 | .remove = ad5398_remove, | ||
270 | .driver = { | 257 | .driver = { |
271 | .name = "ad5398", | 258 | .name = "ad5398", |
272 | }, | 259 | }, |