lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131101134833.7070a5c5@notabene.brown>
Date:	Fri, 1 Nov 2013 13:48:33 +1100
From:	NeilBrown <neilb@...e.de>
To:	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] regulator: check for devicetree early.


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@...e.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(&regulator_list_mutex);
 

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ