Skip to contentSkip to conversation

regulator: core: set full constraints in regulator_init

PATCH In review Wei Ni 2 participants 3 messages Nov 6, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Wei Ni

author
#0 lore raw

PATCH v2 1/1 regulator: core: set full constraints in regulator_init

When use DT to probe device, the probe routine may be erailier than regulator_init_complete(), so at that time the full_constraints isn't set yet, then the regulator_get() can't get the dummy regulator if the regulator is physically present and enabled.
Set the full constraints in regulator_init() can fix this problem.

Discussed this in the link:
https://lkml.org/lkml/2013/10/8/40

---
 drivers/regulator/core.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/regulator/core.c +9 -9
index 6382f0a..e80dd88 100644
@@ -3773,6 +3773,15 @@ static int __init regulator_init(void)
 
 	regulator_dummy_init();
 
+	/*
+	 * Since DT doesn't provide an idiomatic mechanism for
+	 * enabling full constraints and since it's much more natural
+	 * with DT to provide them just assume that a DT enabled
+	 * system has full constraints.
+	 */
+	if (of_have_populated_dt())
+		has_full_constraints = true;
+
 	return ret;
 }
 
@@ -3786,15 +3795,6 @@ static int __init regulator_init_complete(void)
 	struct regulation_constraints *c;
 	int enabled, ret;
 
-	/*
-	 * Since DT doesn't provide an idiomatic mechanism for
-	 * enabling full constraints and since it's much more natural
-	 * with DT to provide them just assume that a DT enabled
-	 * system has full constraints.
-	 */
-	if (of_have_populated_dt())
-		has_full_constraints = true;
-
 	mutex_lock(&regulator_list_mutex);
 
 	/* If we have a full configuration then disable any regulators
Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): 1383722380-5845-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

author
#2 lore raw

This is v2, previous version is:
[v1]: http://www.spinics.net/lists/linux-tegra/msg14562.html

Quoted 51 lines · Wei Ni

When use DT to probe device, the probe routine may be erailier than regulator_init_complete(), so at that time the full_constraints isn't set yet, then the regulator_get() can't get the dummy regulator if the regulator is physically present and enabled.
Set the full constraints in regulator_init() can fix this problem.

Discussed this in the link:
https://lkml.org/lkml/2013/10/8/40

---
 drivers/regulator/core.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/regulator/core.c +9 -9
index 6382f0a..e80dd88 100644
@@ -3773,6 +3773,15 @@ static int __init regulator_init(void)
 
 	regulator_dummy_init();
 
+	/*
+	 * Since DT doesn't provide an idiomatic mechanism for
+	 * enabling full constraints and since it's much more natural
+	 * with DT to provide them just assume that a DT enabled
+	 * system has full constraints.
+	 */
+	if (of_have_populated_dt())
+		has_full_constraints = true;
+
 	return ret;
 }
 
@@ -3786,15 +3795,6 @@ static int __init regulator_init_complete(void)
 	struct regulation_constraints *c;
 	int enabled, ret;
 
-	/*
-	 * Since DT doesn't provide an idiomatic mechanism for
-	 * enabling full constraints and since it's much more natural
-	 * with DT to provide them just assume that a DT enabled
-	 * system has full constraints.
-	 */
-	if (of_have_populated_dt())
-		has_full_constraints = true;
-
 	mutex_lock(&regulator_list_mutex);
 
 	/* If we have a full configuration then disable any regulators
#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · Wei Ni

When use DT to probe device, the probe routine may be erailier than regulator_init_complete(), so at that time the full_constraints isn't set yet, then the regulator_get() can't get the dummy regulator if the regulator is physically present and enabled.
Set the full constraints in regulator_init() can fix this problem.

As discussed this really needs to be done as part of deciding to use device tree to avoid a window where the issue still remains.