Re: [PATCH] serial: 8250: fix compile error with hub6_match_port() when compiled as a module

Uwe Kleine-König <[email protected]> Mon, 20 Jul 2026 12:39:39 +0200
Newsgroups org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel
Message-ID <al35IBntRNPJNoNw@monoceros>
On Wed, Jul 15, 2026 at 11:37:05AM -0400, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <[email protected]>
> 
> With CONFIG_SERIAL_8250_HUB6=m, we have the following compile error:
> 
>   ../drivers/tty/serial/8250/8250_hub6.c:46:6: error: redefinition of
>        'hub6_match_port'
> 
> Fix hub6_match_port() prototype definition by using IS_REACHABLE() to
> support both built-in and module values, and substitute empty prototype
> otherwise.
> 
> Fixes: 3d406299d8829 ("serial: 8250_hub6: add hub6_match_port()")
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Signed-off-by: Hugo Villeneuve <[email protected]>

I hit the same problem and fixed it similarly[1] before spotting this
patch.

> ---
>  drivers/tty/serial/8250/8250.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
> index 9d1068d0489dc..b62f88eec881f 100644
> --- a/drivers/tty/serial/8250/8250.h
> +++ b/drivers/tty/serial/8250/8250.h
> @@ -8,6 +8,7 @@
>   */
>  
>  #include <linux/bits.h>
> +#include <linux/kconfig.h>

This isn't really needed, because the compiler is called with

	-include $(srctree)/include/linux/kconfig.h

which I think you can rely on. But it also doesn't hurt.

>  #include <linux/serial_8250.h>
>  #include <linux/serial_core.h>
>  #include <linux/dmaengine.h>
> @@ -334,7 +335,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_REACHABLE(CONFIG_SERIAL_8250_HUB6)

I picked IS_ENABLED(). Both work fine here. (IS_ENABLED() has the slight
(maybe subjective) advantage to break if CONFIG_SERIAL_8250_HUB6 is
enabled but not reachabe (which currently cannot happen).

Anyhow:

Reviewed-by: Uwe Kleine-König <[email protected]>
Tested-by: Uwe Kleine-König <[email protected]>

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

iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmpd+ucACgkQj4D7WH0S
/k4sDQf+IIH2T/heCwFyutuVwuDpEMD0Zjs6qP1y4aXgIh8vxRO+jltXYBEYBMMx
LVLpZFX00z8xROp3oYzLFhiQqjvaLYr0GPEEDGyaUsQ7MU4KUIi555J9Yo4sgksZ
n9nHQ5ppS+qtEWcShgJZgNBjH6fbiWwkJdPi90XoOKAXYRHGcdmAyLoyNnzvZxr8
J4FegOf/0xfSHWgiOm7VknosO4L9BYrzmPQPRatMO8aStNUhnvLJf9tj7klgDzmh
D6SoEXut+TPxH1NEquZVOjyCiaK+pxvtsaZs1qdkAC4Lv2+C4Fv30acYg4HivVa1
I/cmmq6tiCZuMx5h+Zp2isjEpduQyg==
=WJIb
-----END PGP SIGNATURE-----