|
@@ -339,22 +339,18 @@ static int lp8755_regulator_init(struct lp8755_chip *pchip)
|
|
|
rconfig.init_data = pdata->buck_data[buck_num];
|
|
rconfig.init_data = pdata->buck_data[buck_num];
|
|
|
rconfig.of_node = pchip->dev->of_node;
|
|
rconfig.of_node = pchip->dev->of_node;
|
|
|
pchip->rdev[buck_num] =
|
|
pchip->rdev[buck_num] =
|
|
|
- regulator_register(&lp8755_regulators[buck_num], &rconfig);
|
|
|
|
|
|
|
+ devm_regulator_register(pchip->dev,
|
|
|
|
|
+ &lp8755_regulators[buck_num], &rconfig);
|
|
|
if (IS_ERR(pchip->rdev[buck_num])) {
|
|
if (IS_ERR(pchip->rdev[buck_num])) {
|
|
|
ret = PTR_ERR(pchip->rdev[buck_num]);
|
|
ret = PTR_ERR(pchip->rdev[buck_num]);
|
|
|
pchip->rdev[buck_num] = NULL;
|
|
pchip->rdev[buck_num] = NULL;
|
|
|
dev_err(pchip->dev, "regulator init failed: buck %d\n",
|
|
dev_err(pchip->dev, "regulator init failed: buck %d\n",
|
|
|
buck_num);
|
|
buck_num);
|
|
|
- goto err_buck;
|
|
|
|
|
|
|
+ return ret;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
-
|
|
|
|
|
-err_buck:
|
|
|
|
|
- for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
|
|
|
|
- regulator_unregister(pchip->rdev[icnt]);
|
|
|
|
|
- return ret;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static irqreturn_t lp8755_irq_handler(int irq, void *data)
|
|
static irqreturn_t lp8755_irq_handler(int irq, void *data)
|
|
@@ -490,23 +486,19 @@ static int lp8755_probe(struct i2c_client *client,
|
|
|
ret = lp8755_regulator_init(pchip);
|
|
ret = lp8755_regulator_init(pchip);
|
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|
|
|
dev_err(&client->dev, "fail to initialize regulators\n");
|
|
dev_err(&client->dev, "fail to initialize regulators\n");
|
|
|
- goto err_regulator;
|
|
|
|
|
|
|
+ goto err;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pchip->irq = client->irq;
|
|
pchip->irq = client->irq;
|
|
|
ret = lp8755_int_config(pchip);
|
|
ret = lp8755_int_config(pchip);
|
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|
|
|
dev_err(&client->dev, "fail to irq config\n");
|
|
dev_err(&client->dev, "fail to irq config\n");
|
|
|
- goto err_irq;
|
|
|
|
|
|
|
+ goto err;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
|
|
-err_irq:
|
|
|
|
|
- for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++)
|
|
|
|
|
- regulator_unregister(pchip->rdev[icnt]);
|
|
|
|
|
-
|
|
|
|
|
-err_regulator:
|
|
|
|
|
|
|
+err:
|
|
|
/* output disable */
|
|
/* output disable */
|
|
|
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
|
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
|
|
lp8755_write(pchip, icnt, 0x00);
|
|
lp8755_write(pchip, icnt, 0x00);
|
|
@@ -519,9 +511,6 @@ static int lp8755_remove(struct i2c_client *client)
|
|
|
int icnt;
|
|
int icnt;
|
|
|
struct lp8755_chip *pchip = i2c_get_clientdata(client);
|
|
struct lp8755_chip *pchip = i2c_get_clientdata(client);
|
|
|
|
|
|
|
|
- for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++)
|
|
|
|
|
- regulator_unregister(pchip->rdev[icnt]);
|
|
|
|
|
-
|
|
|
|
|
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
|
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
|
|
lp8755_write(pchip, icnt, 0x00);
|
|
lp8755_write(pchip, icnt, 0x00);
|
|
|
|
|
|