Message ID | 1347363730-15459-1-git-send-email-sachin.kamat@linaro.org |
---|---|
State | Accepted |
Headers | show |
On Tue, Sep 11, 2012 at 7:42 PM, Sachin Kamat <sachin.kamat@linaro.org> wrote: > Device managed functions are already used in this file. > Hence convert regulator_get() too to use it. > Thanks, applied to my for-next branch. -Bryan > Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> > --- > drivers/leds/leds-lm3530.c | 12 +++--------- > 1 files changed, 3 insertions(+), 9 deletions(-) > > diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c > index 23637bd..1e7ed2a 100644 > --- a/drivers/leds/leds-lm3530.c > +++ b/drivers/leds/leds-lm3530.c > @@ -416,7 +416,7 @@ static int __devinit lm3530_probe(struct i2c_client *client, > > i2c_set_clientdata(client, drvdata); > > - drvdata->regulator = regulator_get(&client->dev, "vin"); > + drvdata->regulator = devm_regulator_get(&client->dev, "vin"); > if (IS_ERR(drvdata->regulator)) { > dev_err(&client->dev, "regulator get failed\n"); > err = PTR_ERR(drvdata->regulator); > @@ -429,15 +429,13 @@ static int __devinit lm3530_probe(struct i2c_client *client, > if (err < 0) { > dev_err(&client->dev, > "Register Init failed: %d\n", err); > - err = -ENODEV; > - goto err_reg_init; > + return -ENODEV; > } > } > err = led_classdev_register(&client->dev, &drvdata->led_dev); > if (err < 0) { > dev_err(&client->dev, "Register led class failed: %d\n", err); > - err = -ENODEV; > - goto err_class_register; > + return -ENODEV; > } > > err = device_create_file(drvdata->led_dev.dev, &dev_attr_mode); > @@ -451,9 +449,6 @@ static int __devinit lm3530_probe(struct i2c_client *client, > > err_create_file: > led_classdev_unregister(&drvdata->led_dev); > -err_class_register: > -err_reg_init: > - regulator_put(drvdata->regulator); > return err; > } > > @@ -465,7 +460,6 @@ static int __devexit lm3530_remove(struct i2c_client *client) > > if (drvdata->enable) > regulator_disable(drvdata->regulator); > - regulator_put(drvdata->regulator); > led_classdev_unregister(&drvdata->led_dev); > return 0; > } > -- > 1.7.4.1 >
diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c index 23637bd..1e7ed2a 100644 --- a/drivers/leds/leds-lm3530.c +++ b/drivers/leds/leds-lm3530.c @@ -416,7 +416,7 @@ static int __devinit lm3530_probe(struct i2c_client *client, i2c_set_clientdata(client, drvdata); - drvdata->regulator = regulator_get(&client->dev, "vin"); + drvdata->regulator = devm_regulator_get(&client->dev, "vin"); if (IS_ERR(drvdata->regulator)) { dev_err(&client->dev, "regulator get failed\n"); err = PTR_ERR(drvdata->regulator); @@ -429,15 +429,13 @@ static int __devinit lm3530_probe(struct i2c_client *client, if (err < 0) { dev_err(&client->dev, "Register Init failed: %d\n", err); - err = -ENODEV; - goto err_reg_init; + return -ENODEV; } } err = led_classdev_register(&client->dev, &drvdata->led_dev); if (err < 0) { dev_err(&client->dev, "Register led class failed: %d\n", err); - err = -ENODEV; - goto err_class_register; + return -ENODEV; } err = device_create_file(drvdata->led_dev.dev, &dev_attr_mode); @@ -451,9 +449,6 @@ static int __devinit lm3530_probe(struct i2c_client *client, err_create_file: led_classdev_unregister(&drvdata->led_dev); -err_class_register: -err_reg_init: - regulator_put(drvdata->regulator); return err; } @@ -465,7 +460,6 @@ static int __devexit lm3530_remove(struct i2c_client *client) if (drvdata->enable) regulator_disable(drvdata->regulator); - regulator_put(drvdata->regulator); led_classdev_unregister(&drvdata->led_dev); return 0; }
Device managed functions are already used in this file. Hence convert regulator_get() too to use it. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> --- drivers/leds/leds-lm3530.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-)