Hi; I've been looking into what is the right way to handle in Kconfig
an i2c device which is intended for the user to specify on the command
line with a -device option.
(It's the lsm303dlhc magnetometer, currently in code review:
https://patchew.org/QEMU/20210921093227.18592-1-kevin.townsend@linaro.org/ )
Currently all our i2c devices are just pulled in by "select FOO" from
the Kconfig stanza for a board which has that kind of sensor hardwired
on-board. But for at least some of them it works fine to just specify
them on the commandline of any board that has an i2c controller that
allows pluggable devices. (For instance we do that kind of commandline
plugging in our test suite with tests/qtest/tmp105-test.c.)
What's the best way to structure this? For PCI we have the "device
group" PCI_DEVICES as documented in
https://qemu-project.gitlab.io/qemu/devel/kconfig.html#guidelines-for-writing-kconfig-files
and PCI devices say
default y if PCI_DEVICES
depends on PCI
For ISA devices we seem to make them say
default y
depends on ISA_BUS
I2C devices currently just say
depends on I2C
Should we have an I2C_DEVICES, which boards where there's a sensible
user-pluggable i2c controller can specifically select ? Or should we
mark the i2c devices which are sensibly user-pluggable as
"default y" ? Or something else ?