Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Matti Vaittinen and committed by
Stephen Boyd
1ea1543f 9abf2313

+4 -17
+4 -17
drivers/clk/clk-cdce925.c
··· 603 603 return &data->clk[idx].hw; 604 604 } 605 605 606 - static void cdce925_regulator_disable(void *regulator) 607 - { 608 - regulator_disable(regulator); 609 - } 610 - 611 606 static int cdce925_regulator_enable(struct device *dev, const char *name) 612 607 { 613 - struct regulator *regulator; 614 608 int err; 615 609 616 - regulator = devm_regulator_get(dev, name); 617 - if (IS_ERR(regulator)) 618 - return PTR_ERR(regulator); 610 + err = devm_regulator_get_enable(dev, name); 611 + if (err) 612 + dev_err_probe(dev, err, "Failed to enable %s:\n", name); 619 613 620 - err = regulator_enable(regulator); 621 - if (err) { 622 - dev_err(dev, "Failed to enable %s: %d\n", name, err); 623 - return err; 624 - } 625 - 626 - return devm_add_action_or_reset(dev, cdce925_regulator_disable, 627 - regulator); 614 + return err; 628 615 } 629 616 630 617 /* The CDCE925 uses a funky way to read/write registers. Bulk mode is