Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 365026
b: refs/heads/master
c: 018fd85
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Apr 26, 2013
1 parent cbc9354 commit 928b51b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8735bc2fe69c3cd18c54dc1b993106dbeb7618be
refs/heads/master: 018fd856cee9ebe794da1382ff7fafae64781dc5
33 changes: 19 additions & 14 deletions trunk/drivers/regulator/ab3100.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,19 @@ static const u8 ab3100_reg_initvals[] = {
LDO_D_SETTING,
};

static int ab3100_regulators_remove(struct platform_device *pdev)
{
int i;

for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
struct ab3100_regulator *reg = &ab3100_regulators[i];

regulator_unregister(reg->rdev);
reg->rdev = NULL;
}
return 0;
}

static int
ab3100_regulator_of_probe(struct platform_device *pdev, struct device_node *np)
{
Expand All @@ -635,8 +648,10 @@ ab3100_regulator_of_probe(struct platform_device *pdev, struct device_node *np)
pdev, NULL, ab3100_regulator_matches[i].init_data,
ab3100_regulator_matches[i].of_node,
(int) ab3100_regulator_matches[i].driver_data);
if (err)
if (err) {
ab3100_regulators_remove(pdev);
return err;
}
}

return 0;
Expand Down Expand Up @@ -695,25 +710,15 @@ static int ab3100_regulators_probe(struct platform_device *pdev)

err = ab3100_regulator_register(pdev, plfdata, NULL, NULL,
desc->id);
if (err)
if (err) {
ab3100_regulators_remove(pdev);
return err;
}
}

return 0;
}

static int ab3100_regulators_remove(struct platform_device *pdev)
{
int i;

for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
struct ab3100_regulator *reg = &ab3100_regulators[i];

regulator_unregister(reg->rdev);
}
return 0;
}

static struct platform_driver ab3100_regulators_driver = {
.driver = {
.name = "ab3100-regulators",
Expand Down

0 comments on commit 928b51b

Please sign in to comment.