]> git.karo-electronics.de Git - linux-beck.git/commitdiff
regulator: max8649: Use devm_regulator_register
authorSachin Kamat <sachin.kamat@linaro.org>
Wed, 4 Sep 2013 05:37:57 +0000 (11:07 +0530)
committerMark Brown <broonie@linaro.org>
Mon, 16 Sep 2013 23:28:40 +0000 (00:28 +0100)
devm_* simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/max8649.c

index 19c6f08eafd5bddfe5a626696bafcea8bf5f36ec..7f049c92ee52406bbbc7bd3e08573bdd89f25159 100644 (file)
@@ -234,7 +234,8 @@ static int max8649_regulator_probe(struct i2c_client *client,
        config.driver_data = info;
        config.regmap = info->regmap;
 
-       info->regulator = regulator_register(&dcdc_desc, &config);
+       info->regulator = devm_regulator_register(&client->dev, &dcdc_desc,
+                                                 &config);
        if (IS_ERR(info->regulator)) {
                dev_err(info->dev, "failed to register regulator %s\n",
                        dcdc_desc.name);
@@ -244,16 +245,6 @@ static int max8649_regulator_probe(struct i2c_client *client,
        return 0;
 }
 
-static int max8649_regulator_remove(struct i2c_client *client)
-{
-       struct max8649_regulator_info *info = i2c_get_clientdata(client);
-
-       if (info)
-               regulator_unregister(info->regulator);
-
-       return 0;
-}
-
 static const struct i2c_device_id max8649_id[] = {
        { "max8649", 0 },
        { }
@@ -262,7 +253,6 @@ MODULE_DEVICE_TABLE(i2c, max8649_id);
 
 static struct i2c_driver max8649_driver = {
        .probe          = max8649_regulator_probe,
-       .remove         = max8649_regulator_remove,
        .driver         = {
                .name   = "max8649",
        },