From: Arnd Bergmann <arnd@arndb.de>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Maciej Purski <m.purski@samsung.com>,
Chunyan Zhang <zhang.chunyan@linaro.org>,
Tirupathi Reddy <tirupath@codeaurora.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] regulator: don't try to use DT information without CONFIG_OF
Date: Tue, 6 Mar 2018 13:33:09 +0100 [thread overview]
Message-ID: <20180306123333.84344-1-arnd@arndb.de> (raw)
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@arndb.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
next reply other threads:[~2018-03-06 12:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-06 12:33 Arnd Bergmann [this message]
2018-03-07 14:15 ` Applied "regulator: don't try to use DT information without CONFIG_OF" to the regulator tree Mark Brown
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=20180306123333.84344-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.purski@samsung.com \
--cc=tirupath@codeaurora.org \
--cc=zhang.chunyan@linaro.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
all inboxes | Powered by JetHome®