Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323360
b: refs/heads/master
c: 9ffaa86
h: refs/heads/master
v: v3
  • Loading branch information
Kim, Milo authored and Mark Brown committed Sep 5, 2012
1 parent 490de95 commit c90a3eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 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: ba02dfd205a9c54ac6f9db119d9328d9609615bb
refs/heads/master: 9ffaa8689ea71ad74075dfd2a7520e6b48ecd910
16 changes: 7 additions & 9 deletions trunk/drivers/regulator/lp872x.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,15 @@ static int lp872x_config(struct lp872x *lp)
static struct regulator_init_data
*lp872x_find_regulator_init_data(int id, struct lp872x *lp)
{
struct lp872x_platform_data *pdata = lp->pdata;
int i;

if (!pdata)
return NULL;

for (i = 0; i < lp->num_regulators; i++) {
if (lp->pdata->regulator_data[i].id == id)
return lp->pdata->regulator_data[i].init_data;
if (pdata->regulator_data[i].id == id)
return pdata->regulator_data[i].init_data;
}

return NULL;
Expand Down Expand Up @@ -861,18 +865,12 @@ static const struct regmap_config lp872x_regmap_config = {
static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
{
struct lp872x *lp;
struct lp872x_platform_data *pdata = cl->dev.platform_data;
int ret, size, num_regulators;
const int lp872x_num_regulators[] = {
[LP8720] = LP8720_NUM_REGULATORS,
[LP8725] = LP8725_NUM_REGULATORS,
};

if (!pdata) {
dev_err(&cl->dev, "no platform data\n");
return -EINVAL;
}

lp = devm_kzalloc(&cl->dev, sizeof(struct lp872x), GFP_KERNEL);
if (!lp)
goto err_mem;
Expand All @@ -892,7 +890,7 @@ static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
}

lp->dev = &cl->dev;
lp->pdata = pdata;
lp->pdata = cl->dev.platform_data;
lp->chipid = id->driver_data;
lp->num_regulators = num_regulators;
i2c_set_clientdata(cl, lp);
Expand Down

0 comments on commit c90a3eb

Please sign in to comment.