提交 4252de39 编写于 作者: A Arnd Bergmann 提交者: Rob Herring

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: NChen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Fixes: d5e75500 ("of: unitest: Add I2C overlay unit tests.")
Signed-off-by: NRob Herring <robh@kernel.org>
上级 d3a89165
...@@ -979,7 +979,7 @@ static int of_path_platform_device_exists(const char *path) ...@@ -979,7 +979,7 @@ static int of_path_platform_device_exists(const char *path)
return pdev != NULL; return pdev != NULL;
} }
#if IS_ENABLED(CONFIG_I2C) #if IS_BUILTIN(CONFIG_I2C)
/* get the i2c client device instantiated at the path */ /* get the i2c client device instantiated at the path */
static struct i2c_client *of_path_to_i2c_client(const char *path) static struct i2c_client *of_path_to_i2c_client(const char *path)
...@@ -1445,7 +1445,7 @@ static void of_selftest_overlay_11(void) ...@@ -1445,7 +1445,7 @@ static void of_selftest_overlay_11(void)
return; 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 selftest_i2c_bus_data {
struct platform_device *pdev; struct platform_device *pdev;
...@@ -1584,7 +1584,7 @@ static struct i2c_driver selftest_i2c_dev_driver = { ...@@ -1584,7 +1584,7 @@ static struct i2c_driver selftest_i2c_dev_driver = {
.id_table = selftest_i2c_dev_id, .id_table = selftest_i2c_dev_id,
}; };
#if IS_ENABLED(CONFIG_I2C_MUX) #if IS_BUILTIN(CONFIG_I2C_MUX)
struct selftest_i2c_mux_data { struct selftest_i2c_mux_data {
int nchans; int nchans;
...@@ -1695,7 +1695,7 @@ static int of_selftest_overlay_i2c_init(void) ...@@ -1695,7 +1695,7 @@ static int of_selftest_overlay_i2c_init(void)
"could not register selftest i2c bus driver\n")) "could not register selftest i2c bus driver\n"))
return ret; return ret;
#if IS_ENABLED(CONFIG_I2C_MUX) #if IS_BUILTIN(CONFIG_I2C_MUX)
ret = i2c_add_driver(&selftest_i2c_mux_driver); ret = i2c_add_driver(&selftest_i2c_mux_driver);
if (selftest(ret == 0, if (selftest(ret == 0,
"could not register selftest i2c mux driver\n")) "could not register selftest i2c mux driver\n"))
...@@ -1707,7 +1707,7 @@ static int of_selftest_overlay_i2c_init(void) ...@@ -1707,7 +1707,7 @@ static int of_selftest_overlay_i2c_init(void)
static void of_selftest_overlay_i2c_cleanup(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); i2c_del_driver(&selftest_i2c_mux_driver);
#endif #endif
platform_driver_unregister(&selftest_i2c_bus_driver); platform_driver_unregister(&selftest_i2c_bus_driver);
...@@ -1814,7 +1814,7 @@ static void __init of_selftest_overlay(void) ...@@ -1814,7 +1814,7 @@ static void __init of_selftest_overlay(void)
of_selftest_overlay_10(); of_selftest_overlay_10();
of_selftest_overlay_11(); 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")) if (selftest(of_selftest_overlay_i2c_init() == 0, "i2c init failed\n"))
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册