From: Zheyu Ma <zheyuma97@gmail.com>
To: mturquette@baylibre.com, sboyd@kernel.org
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
Zheyu Ma <zheyuma97@gmail.com>
Subject: [PATCH] clk: max9485: Register a callback to disable the regulator
Date: Tue, 10 May 2022 16:43:15 +0800 [thread overview]
Message-ID: <20220510084315.1706978-1-zheyuma97@gmail.com> (raw)
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
next reply other threads:[~2022-05-10 8:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 8:43 Zheyu Ma [this message]
2022-08-15 18:41 ` Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220510084315.1706978-1-zheyuma97@gmail.com \
--to=zheyuma97@gmail.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®