]> www.infradead.org Git - users/jedix/linux-maple.git/commit
platform/x86: serial-multi-instantiate: Don't require both I2C and SPI
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Wed, 14 Aug 2024 13:29:39 +0000 (14:29 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 19 Aug 2024 13:16:04 +0000 (15:16 +0200)
commit3900c6ab4129f5e37e95395462688670d117436f
treed4b4958eeadf8aa56c46cb7137cf5e13d2716acc
parentb27622f1317271b88048ff2d76fead28b72aeccf
platform/x86: serial-multi-instantiate: Don't require both I2C and SPI

Change the Kconfig dependency so that it doesn't require both I2C and SPI
subsystems to be built. Make a few small changes to the code so that the
code for a bus is only called if the bus is being built.

When SPI support was added to serial-multi-instantiate it created a
dependency that both CONFIG_I2C and CONFIG_SPI must be enabled.
Typically they are, but there's no reason why this should be a
requirement. A specific kernel build could have only I2C devices
or only SPI devices. It should be possible to use serial-multi-instantiate
if only I2C or only SPI is enabled.

The dependency formula used is:

  depends on (I2C && !SPI) || (!I2C && SPI) || (I2C && SPI)

The advantage of this approach is that if I2C=m or SPI=m then
SERIAL_MULTI_INSTANTIATE is limited to n/m.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240814132939.308696-1-rf@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/Kconfig
drivers/platform/x86/serial-multi-instantiate.c