Re: [PATCH] [v2] i3c, iio: fix i3c driver dependencies
From: Alexandre Belloni
Date: Wed Feb 04 2026 - 11:33:43 EST
On 02/02/2026 17:04:46+0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> 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 several times 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.
>
> Fixes: 6e5f6bf2e3f0 ("iio: magnetometer: Add mmc5633 sensor")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> v2: restore accidentally deleted lines
> ---
> drivers/hwmon/Kconfig | 6 ++----
> drivers/i3c/Kconfig | 12 ++++++++++++
> drivers/iio/magnetometer/Kconfig | 2 +-
> drivers/misc/amd-sbi/Kconfig | 3 +--
> 4 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 41c381764c2b..ecfba861f66d 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -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
> diff --git a/drivers/i3c/Kconfig b/drivers/i3c/Kconfig
> index 30a441506f61..626c54b386d5 100644
> --- a/drivers/i3c/Kconfig
> +++ b/drivers/i3c/Kconfig
> @@ -22,3 +22,15 @@ menuconfig I3C
> if I3C
> source "drivers/i3c/master/Kconfig"
> endif # I3C
> +
> +config I3C_OR_I2C
I'm fine with this but I wanted to mention that we have RTC_I2C_AND_SPI
the "and" being because it is from the point of view of the device (the
device supports both bus) while we have I3C_OR_I2C, "or" being about the
bus (the device can be on any bus).
So I guess at some point we are going to need a combination of
I3C_OR_I2C and SPI and this may be weird to have both OR and AND.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com