Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i3c: simplify combined i3c/i2c dependencies

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>

authored by

Arnd Bergmann and committed by
Alexandre Belloni
663eb876 6de23f81

+16 -8
+2 -4
drivers/hwmon/Kconfig
··· 1493 1493 1494 1494 config SENSORS_LM75 1495 1495 tristate "National Semiconductor LM75 and compatibles" 1496 - depends on I2C 1497 - depends on I3C || !I3C 1496 + depends on I3C_OR_I2C 1498 1497 select REGMAP_I2C 1499 1498 select REGMAP_I3C if I3C 1500 1499 help ··· 2391 2392 2392 2393 config SENSORS_TMP108 2393 2394 tristate "Texas Instruments TMP108" 2394 - depends on I2C 2395 - depends on I3C || !I3C 2395 + depends on I3C_OR_I2C 2396 2396 select REGMAP_I2C 2397 2397 select REGMAP_I3C if I3C 2398 2398 help
+12
drivers/i3c/Kconfig
··· 22 22 if I3C 23 23 source "drivers/i3c/master/Kconfig" 24 24 endif # I3C 25 + 26 + config I3C_OR_I2C 27 + tristate 28 + default m if I3C=m 29 + default I2C 30 + help 31 + Device drivers using module_i3c_i2c_driver() can use either 32 + i2c or i3c hosts, but cannot be built-in for the kernel when 33 + CONFIG_I3C=m. 34 + 35 + Add 'depends on I2C_OR_I3C' in Kconfig for those drivers to 36 + get the correct dependencies.
+1 -2
drivers/iio/magnetometer/Kconfig
··· 143 143 tristate "MEMSIC MMC5633 3-axis magnetic sensor" 144 144 select REGMAP_I2C 145 145 select REGMAP_I3C if I3C 146 - depends on I2C 147 - depends on I3C || !I3C 146 + depends on I3C_OR_I2C 148 147 help 149 148 Say yes here to build support for the MEMSIC MMC5633 3-axis 150 149 magnetic sensor.
+1 -2
drivers/misc/amd-sbi/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 config AMD_SBRMI_I2C 3 3 tristate "AMD side band RMI support" 4 - depends on I2C 4 + depends on I3C_OR_I2C 5 5 depends on ARM || ARM64 || COMPILE_TEST 6 6 select REGMAP_I2C 7 - depends on I3C || !I3C 8 7 select REGMAP_I3C if I3C 9 8 help 10 9 Side band RMI over I2C/I3C support for AMD out of band management.