Skip to content

Commit 663eb87

Browse files
arndbalexandrebelloni
authored andcommitted
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>
1 parent 6de23f8 commit 663eb87

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

drivers/hwmon/Kconfig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,8 +1493,7 @@ config SENSORS_LM73
14931493

14941494
config SENSORS_LM75
14951495
tristate "National Semiconductor LM75 and compatibles"
1496-
depends on I2C
1497-
depends on I3C || !I3C
1496+
depends on I3C_OR_I2C
14981497
select REGMAP_I2C
14991498
select REGMAP_I3C if I3C
15001499
help
@@ -2392,8 +2391,7 @@ config SENSORS_TMP103
23922391

23932392
config SENSORS_TMP108
23942393
tristate "Texas Instruments TMP108"
2395-
depends on I2C
2396-
depends on I3C || !I3C
2394+
depends on I3C_OR_I2C
23972395
select REGMAP_I2C
23982396
select REGMAP_I3C if I3C
23992397
help

drivers/i3c/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,15 @@ menuconfig I3C
2222
if I3C
2323
source "drivers/i3c/master/Kconfig"
2424
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.

drivers/iio/magnetometer/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ config MMC5633
143143
tristate "MEMSIC MMC5633 3-axis magnetic sensor"
144144
select REGMAP_I2C
145145
select REGMAP_I3C if I3C
146-
depends on I2C
147-
depends on I3C || !I3C
146+
depends on I3C_OR_I2C
148147
help
149148
Say yes here to build support for the MEMSIC MMC5633 3-axis
150149
magnetic sensor.

drivers/misc/amd-sbi/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config AMD_SBRMI_I2C
33
tristate "AMD side band RMI support"
4-
depends on I2C
4+
depends on I3C_OR_I2C
55
depends on ARM || ARM64 || COMPILE_TEST
66
select REGMAP_I2C
7-
depends on I3C || !I3C
87
select REGMAP_I3C if I3C
98
help
109
Side band RMI over I2C/I3C support for AMD out of band management.

0 commit comments

Comments
 (0)