diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/regulator/max8660.c | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/regulator/max8660.c')
-rw-r--r-- | drivers/regulator/max8660.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index 8d94d3d..144bcac 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c @@ -439,7 +439,7 @@ static int max8660_probe(struct i2c_client *client, for (i = 0; i < pdata->num_subdevs; i++) { if (!pdata->subdevs[i].platform_data) - return ret; + goto err_out; boot_on = pdata->subdevs[i].platform_data->constraints.boot_on; @@ -465,7 +465,7 @@ static int max8660_probe(struct i2c_client *client, case MAX8660_V7: if (type == MAX8661) { dev_err(dev, "Regulator not on this chip!\n"); - return -EINVAL; + goto err_out; } if (boot_on) @@ -475,7 +475,7 @@ static int max8660_probe(struct i2c_client *client, default: dev_err(dev, "invalid regulator %s\n", pdata->subdevs[i].name); - return ret; + goto err_out; } } @@ -489,18 +489,33 @@ static int max8660_probe(struct i2c_client *client, config.of_node = of_node[i]; config.driver_data = max8660; - rdev[i] = devm_regulator_register(&client->dev, - &max8660_reg[id], &config); + rdev[i] = regulator_register(&max8660_reg[id], &config); if (IS_ERR(rdev[i])) { ret = PTR_ERR(rdev[i]); - dev_err(&client->dev, "failed to register %s\n", + dev_err(dev, "failed to register %s\n", max8660_reg[id].name); - return PTR_ERR(rdev[i]); + goto err_unregister; } } i2c_set_clientdata(client, max8660); return 0; + +err_unregister: + while (--i >= 0) + regulator_unregister(rdev[i]); +err_out: + return ret; +} + +static int max8660_remove(struct i2c_client *client) +{ + struct max8660 *max8660 = i2c_get_clientdata(client); + int i; + + for (i = 0; i < MAX8660_V_END; i++) + regulator_unregister(max8660->rdev[i]); + return 0; } static const struct i2c_device_id max8660_id[] = { @@ -512,6 +527,7 @@ MODULE_DEVICE_TABLE(i2c, max8660_id); static struct i2c_driver max8660_driver = { .probe = max8660_probe, + .remove = max8660_remove, .driver = { .name = "max8660", .owner = THIS_MODULE, |