Re: [PATCH] serial: 8250_hub6: Fix double definition for hub6_match_port()

Uwe Kleine-König <[email protected]> Mon, 20 Jul 2026 23:18:47 +0200
Newsgroups org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel
Message-ID <al6PfMCuRiYcOBQV@monoceros>
On Mon, Jul 20, 2026 at 10:07:08AM -0400, Hugo Villeneuve wrote:
> Hi Uwe,
> 
> On Mon, 20 Jul 2026 12:31:31 +0200
> Uwe Kleine-König (The Capable Hub) <[email protected]> wrote:
> 
> > On Mon, Jul 20, 2026 at 10:08:12AM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > > With CONFIG_SERIAL_8250_HUB6 configured as module
> > > (CONFIG_SERIAL_8250_HUB6=m) the cpp symbol CONFIG_SERIAL_8250_HUB6 isn't
> > > defined (only CONFIG_SERIAL_8250_HUB6_MODULE is). In this case
> > > hub6_match_port() is defined in drivers/tty/serial/8250/8250.h as static
> > > inline and in drivers/tty/serial/8250/8250_hub6.c as normal function.
> > > 
> > > Use IS_ENABLED() to also handle the modular case correctly.
> > > 
> > > Fixes: 3d406299d882 ("serial: 8250_hub6: add hub6_match_port()")
> > > Signed-off-by: Uwe Kleine-König (The Capable Hub) <[email protected]>
> > > ---
> > >  drivers/tty/serial/8250/8250.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
> > > index 9d1068d0489d..fb9a7117d145 100644
> > > --- a/drivers/tty/serial/8250/8250.h
> > > +++ b/drivers/tty/serial/8250/8250.h
> > > @@ -334,7 +334,7 @@ int fintek_8250_probe(struct uart_8250_port *uart);
> > >  static inline int fintek_8250_probe(struct uart_8250_port *uart) { return 0; }
> > >  #endif
> > >  
> > > -#ifdef CONFIG_SERIAL_8250_HUB6
> > > +#if IS_ENABLED(CONFIG_SERIAL_8250_HUB6)
> > >  bool hub6_match_port(const struct uart_port *port1, const struct uart_port *port2);
> > >  #else
> > >  static inline bool hub6_match_port(const struct uart_port *port1, const struct uart_port *port2)
> > > 
> > > base-commit: 0718283ab28bc3907e10b61a6b4be6fefa1cbb2f
> > 
> > There is an earlier fix already at
> > https://lore.kernel.org/linux-serial/[email protected]/
> > 
> > It's a bit different, but essentially equivalent. So please stick to
> > that older patch.
> 
> They are not essentially equivalent. If 
> CONFIG_SERIAL_8250=y and CONFIG_SERIAL_8250_HUB6=m, and using
> IS_ENABLED() gives this linker error:
> 
> ld: vmlinux.o: in function `uart_match_port':
> (.text+0x723aac): undefined reference to `hub6_match_port'
> 
> Using IS_REACHABLE() fixes this.

Oh, I read too quickly over the dependencies, I thought
SERIAL_8250_HUB6's

	depends on SERIAL_8250 != n && ISA && SERIAL_8250_MANY_PORTS

would prevent that. With this configuration and IS_REACHABLE I wonder if
it's an issue that hub6_match_port() returns false in
drivers/tty/serial/serial_core.c.

Best regards
Uwe
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmpekLQACgkQj4D7WH0S
/k4ttgf/XyNvIPniDVbI+JmZ+g1LNaI+ED15dgvl5XmvoV2knVNY745u2O8o0OqB
4dYuExiPngogEMsK2/awmMyegP6pPL8ezhdCg4M0Pzafzm7XSaO8cSfhUSZV3buL
c1Z1BC6fPVK6OA0ZQIdmnUbaNrrLfO5YX9YytNUYwj6BEJoJWCFsJBSiFu4CI1g/
izXqhDyaLMnI+5KkITseN122XWjMM3/JOGCO0HXLqvBqJhlEDoFb5o0T9VRU+8jj
i5Gl315ABTkI/+uOiZN4dT2fJ7UBvNWkBCFDzEY3HPuBRiVlJ6+PU9Da8uir2my2
Z/hLFBNxWd3q7Q/lVOnTA46rtGRi0Q==
=IK4Z
-----END PGP SIGNATURE-----