[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180306123333.84344-1-arnd@arndb.de>
Date: Tue, 6 Mar 2018 13:33:09 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Maciej Purski <m.purski@...sung.com>,
Chunyan Zhang <zhang.chunyan@...aro.org>,
Tirupathi Reddy <tirupath@...eaurora.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] regulator: don't try to use DT information without CONFIG_OF
The coupled regulator support requires CONFIG_OF today, otherwise
we get a link error:
drivers/regulator/core.o: In function `regulator_fill_coupling_array':
core.c:(.text+0x3e44): undefined reference to `of_parse_coupled_regulator'
drivers/regulator/core.o: In function `regulator_register':
core.c:(.text+0x5eb4): undefined reference to `of_get_n_coupled'
core.c:(.text+0x5f08): undefined reference to `of_check_coupling_data'
This changes the affected functions to return success when CONFIG_OF
is disabled, which should result in the same behavior as before.
Fixes: cf6fc8064766 ("regulator: core: Resolve coupled regulators")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/regulator/core.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index dedf737a2bad..dbc3381105fb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4351,6 +4351,9 @@ static int regulator_register_fill_coupling_array(struct device *dev,
{
struct regulator_dev *rdev = dev_to_rdev(dev);
+ if (!IS_ENABLED(CONFIG_OF))
+ return 0;
+
if (regulator_fill_coupling_array(rdev))
rdev_dbg(rdev, "unable to resolve coupling\n");
@@ -4359,7 +4362,12 @@ static int regulator_register_fill_coupling_array(struct device *dev,
static int regulator_resolve_coupling(struct regulator_dev *rdev)
{
- int n_phandles = of_get_n_coupled(rdev);
+ int n_phandles;
+
+ if (!IS_ENABLED(CONFIG_OF))
+ return 0;
+
+ n_phandles = of_get_n_coupled(rdev);
if (n_phandles + 1 > MAX_COUPLED) {
rdev_err(rdev, "too many regulators coupled\n");
--
2.9.0
Powered by blists - more mailing lists