Re: [PATCH] serial: max310x: fix I2C-only build
From: Arnd Bergmann
Date: Wed May 20 2026 - 10:35:19 EST
On Wed, May 20, 2026, at 16:04, Hugo Villeneuve wrote:
> On Wed, 20 May 2026 08:47:05 +0200
> "Arnd Bergmann" <arnd@xxxxxxxx> wrote:
>> >> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
>> >> index 811250bbbd39..b9b40e80ea81 100644
>> >> --- a/drivers/tty/serial/Kconfig
>> >> +++ b/drivers/tty/serial/Kconfig
>> >> @@ -323,6 +323,7 @@ config SERIAL_MAX3100
>> >> config SERIAL_MAX310X
>> >> tristate "MAX310X support"
>> >> depends on SPI_MASTER || I2C
>> >> + depends on I2C || !I2C
>> >> select SERIAL_CORE
>> >> select REGMAP_SPI if SPI_MASTER
>> >> select REGMAP_I2C if I2C
>>
>> This is still required to avoid a link failure with
>> SERIAL_MAX310X=y and I2C=m. Do you want to include this in
>> a v3 of your patch, or should I send this separately?
>
> If I2C=m, i cannot select SERIAL_MAX310X=y, it is automatically set (or
> reset) to "m", even if I manually force it to "y", do you have the same
> behavior?
The problem happens only when SPI_MASTER=y, in which case the
current logic does allow SERIAL_MAX310X=y. When SPI_MASTER is
disabled, it works correctly as you describe.
> Before i converted the sc16is7xx driver to split i2c/spi, it was done
> like this:
>
> depends on (SPI_MASTER && !I2C) || I2C
>
> Based on what we agree on, I will include it in V3...
Right, the '(SPI_MASTER && !I2C) || I2C' expression is equivalent
to what I suggested. I picked the syntax that I find easier to
understand, but I'm fine with that as well.
Arnd