* [PATCH] clk: max9485: Register a callback to disable the regulator
@ 2022-05-10 8:43 Zheyu Ma
2022-08-15 18:41 ` Stephen Boyd
0 siblings, 1 reply; 2+ messages in thread
From: Zheyu Ma @ 2022-05-10 8:43 UTC (permalink / raw)
To: mturquette, sboyd; +Cc: linux-clk, linux-kernel, Zheyu Ma
The driver should register a callback which can disable the regulator
when it fails to probe.
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
drivers/clk/clk-max9485.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/clk/clk-max9485.c b/drivers/clk/clk-max9485.c
index 5f85b0a32872..7f521205fd7b 100644
--- a/drivers/clk/clk-max9485.c
+++ b/drivers/clk/clk-max9485.c
@@ -254,6 +254,13 @@ max9485_of_clk_get(struct of_phandle_args *clkspec, void *data)
return &drvdata->hw[idx].hw;
}
+static void max9485_disable_regulator(void *arg)
+{
+ struct max9485_driver_data *drvdata = arg;
+
+ regulator_disable(drvdata->supply);
+}
+
static int max9485_i2c_probe(struct i2c_client *client)
{
struct max9485_driver_data *drvdata;
@@ -279,6 +286,10 @@ static int max9485_i2c_probe(struct i2c_client *client)
if (ret < 0)
return ret;
+ ret = devm_add_action_or_reset(dev, max9485_disable_regulator, drvdata->supply);
+ if (ret)
+ return ret;
+
drvdata->reset_gpio =
devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(drvdata->reset_gpio))
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: max9485: Register a callback to disable the regulator
2022-05-10 8:43 [PATCH] clk: max9485: Register a callback to disable the regulator Zheyu Ma
@ 2022-08-15 18:41 ` Stephen Boyd
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2022-08-15 18:41 UTC (permalink / raw)
To: Zheyu Ma, mturquette; +Cc: linux-clk, linux-kernel, Zheyu Ma
Quoting Zheyu Ma (2022-05-10 01:43:15)
> The driver should register a callback which can disable the regulator
> when it fails to probe.
>
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
Looks like there's going to be a devm_regulator_get_enable() API that
we can use instead. Please do that.
https://lore.kernel.org/all/cover.1660292316.git.mazziesaccount@gmail.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-15 19:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 8:43 [PATCH] clk: max9485: Register a callback to disable the regulator Zheyu Ma
2022-08-15 18:41 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome