mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
clk: cdce925: simplify using devm_regulator_get_enable()
Simplify the driver using devm_regulator_get_enable() instead of open-coding the devm_add_action_or_reset(). A (minor?) functional change is that we don't print an error in case of a deferred probe. Now we also print the error no matter which of the involved calls caused the failure. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://lore.kernel.org/r/1f46b06be44527a93cd0bfd5de2fa8e2899524ab.1660934107.git.mazziesaccount@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
parent
9abf2313ad
commit
1ea1543fed
@ -603,28 +603,15 @@ of_clk_cdce925_get(struct of_phandle_args *clkspec, void *_data)
|
||||
return &data->clk[idx].hw;
|
||||
}
|
||||
|
||||
static void cdce925_regulator_disable(void *regulator)
|
||||
{
|
||||
regulator_disable(regulator);
|
||||
}
|
||||
|
||||
static int cdce925_regulator_enable(struct device *dev, const char *name)
|
||||
{
|
||||
struct regulator *regulator;
|
||||
int err;
|
||||
|
||||
regulator = devm_regulator_get(dev, name);
|
||||
if (IS_ERR(regulator))
|
||||
return PTR_ERR(regulator);
|
||||
err = devm_regulator_get_enable(dev, name);
|
||||
if (err)
|
||||
dev_err_probe(dev, err, "Failed to enable %s:\n", name);
|
||||
|
||||
err = regulator_enable(regulator);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to enable %s: %d\n", name, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
return devm_add_action_or_reset(dev, cdce925_regulator_disable,
|
||||
regulator);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* The CDCE925 uses a funky way to read/write registers. Bulk mode is
|
||||
|
Loading…
Reference in New Issue
Block a user