From: NeilBrown <neilb@suse.de>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] regulator: check for devicetree early.
Date: Fri, 1 Nov 2013 13:48:33 +1100 [thread overview]
Message-ID: <20131101134833.7070a5c5@notabene.brown> (raw)
[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]
The behaviour of regulator core with respect to device-tree and
CONFIG_REGULATOR_DUMMY is inconsistent.
If there is no device-tree, then a board file can call
regulator_has_full_constraints() and this will negate the effect of
CONFIG_REGULATOR_DUMMY.
If a device-tree is given, regulator_has_full_constraints() is called
automatically, but too late to effectively negate the effect of
CONFIG_REGULATOR_DUMMY.
So it makes sense for regulator/core to check for devicetree earlier and call
regulator_has_full_constraints() before any call to regulator_get() can trip
up on CONFIG_REGULATOR_DUMMY.
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a01b8b3b70ca..8cd457ae66bc 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3748,13 +3748,8 @@ static int __init regulator_init(void)
/* init early to allow our consumers to complete system booting */
core_initcall(regulator_init);
-static int __init regulator_init_complete(void)
+static int __init regulator_init_early(void)
{
- struct regulator_dev *rdev;
- struct regulator_ops *ops;
- 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
@@ -3763,6 +3758,16 @@ static int __init regulator_init_complete(void)
*/
if (of_have_populated_dt())
has_full_constraints = true;
+ return 0;
+}
+early_initcall(regulator_init_early);
+
+static int __init regulator_init_complete(void)
+{
+ struct regulator_dev *rdev;
+ struct regulator_ops *ops;
+ struct regulation_constraints *c;
+ int enabled, ret;
mutex_lock(®ulator_list_mutex);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2013-11-01 2:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 2:48 NeilBrown [this message]
2013-11-01 6:42 ` [PATCH] regulator: check for devicetree early Mark Brown
2013-11-01 9:15 ` NeilBrown
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=20131101134833.7070a5c5@notabene.brown \
--to=neilb@suse.de \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@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