]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i3c: simplify combined i3c/i2c dependencies
authorArnd Bergmann <arnd@arndb.de>
Wed, 4 Feb 2026 16:41:58 +0000 (17:41 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 27 Feb 2026 15:33:07 +0000 (16:33 +0100)
All combined i2c/i3c drivers appear to suffer from the same link
time problem when CONFIG_I3C is set to 'm':

arm-linux-gnueabi-ld: drivers/iio/magnetometer/mmc5633.o: in function `mmc5633_i3c_driver_init':
mmc5633.c:(.init.text+0x30): undefined reference to `i3c_driver_register_with_owner'

This was previously fixed every time by marking individual
drivers as 'depends on I2C; depends on I3C || !I3C', but this gets
tedious and is somewhat confusing.

Add a Kconfig symbol 'I3C_OR_I2C' to help replace those dependencies,
and use this in all the existing drivers that had already fixed it
as well as the new mmc5633 driver.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Link: https://patch.msgid.link/20260204164216.544409-1-arnd@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/hwmon/Kconfig
drivers/i3c/Kconfig
drivers/iio/magnetometer/Kconfig
drivers/misc/amd-sbi/Kconfig

index 41c381764c2bc414a187941ec51720025786390a..ecfba861f66dda175e138777a7facac0a15e6615 100644 (file)
@@ -1493,8 +1493,7 @@ config SENSORS_LM73
 
 config SENSORS_LM75
        tristate "National Semiconductor LM75 and compatibles"
-       depends on I2C
-       depends on I3C || !I3C
+       depends on I3C_OR_I2C
        select REGMAP_I2C
        select REGMAP_I3C if I3C
        help
@@ -2392,8 +2391,7 @@ config SENSORS_TMP103
 
 config SENSORS_TMP108
        tristate "Texas Instruments TMP108"
-       depends on I2C
-       depends on I3C || !I3C
+       depends on I3C_OR_I2C
        select REGMAP_I2C
        select REGMAP_I3C if I3C
        help
index 30a441506f61c580c35d11e39b8229160dc74ecf..626c54b386d544c7bac76f847cf73237084c610f 100644 (file)
@@ -22,3 +22,15 @@ menuconfig I3C
 if I3C
 source "drivers/i3c/master/Kconfig"
 endif # I3C
+
+config I3C_OR_I2C
+       tristate
+       default m if I3C=m
+       default I2C
+       help
+         Device drivers using module_i3c_i2c_driver() can use either
+         i2c or i3c hosts, but cannot be built-in for the kernel when
+         CONFIG_I3C=m.
+
+         Add 'depends on I2C_OR_I3C' in Kconfig for those drivers to
+         get the correct dependencies.
index 9345fb6d53178283d04a5a9fb43d9deb4a5112c1..fb313e591e8501db3eb6db268cc63bf55fc5ef6f 100644 (file)
@@ -143,8 +143,7 @@ config MMC5633
        tristate "MEMSIC MMC5633 3-axis magnetic sensor"
        select REGMAP_I2C
        select REGMAP_I3C if I3C
-       depends on I2C
-       depends on I3C || !I3C
+       depends on I3C_OR_I2C
        help
          Say yes here to build support for the MEMSIC MMC5633 3-axis
          magnetic sensor.
index be022c71a90c124717108939c847680d990b2df8..30e7fad7356ccadd95591ce6f779a268a6ecfacf 100644 (file)
@@ -1,10 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config AMD_SBRMI_I2C
        tristate "AMD side band RMI support"
-       depends on I2C
+       depends on I3C_OR_I2C
        depends on ARM || ARM64 || COMPILE_TEST
        select REGMAP_I2C
-       depends on I3C || !I3C
        select REGMAP_I3C if I3C
        help
          Side band RMI over I2C/I3C support for AMD out of band management.