From: Marco Felsch <m.felsch@pengutronix.de>
To: zhang.chunyan@linaro.org, dianders@chromium.org,
lgirdwood@gmail.com, broonie@kernel.org,
ckeepax@opensource.cirrus.com
Cc: linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage
Date: Tue, 17 Sep 2019 17:40:19 +0200 [thread overview]
Message-ID: <20190917154021.14693-2-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20190917154021.14693-1-m.felsch@pengutronix.de>
Since commit 1fc12b05895e ("regulator: core: Avoid propagating to
supplies when possible") regulators marked with boot-on can't be
disabled anymore because the commit handles always-on and boot-on
regulators the same way.
Now commit 05f224ca6693 ("regulator: core: Clean enabling always-on
regulators + their supplies") changed the regulator_resolve_supply()
logic a bit by using 'use_count'. So we can't just skip the
'use_count++' during set_machine_constraints(). The easiest way I found
is to correct the 'use_count' just before returning the rdev device
during regulator_register().
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/regulator/core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e0c0cf462004..f9444f509440 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -5170,6 +5170,11 @@ regulator_register(const struct regulator_desc *regulator_desc,
/* try to resolve regulators supply since a new one was registered */
class_for_each_device(®ulator_class, NULL, NULL,
regulator_register_resolve_supply);
+
+ /* cleanup use_count -> boot-on marked regulators can be disabled */
+ if (rdev->constraints->boot_on && !rdev->constraints->always_on)
+ rdev->use_count--;
+
kfree(config);
return rdev;
--
2.20.1
next prev parent reply other threads:[~2019-09-17 15:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 15:40 [PATCH 0/3] Regulator core fixes Marco Felsch
2019-09-17 15:40 ` Marco Felsch [this message]
2019-09-23 18:02 ` [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage Doug Anderson
2019-09-23 18:14 ` Mark Brown
2019-09-23 18:36 ` Doug Anderson
2019-09-23 18:49 ` Mark Brown
2019-09-23 22:40 ` Doug Anderson
2019-09-24 18:27 ` Mark Brown
2019-09-26 19:44 ` Doug Anderson
2019-09-27 8:47 ` Marco Felsch
2019-10-01 19:57 ` Doug Anderson
2019-10-04 6:34 ` Matti Vaittinen
2019-10-04 11:32 ` Mark Brown
2019-10-04 12:03 ` Vaittinen, Matti
2019-10-04 15:01 ` Mark Brown
2019-10-07 9:34 ` Marco Felsch
2019-10-07 18:29 ` Mark Brown
2019-10-08 6:03 ` Marco Felsch
2019-10-08 12:51 ` Mark Brown
2019-10-08 14:56 ` Marco Felsch
2019-10-08 15:42 ` Mark Brown
2019-10-08 16:16 ` Marco Felsch
2019-10-08 16:23 ` Mark Brown
2019-10-08 20:16 ` Marco Felsch
2019-10-09 9:54 ` Mark Brown
2019-09-17 15:40 ` [PATCH 2/3] regulator: of: fix suspend-min/max-voltage parsing Marco Felsch
2019-09-17 16:02 ` Applied "regulator: of: fix suspend-min/max-voltage parsing" to the regulator tree Mark Brown
2019-09-17 15:40 ` [PATCH 3/3] regulator: core: make regulator_register() EPROBE_DEFER aware Marco Felsch
2019-09-17 16:02 ` Applied "regulator: core: make regulator_register() EPROBE_DEFER aware" to the regulator tree Mark Brown
2019-09-18 0:57 ` [PATCH 3/3] regulator: core: make regulator_register() EPROBE_DEFER aware Dmitry Torokhov
2019-09-18 8:18 ` Marco Felsch
2019-09-18 15:53 ` Dmitry Torokhov
2019-09-18 16:06 ` Marco Felsch
2019-09-18 16:08 ` Mark Brown
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=20190917154021.14693-2-m.felsch@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=dianders@chromium.org \
--cc=kernel@pengutronix.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zhang.chunyan@linaro.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;
as well as URLs for NNTP newsgroup(s).