regulator: mcp16502: Remove setup_regulators function
It seems a little bit odd current code pass struct regulator_config rather than a pointer to setup_regulators. The setup_regulators is so simple and only has one caller, so remove it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
4cf469539b
commit
784c24c3e4
@ -427,36 +427,15 @@ static const struct regmap_config mcp16502_regmap_config = {
|
|||||||
.wr_table = &mcp16502_yes_reg_table,
|
.wr_table = &mcp16502_yes_reg_table,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* set_up_regulators() - initialize all regulators
|
|
||||||
*/
|
|
||||||
static int setup_regulators(struct mcp16502 *mcp, struct device *dev,
|
|
||||||
struct regulator_config config)
|
|
||||||
{
|
|
||||||
struct regulator_dev *rdev;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_REGULATORS; i++) {
|
|
||||||
rdev = devm_regulator_register(dev, &mcp16502_desc[i], &config);
|
|
||||||
if (IS_ERR(rdev)) {
|
|
||||||
dev_err(dev,
|
|
||||||
"failed to register %s regulator %ld\n",
|
|
||||||
mcp16502_desc[i].name, PTR_ERR(rdev));
|
|
||||||
return PTR_ERR(rdev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mcp16502_probe(struct i2c_client *client,
|
static int mcp16502_probe(struct i2c_client *client,
|
||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
struct regulator_config config = { };
|
struct regulator_config config = { };
|
||||||
|
struct regulator_dev *rdev;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct mcp16502 *mcp;
|
struct mcp16502 *mcp;
|
||||||
struct regmap *rmap;
|
struct regmap *rmap;
|
||||||
int ret = 0;
|
int i, ret;
|
||||||
|
|
||||||
dev = &client->dev;
|
dev = &client->dev;
|
||||||
config.dev = dev;
|
config.dev = dev;
|
||||||
@ -482,9 +461,15 @@ static int mcp16502_probe(struct i2c_client *client,
|
|||||||
return PTR_ERR(mcp->lpm);
|
return PTR_ERR(mcp->lpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = setup_regulators(mcp, dev, config);
|
for (i = 0; i < NUM_REGULATORS; i++) {
|
||||||
if (ret != 0)
|
rdev = devm_regulator_register(dev, &mcp16502_desc[i], &config);
|
||||||
return ret;
|
if (IS_ERR(rdev)) {
|
||||||
|
dev_err(dev,
|
||||||
|
"failed to register %s regulator %ld\n",
|
||||||
|
mcp16502_desc[i].name, PTR_ERR(rdev));
|
||||||
|
return PTR_ERR(rdev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mcp16502_gpio_set_mode(mcp, MCP16502_OPMODE_ACTIVE);
|
mcp16502_gpio_set_mode(mcp, MCP16502_OPMODE_ACTIVE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user