From: Javier Martinez Canillas <javier@osg.samsung.com>
To: linux-kernel@vger.kernel.org
Cc: Javier Martinez Canillas <javier@osg.samsung.com>,
<stable@vger.kernel.org>, Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Subject: [PATCH] regulator: Lookup unresolved parent supplies before regulators cleanup
Date: Sun, 20 Mar 2016 23:39:46 -0300 [thread overview]
Message-ID: <1458527986-4576-1-git-send-email-javier@osg.samsung.com> (raw)
Commit 6261b06de565 ("regulator: Defer lookup of supply to regulator_get")
moved the regulator supplies lookup logic from the regulators registration
to the regulators get time.
Unfortunately, that changed the behavior of the regulator core since now a
parent supply with a child regulator marked as always-on, won't be enabled
unless a client driver attempts to get the child regulator during boot.
This patch makes the unresolved parent supplies to be looked up before the
regulators late cleanup, so those with a child marked as always on will be
enabled regardless if a driver attempted to get the child regulator or not.
That was the behavior before the mentioned commit, since parent supplies
were looked up at regulator registration time instead of during child get.
Cc: <stable@vger.kernel.org> # 4.3+
Fixes: 6261b06de565 ("regulator: Defer lookup of supply to regulator_get")
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
Hello,
The commit that caused this issue landed into v4.1 but $SUBJECT can't be
cherry-picked to older kernel versions than v4.3 without causing a merge
conflict. So I added v4.3+ to stable, please let me know if isn't right.
Best regards,
Javier
drivers/regulator/core.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6dd63523bcfe..15dbb771e1d8 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4376,6 +4376,11 @@ static int __init regulator_init(void)
/* init early to allow our consumers to complete system booting */
core_initcall(regulator_init);
+static int __init regulator_late_resolve_supply(struct device *dev, void *data)
+{
+ return regulator_resolve_supply(dev_to_rdev(dev));
+}
+
static int __init regulator_late_cleanup(struct device *dev, void *data)
{
struct regulator_dev *rdev = dev_to_rdev(dev);
@@ -4436,6 +4441,14 @@ static int __init regulator_init_complete(void)
if (of_have_populated_dt())
has_full_constraints = true;
+ /* At this point there may be regulators that were not looked
+ * up by a client driver, so its parent supply was not resolved
+ * and could be wrongly disabled when needed to remain enabled
+ * to meet their child constraints.
+ */
+ class_for_each_device(®ulator_class, NULL, NULL,
+ regulator_late_resolve_supply);
+
/* If we have a full configuration then disable any regulators
* we have permission to change the status for and which are
* not in use or always_on. This is effectively the default
--
2.5.0
next reply other threads:[~2016-03-21 2:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 2:39 Javier Martinez Canillas [this message]
2016-03-21 11:11 ` Mark Brown
2016-03-21 12:13 ` Javier Martinez Canillas
2016-03-21 12:25 ` Javier Martinez Canillas
2016-03-21 12:37 ` Mark Brown
2016-03-21 12:44 ` Javier Martinez Canillas
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=1458527986-4576-1-git-send-email-javier@osg.samsung.com \
--to=javier@osg.samsung.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.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®