regulator: ad5398: Convert to devm_regulator_register
authorAxel Lin <axel.lin@ingics.com>
Tue, 3 Sep 2013 06:20:25 +0000 (14:20 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 16 Sep 2013 23:27:55 +0000 (00:27 +0100)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/ad5398.c

index b2b203cb6b2f9373a0d09f5773f3d912922614dd..48016a050d5fb9b9c19981075755bd3831be0652 100644 (file)
@@ -219,7 +219,6 @@ static int ad5398_probe(struct i2c_client *client,
        struct ad5398_chip_info *chip;
        const struct ad5398_current_data_format *df =
                        (struct ad5398_current_data_format *)id->driver_data;
-       int ret;
 
        if (!init_data)
                return -EINVAL;
@@ -240,33 +239,21 @@ static int ad5398_probe(struct i2c_client *client,
        chip->current_offset = df->current_offset;
        chip->current_mask = (chip->current_level - 1) << chip->current_offset;
 
-       chip->rdev = regulator_register(&ad5398_reg, &config);
+       chip->rdev = devm_regulator_register(&client->dev, &ad5398_reg,
+                                            &config);
        if (IS_ERR(chip->rdev)) {
-               ret = PTR_ERR(chip->rdev);
                dev_err(&client->dev, "failed to register %s %s\n",
                        id->name, ad5398_reg.name);
-               goto err;
+               return PTR_ERR(chip->rdev);
        }
 
        i2c_set_clientdata(client, chip);
        dev_dbg(&client->dev, "%s regulator driver is registered.\n", id->name);
        return 0;
-
-err:
-       return ret;
-}
-
-static int ad5398_remove(struct i2c_client *client)
-{
-       struct ad5398_chip_info *chip = i2c_get_clientdata(client);
-
-       regulator_unregister(chip->rdev);
-       return 0;
 }
 
 static struct i2c_driver ad5398_driver = {
        .probe = ad5398_probe,
-       .remove = ad5398_remove,
        .driver         = {
                .name   = "ad5398",
        },