* [PATCH v2] regulator: core: set full constraints in regulator_init
@ 2013-11-06 7:19 Wei Ni
[not found] ` <1383722380-5845-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Wei Ni @ 2013-11-06 7:19 UTC (permalink / raw)
To: broonie-DgEjT+Ai2ygdnm+yROfE0A
Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, 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
Signed-off-by: Wei Ni <wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/regulator/core.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6382f0a..e80dd88 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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(®ulator_list_mutex);
/* If we have a full configuration then disable any regulators
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1383722380-5845-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v2] regulator: core: set full constraints in regulator_init [not found] ` <1383722380-5845-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2013-11-06 7:23 ` Wei Ni 2013-11-06 9:07 ` Mark Brown 1 sibling, 0 replies; 3+ messages in thread From: Wei Ni @ 2013-11-06 7:23 UTC (permalink / raw) To: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org Cc: Wei Ni, swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org This is v2, previous version is: [v1]: http://www.spinics.net/lists/linux-tegra/msg14562.html On 11/06/2013 03:19 PM, Wei Ni wrote: > 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 > > Signed-off-by: Wei Ni <wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > drivers/regulator/core.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c > index 6382f0a..e80dd88 100644 > --- a/drivers/regulator/core.c > +++ b/drivers/regulator/core.c > @@ -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(®ulator_list_mutex); > > /* If we have a full configuration then disable any regulators > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] regulator: core: set full constraints in regulator_init [not found] ` <1383722380-5845-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-11-06 7:23 ` Wei Ni @ 2013-11-06 9:07 ` Mark Brown 1 sibling, 0 replies; 3+ messages in thread From: Mark Brown @ 2013-11-06 9:07 UTC (permalink / raw) To: Wei Ni; +Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q, linux-tegra-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 518 bytes --] On Wed, Nov 06, 2013 at 03:19:40PM +0800, Wei Ni wrote: > 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. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-06 9:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-06 7:19 [PATCH v2] regulator: core: set full constraints in regulator_init Wei Ni
[not found] ` <1383722380-5845-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-11-06 7:23 ` Wei Ni
2013-11-06 9:07 ` Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox