diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2015-03-04 14:49:47 -0500 |
|---|---|---|
| committer | Rob Herring <robh@kernel.org> | 2015-03-10 11:34:33 -0400 |
| commit | 4252de39d644d05d0e5f3a19ab6dd056944e64e4 (patch) | |
| tree | 42d52907bfff3227cca205e443bc495dacfe9e88 /drivers/of | |
| parent | d3a891652adb82e1973348c703a597cb54e41dea (diff) | |
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.")
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of')
| -rw-r--r-- | drivers/of/unittest.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 0cf9a236d438..eaef89e8358b 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) | |||
| 979 | return pdev != NULL; | 979 | return pdev != NULL; |
| 980 | } | 980 | } |
| 981 | 981 | ||
| 982 | #if IS_ENABLED(CONFIG_I2C) | 982 | #if IS_BUILTIN(CONFIG_I2C) |
| 983 | 983 | ||
| 984 | /* get the i2c client device instantiated at the path */ | 984 | /* get the i2c client device instantiated at the path */ |
| 985 | static struct i2c_client *of_path_to_i2c_client(const char *path) | 985 | static struct i2c_client *of_path_to_i2c_client(const char *path) |
| @@ -1445,7 +1445,7 @@ static void of_selftest_overlay_11(void) | |||
| 1445 | return; | 1445 | return; |
| 1446 | } | 1446 | } |
| 1447 | 1447 | ||
| 1448 | #if IS_ENABLED(CONFIG_I2C) && IS_ENABLED(CONFIG_OF_OVERLAY) | 1448 | #if IS_BUILTIN(CONFIG_I2C) && IS_ENABLED(CONFIG_OF_OVERLAY) |
| 1449 | 1449 | ||
| 1450 | struct selftest_i2c_bus_data { | 1450 | struct selftest_i2c_bus_data { |
| 1451 | struct platform_device *pdev; | 1451 | struct platform_device *pdev; |
| @@ -1584,7 +1584,7 @@ static struct i2c_driver selftest_i2c_dev_driver = { | |||
| 1584 | .id_table = selftest_i2c_dev_id, | 1584 | .id_table = selftest_i2c_dev_id, |
| 1585 | }; | 1585 | }; |
| 1586 | 1586 | ||
| 1587 | #if IS_ENABLED(CONFIG_I2C_MUX) | 1587 | #if IS_BUILTIN(CONFIG_I2C_MUX) |
| 1588 | 1588 | ||
| 1589 | struct selftest_i2c_mux_data { | 1589 | struct selftest_i2c_mux_data { |
| 1590 | int nchans; | 1590 | int nchans; |
| @@ -1695,7 +1695,7 @@ static int of_selftest_overlay_i2c_init(void) | |||
| 1695 | "could not register selftest i2c bus driver\n")) | 1695 | "could not register selftest i2c bus driver\n")) |
| 1696 | return ret; | 1696 | return ret; |
| 1697 | 1697 | ||
| 1698 | #if IS_ENABLED(CONFIG_I2C_MUX) | 1698 | #if IS_BUILTIN(CONFIG_I2C_MUX) |
| 1699 | ret = i2c_add_driver(&selftest_i2c_mux_driver); | 1699 | ret = i2c_add_driver(&selftest_i2c_mux_driver); |
| 1700 | if (selftest(ret == 0, | 1700 | if (selftest(ret == 0, |
| 1701 | "could not register selftest i2c mux driver\n")) | 1701 | "could not register selftest i2c mux driver\n")) |
| @@ -1707,7 +1707,7 @@ static int of_selftest_overlay_i2c_init(void) | |||
| 1707 | 1707 | ||
| 1708 | static void of_selftest_overlay_i2c_cleanup(void) | 1708 | static void of_selftest_overlay_i2c_cleanup(void) |
| 1709 | { | 1709 | { |
| 1710 | #if IS_ENABLED(CONFIG_I2C_MUX) | 1710 | #if IS_BUILTIN(CONFIG_I2C_MUX) |
| 1711 | i2c_del_driver(&selftest_i2c_mux_driver); | 1711 | i2c_del_driver(&selftest_i2c_mux_driver); |
| 1712 | #endif | 1712 | #endif |
| 1713 | platform_driver_unregister(&selftest_i2c_bus_driver); | 1713 | platform_driver_unregister(&selftest_i2c_bus_driver); |
| @@ -1814,7 +1814,7 @@ static void __init of_selftest_overlay(void) | |||
| 1814 | of_selftest_overlay_10(); | 1814 | of_selftest_overlay_10(); |
| 1815 | of_selftest_overlay_11(); | 1815 | of_selftest_overlay_11(); |
| 1816 | 1816 | ||
| 1817 | #if IS_ENABLED(CONFIG_I2C) | 1817 | #if IS_BUILTIN(CONFIG_I2C) |
| 1818 | if (selftest(of_selftest_overlay_i2c_init() == 0, "i2c init failed\n")) | 1818 | if (selftest(of_selftest_overlay_i2c_init() == 0, "i2c init failed\n")) |
| 1819 | goto out; | 1819 | goto out; |
| 1820 | 1820 | ||
