From: Arnd Bergmann <arnd@arndb.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Chen Gang <xili_gchen_5257@hotmail.com>,
Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] of: Kconfig: Let OF_UNITTEST depend on "I2C=y" and "I2C_MUX=y"
Date: Wed, 04 Mar 2015 20:49:47 +0100 [thread overview]
Message-ID: <2530315.qdy5ZZGCEr@wuerfel> (raw)
In-Reply-To: <CAMuHMdXPONxoNm+stn5sx579kzWo6auVP7hrRv26VSGySr7K2A@mail.gmail.com>
On Wednesday 04 March 2015 16:04:23 Geert Uytterhoeven wrote:
> > - depends on OF_IRQ && OF_EARLY_FLATTREE
> > + depends on OF_IRQ && OF_EARLY_FLATTREE && I2C=y && I2C_MUX=y
>
> ... I think it would be better to replace "#if IS_ENABLED(CONFIG_XXX)" by
> "#ifdef CONFIG_XXX" in drivers/of/unittest.c instead.
>
Agreed. I came across the same bug and came to the same conclusion as you.
How about this:
8<----
Subject: of: unittest: fix I2C dependency
The unittest fails to link if I2C or I2C_MUX is a loadable module:
drivers/built-in.o: In function `selftest_i2c_mux_remove':
unittest.c:(.text+0xb0ce4): undefined reference to `i2c_del_mux_adapter'
This changes the newly added IS_ENABLED() checks to use IS_BUILTIN()
instead, which evaluates to false if the other driver is a module.
Reported-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: d5e75500ca401 ("of: unitest: Add I2C overlay unit tests.")
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 0cf9a236d438..8daa49206c36 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -979,7 +979,7 @@ static int of_path_platform_device_exists(const char *path)
return pdev != NULL;
}
-#if IS_ENABLED(CONFIG_I2C)
+#if IS_BUILTIN(CONFIG_I2C)
/* get the i2c client device instantiated at the path */
static struct i2c_client *of_path_to_i2c_client(const char *path)
@@ -1445,7 +1445,7 @@ static void of_selftest_overlay_11(void)
return;
}
-#if IS_ENABLED(CONFIG_I2C) && IS_ENABLED(CONFIG_OF_OVERLAY)
+#if IS_BUILTIN(CONFIG_I2C) && IS_ENABLED(CONFIG_OF_OVERLAY)
struct selftest_i2c_bus_data {
struct platform_device *pdev;
@@ -1584,7 +1584,7 @@ static struct i2c_driver selftest_i2c_dev_driver = {
.id_table = selftest_i2c_dev_id,
};
-#if IS_ENABLED(CONFIG_I2C_MUX)
+#if IS_BUILTIN(CONFIG_I2C_MUX)
struct selftest_i2c_mux_data {
int nchans;
@@ -1695,7 +1695,7 @@ static int of_selftest_overlay_i2c_init(void)
"could not register selftest i2c bus driver\n"))
return ret;
-#if IS_ENABLED(CONFIG_I2C_MUX)
+#if IS_BUILTIN(CONFIG_I2C_MUX)
ret = i2c_add_driver(&selftest_i2c_mux_driver);
if (selftest(ret == 0,
"could not register selftest i2c mux driver\n"))
@@ -1707,7 +1707,7 @@ static int of_selftest_overlay_i2c_init(void)
static void of_selftest_overlay_i2c_cleanup(void)
{
-#if IS_ENABLED(CONFIG_I2C_MUX)
+#if IS_BUILTIN(CONFIG_I2C_MUX)
i2c_del_driver(&selftest_i2c_mux_driver);
#endif
platform_driver_unregister(&selftest_i2c_bus_driver);
@@ -1814,7 +1814,7 @@ static void __init of_selftest_overlay(void)
of_selftest_overlay_10();
of_selftest_overlay_11();
-#if IS_ENABLED(CONFIG_I2C)
+#if IS_BUILTIN(CONFIG_I2C)
if (selftest(of_selftest_overlay_i2c_init() == 0, "i2c init failed\n"))
goto out;
next prev parent reply other threads:[~2015-03-04 19:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 6:37 [PATCH] of: Kconfig: Let OF_UNITTEST depend on "I2C=y" and "I2C_MUX=y" Chen Gang
2015-03-04 15:04 ` Geert Uytterhoeven
2015-03-04 19:49 ` Arnd Bergmann [this message]
2015-03-04 19:58 ` Pantelis Antoniou
2015-03-05 20:01 ` Rob Herring
2015-03-05 8:06 ` Geert Uytterhoeven
2015-03-05 19:51 ` Chen Gang
2015-03-09 21:28 ` Arnd Bergmann
2015-03-13 15:23 ` Rob Herring
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=2530315.qdy5ZZGCEr@wuerfel \
--to=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=grant.likely@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pantelis.antoniou@konsulko.com \
--cc=robh+dt@kernel.org \
--cc=xili_gchen_5257@hotmail.com \
/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