Skip to content

Commit

Permalink
Merge remote-tracking branch 'regulator/topic/devm' into regulator-pa…
Browse files Browse the repository at this point in the history
…lmas

Conflicts:
	drivers/regulator/palmas-regulator.c
  • Loading branch information
Mark Brown committed Sep 16, 2013
2 parents 5957e44 + 0cdfcc0 commit d0175e7
Show file tree
Hide file tree
Showing 50 changed files with 514 additions and 1,099 deletions.
1 change: 1 addition & 0 deletions Documentation/driver-model/devres.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ REGULATOR
devm_regulator_get()
devm_regulator_put()
devm_regulator_bulk_get()
devm_regulator_register()

CLOCK
devm_clk_get()
Expand Down
12 changes: 2 additions & 10 deletions drivers/regulator/88pm8607.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ static int pm8607_regulator_probe(struct platform_device *pdev)
else
config.regmap = chip->regmap_companion;

info->regulator = regulator_register(&info->desc, &config);
info->regulator = devm_regulator_register(&pdev->dev, &info->desc,
&config);
if (IS_ERR(info->regulator)) {
dev_err(&pdev->dev, "failed to register regulator %s\n",
info->desc.name);
Expand All @@ -402,14 +403,6 @@ static int pm8607_regulator_probe(struct platform_device *pdev)
return 0;
}

static int pm8607_regulator_remove(struct platform_device *pdev)
{
struct pm8607_regulator_info *info = platform_get_drvdata(pdev);

regulator_unregister(info->regulator);
return 0;
}

static struct platform_device_id pm8607_regulator_driver_ids[] = {
{
.name = "88pm860x-regulator",
Expand All @@ -428,7 +421,6 @@ static struct platform_driver pm8607_regulator_driver = {
.owner = THIS_MODULE,
},
.probe = pm8607_regulator_probe,
.remove = pm8607_regulator_remove,
.id_table = pm8607_regulator_driver_ids,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#


obj-$(CONFIG_REGULATOR) += core.o dummy.o fixed-helper.o helpers.o
obj-$(CONFIG_REGULATOR) += core.o dummy.o fixed-helper.o helpers.o devres.o
obj-$(CONFIG_OF) += of_regulator.o
obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
Expand Down
11 changes: 1 addition & 10 deletions drivers/regulator/aat2870-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev)
config.driver_data = ri;
config.init_data = dev_get_platdata(&pdev->dev);

rdev = regulator_register(&ri->desc, &config);
rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "Failed to register regulator %s\n",
ri->desc.name);
Expand All @@ -187,21 +187,12 @@ static int aat2870_regulator_probe(struct platform_device *pdev)
return 0;
}

static int aat2870_regulator_remove(struct platform_device *pdev)
{
struct regulator_dev *rdev = platform_get_drvdata(pdev);

regulator_unregister(rdev);
return 0;
}

static struct platform_driver aat2870_regulator_driver = {
.driver = {
.name = "aat2870-regulator",
.owner = THIS_MODULE,
},
.probe = aat2870_regulator_probe,
.remove = aat2870_regulator_remove,
};

static int __init aat2870_regulator_init(void)
Expand Down
19 changes: 3 additions & 16 deletions drivers/regulator/ad5398.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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",
},
Expand Down
3 changes: 1 addition & 2 deletions drivers/regulator/anatop-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
config.regmap = sreg->anatop;

/* register regulator */
rdev = regulator_register(rdesc, &config);
rdev = devm_regulator_register(dev, rdesc, &config);
if (IS_ERR(rdev)) {
dev_err(dev, "failed to register %s\n",
rdesc->name);
Expand All @@ -223,7 +223,6 @@ static int anatop_regulator_remove(struct platform_device *pdev)
struct anatop_regulator *sreg = rdev_get_drvdata(rdev);
const char *name = sreg->name;

regulator_unregister(rdev);
kfree(name);

return 0;
Expand Down
12 changes: 1 addition & 11 deletions drivers/regulator/arizona-ldo1.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
else
config.init_data = &ldo1->init_data;

ldo1->regulator = regulator_register(desc, &config);
ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config);
if (IS_ERR(ldo1->regulator)) {
ret = PTR_ERR(ldo1->regulator);
dev_err(arizona->dev, "Failed to register LDO1 supply: %d\n",
Expand All @@ -239,18 +239,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
return 0;
}

static int arizona_ldo1_remove(struct platform_device *pdev)
{
struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev);

regulator_unregister(ldo1->regulator);

return 0;
}

static struct platform_driver arizona_ldo1_driver = {
.probe = arizona_ldo1_probe,
.remove = arizona_ldo1_remove,
.driver = {
.name = "arizona-ldo1",
.owner = THIS_MODULE,
Expand Down
14 changes: 3 additions & 11 deletions drivers/regulator/arizona-micsupp.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
regmap_update_bits(arizona->regmap, ARIZONA_MIC_CHARGE_PUMP_1,
ARIZONA_CPMIC_BYPASS, 0);

micsupp->regulator = regulator_register(&arizona_micsupp, &config);
micsupp->regulator = devm_regulator_register(&pdev->dev,
&arizona_micsupp,
&config);
if (IS_ERR(micsupp->regulator)) {
ret = PTR_ERR(micsupp->regulator);
dev_err(arizona->dev, "Failed to register mic supply: %d\n",
Expand All @@ -238,18 +240,8 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
return 0;
}

static int arizona_micsupp_remove(struct platform_device *pdev)
{
struct arizona_micsupp *micsupp = platform_get_drvdata(pdev);

regulator_unregister(micsupp->regulator);

return 0;
}

static struct platform_driver arizona_micsupp_driver = {
.probe = arizona_micsupp_probe,
.remove = arizona_micsupp_remove,
.driver = {
.name = "arizona-micsupp",
.owner = THIS_MODULE,
Expand Down
22 changes: 2 additions & 20 deletions drivers/regulator/as3711-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,33 +273,16 @@ static int as3711_regulator_probe(struct platform_device *pdev)
config.regmap = as3711->regmap;
config.of_node = of_node[id];

rdev = regulator_register(&ri->desc, &config);
rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "Failed to register regulator %s\n",
ri->desc.name);
ret = PTR_ERR(rdev);
goto eregreg;
return PTR_ERR(rdev);
}
reg->rdev = rdev;
}
platform_set_drvdata(pdev, regs);
return 0;

eregreg:
while (--id >= 0)
regulator_unregister(regs[id].rdev);

return ret;
}

static int as3711_regulator_remove(struct platform_device *pdev)
{
struct as3711_regulator *regs = platform_get_drvdata(pdev);
int id;

for (id = 0; id < AS3711_REGULATOR_NUM; ++id)
regulator_unregister(regs[id].rdev);
return 0;
}

static struct platform_driver as3711_regulator_driver = {
Expand All @@ -308,7 +291,6 @@ static struct platform_driver as3711_regulator_driver = {
.owner = THIS_MODULE,
},
.probe = as3711_regulator_probe,
.remove = as3711_regulator_remove,
};

static int __init as3711_regulator_init(void)
Expand Down
Loading

0 comments on commit d0175e7

Please sign in to comment.