i3c, iio: fix i3c driver dependencies
Subsystems (4)
PATCH v2 1/1 i3c, iio: fix i3c driver dependencies
From: Arnd Bergmann <[email protected]>
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.
---
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(-)
drivers/hwmon/Kconfig +2 -4
@@ -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
drivers/i3c/Kconfig +12 -0
@@ -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.
drivers/iio/magnetometer/Kconfig +1 -1
@@ -143,7 +143,7 @@ config MMC5633 tristate "MEMSIC MMC5633 3-axis magnetic sensor" select REGMAP_I2C if I2C select REGMAP_I3C if I3C - depends on I2C || I3C + depends on I3C_OR_I2C help Say yes here to build support for the MEMSIC MMC5633 3-axis magnetic sensor.
drivers/misc/amd-sbi/Kconfig +1 -2
@@ -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.
Signature · 1 line
2.39.5
Quoted 16 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
All combined i2c/i3c drivers appear to suffer from the same link time problem when
CONFIG_I3Cis 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
Kconfigsymbol '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.
Quoted 7 lines
Fixes 6e5f6bf2e3f0 ("iio: magnetometer: Add mmc5633 sensor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: restore accidentally deleted lines--- drivers/hwmon/Kconfig | 6 ++---- drivers/i3c/Kconfig | 12 ++++++++++++
Quoted 80 lines
drivers/iio/magnetometer/Kconfig | 2 +- drivers/misc/amd-sbi/Kconfig | 3 +-- 4 files changed, 16 insertions(+), 7 deletions(-)drivers/hwmon/Kconfig +2
-4@@ -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 helpdrivers/i3c/Kconfig +12
-0@@ -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.drivers/iio/magnetometer/Kconfig +1
-1@@ -143,7 +143,7 @@ config MMC5633 tristate "MEMSIC MMC5633 3-axis magnetic sensor" select REGMAP_I2C if I2C select REGMAP_I3C if I3C - depends on I2C || I3C + depends on I3C_OR_I2C help Say yes here to build support for the MEMSIC MMC5633 3-axis magnetic sensor.drivers/misc/amd-sbi/Kconfig +1
-3@@ -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. --2.39.5
Quoted 16 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
All combined i2c/i3c drivers appear to suffer from the same link time problem when
CONFIG_I3Cis 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
Kconfigsymbol '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.
Quoted 6 lines
Fixes 6e5f6bf2e3f0 ("iio: magnetometer: Add mmc5633 sensor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: restore accidentally deleted lines--- drivers/hwmon/Kconfig | 6 ++----
For hwmon:
Quoted 78 lines
drivers/i3c/Kconfig | 12 ++++++++++++ drivers/iio/magnetometer/Kconfig | 2 +- drivers/misc/amd-sbi/Kconfig | 3 +-- 4 files changed, 16 insertions(+), 7 deletions(-)drivers/hwmon/Kconfig +2
-4@@ -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 helpdrivers/i3c/Kconfig +12
-0@@ -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.drivers/iio/magnetometer/Kconfig +1
-1@@ -143,7 +143,7 @@ config MMC5633 tristate "MEMSIC MMC5633 3-axis magnetic sensor" select REGMAP_I2C if I2C select REGMAP_I3C if I3C - depends on I2C || I3C + depends on I3C_OR_I2C help Say yes here to build support for the MEMSIC MMC5633 3-axis magnetic sensor.drivers/misc/amd-sbi/Kconfig +1
-2@@ -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.
Quoted 24 lines · On Mon, 2 Feb 2026 09:50:58 -0800 Guenter Roeck <[email protected]> wrote:
Quoted 16 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
All combined i2c/i3c drivers appear to suffer from the same link time problem when
CONFIG_I3Cis 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
Kconfigsymbol '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.Quoted 6 lines
Fixes 6e5f6bf2e3f0 ("iio: magnetometer: Add mmc5633 sensor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: restore accidentally deleted lines--- drivers/hwmon/Kconfig | 6 ++----
Quoted 4 lines
For hwmon:
Acked-by Guenter Roeck <[email protected]>
Hi Arnd / All,
I applied a less good fix and the pull request has gone to Greg for the IIO bug. I copied the hwmon config you have below.
So I'm absolutely in favour of this improvement but it's probably a case of rebase after rc1 and it goes in next cycle. Or maybe Greg could pick a rebased version up on top of char-misc-next?
So with it rebased,
Jonathan
Quoted 79 lines
Quoted 78 lines
drivers/i3c/Kconfig | 12 ++++++++++++ drivers/iio/magnetometer/Kconfig | 2 +- drivers/misc/amd-sbi/Kconfig | 3 +-- 4 files changed, 16 insertions(+), 7 deletions(-)drivers/hwmon/Kconfig +2
-4@@ -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 helpdrivers/i3c/Kconfig +12
-0@@ -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.drivers/iio/magnetometer/Kconfig +1
-1@@ -143,7 +143,7 @@ config MMC5633 tristate "MEMSIC MMC5633 3-axis magnetic sensor" select REGMAP_I2C if I2C select REGMAP_I3C if I3C - depends on I2C || I3C + depends on I3C_OR_I2C help Say yes here to build support for the MEMSIC MMC5633 3-axis magnetic sensor.drivers/misc/amd-sbi/Kconfig +1
-2@@ -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.
Alexandre Belloni
maintainerQuoted 36 lines · Jonathan Cameron
Quoted 24 lines · On Mon, 2 Feb 2026 09:50:58 -0800 Guenter Roeck <[email protected]> wrote:
Quoted 16 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
All combined i2c/i3c drivers appear to suffer from the same link time problem when
CONFIG_I3Cis 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
Kconfigsymbol '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.Quoted 6 lines
Fixes 6e5f6bf2e3f0 ("iio: magnetometer: Add mmc5633 sensor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: restore accidentally deleted lines--- drivers/hwmon/Kconfig | 6 ++----Quoted 4 lines
For hwmon:
Acked-by Guenter Roeck <[email protected]>Hi Arnd / All,
I applied a less good fix and the pull request has gone to Greg for the IIO bug. I copied the hwmon config you have below.
Quoted 6 lines
So I'm absolutely in favour of this improvement but it's probably a case of rebase after rc1 and it goes in next cycle. Or maybe Greg could pick a rebased version up on top of char-misc-next?
So with it rebased,
Reviewed-by Jonathan Cameron <[email protected]>
I guess I can pick this up after rc1.
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Arnd Bergmann
maintainerQuoted 5 lines · Alexandre Belloni
Quoted 4 lines · Jonathan Cameron
On Mon, 2 Feb 2026 09:50:58 -0800
Quoted 1 line
Hi Arnd / All,
Quoted 8 lines
Quoted 8 lines
I applied a less good fix and the pull request has gone to Greg for the IIO bug. I copied the hwmon config you have below.
So I'm absolutely in favour of this improvement but it's probably a case of rebase after rc1 and it goes in next cycle. Or maybe Greg could pick a rebased version up on top of char-misc-next?So with it rebased,
Reviewed-by Jonathan Cameron <[email protected]>
Sounds good, thanks!
Quoted 1 line
I guess I can pick this up after rc1.
Ok. I've sent a rebased patch with a slightly adapted changelog text and Jonathan's R-b.
Arnd
Alexandre Belloni
maintainerQuoted 56 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
All combined i2c/i3c drivers appear to suffer from the same link time problem when
CONFIG_I3Cis 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
Kconfigsymbol '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 <[email protected]>---
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(-)drivers/hwmon/Kconfig +2
-4@@ -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 helpdrivers/i3c/Kconfig +0
-0
drivers/i3c/Kconfig menuconfig I3C · line 26
Quoted 5 lines
drivers/i3c/Kconfig +2
-0@@ -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.
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com