Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] serial: 8250_hub6: Fix double definition for hub6_match_port()
@ 2026-07-20  8:08 Uwe Kleine-König (The Capable Hub)
  2026-07-20 10:31 ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-07-20  8:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Ilpo Järvinen, Hugo Villeneuve
  Cc: linux-kernel, linux-serial

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) <u.kleine-koenig@baylibre.com>
---
 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
-- 
2.55.0.11.g153666a7d9bb


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: 8250_hub6: Fix double definition for hub6_match_port()
  2026-07-20  8:08 [PATCH] serial: 8250_hub6: Fix double definition for hub6_match_port() Uwe Kleine-König (The Capable Hub)
@ 2026-07-20 10:31 ` Uwe Kleine-König (The Capable Hub)
  2026-07-20 14:07   ` Hugo Villeneuve
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-07-20 10:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Ilpo Järvinen, Hugo Villeneuve
  Cc: linux-kernel, linux-serial

[-- Attachment #1: Type: text/plain, Size: 1702 bytes --]

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) <u.kleine-koenig@baylibre.com>
> ---
>  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/20260715153707.4181828-1-hugo@hugovil.com/

It's a bit different, but essentially equivalent. So please stick to
that older patch.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: 8250_hub6: Fix double definition for hub6_match_port()
  2026-07-20 10:31 ` Uwe Kleine-König (The Capable Hub)
@ 2026-07-20 14:07   ` Hugo Villeneuve
  2026-07-20 21:18     ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Hugo Villeneuve @ 2026-07-20 14:07 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Ilpo Järvinen, Hugo Villeneuve, linux-kernel, linux-serial

Hi Uwe,

On Mon, 20 Jul 2026 12:31:31 +0200
Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> 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) <u.kleine-koenig@baylibre.com>
> > ---
> >  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/20260715153707.4181828-1-hugo@hugovil.com/
> 
> 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.

-- 
Hugo Villeneuve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: 8250_hub6: Fix double definition for hub6_match_port()
  2026-07-20 14:07   ` Hugo Villeneuve
@ 2026-07-20 21:18     ` Uwe Kleine-König
  2026-07-20 22:53       ` Hugo Villeneuve
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2026-07-20 21:18 UTC (permalink / raw)
  To: Hugo Villeneuve
  Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Ilpo Järvinen, Hugo Villeneuve, linux-kernel, linux-serial

[-- Attachment #1: Type: text/plain, Size: 2664 bytes --]

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) <u.kleine-koenig@baylibre.com> 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) <u.kleine-koenig@baylibre.com>
> > > ---
> > >  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/20260715153707.4181828-1-hugo@hugovil.com/
> > 
> > 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: 8250_hub6: Fix double definition for hub6_match_port()
  2026-07-20 21:18     ` Uwe Kleine-König
@ 2026-07-20 22:53       ` Hugo Villeneuve
  0 siblings, 0 replies; 5+ messages in thread
From: Hugo Villeneuve @ 2026-07-20 22:53 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Ilpo Järvinen, Hugo Villeneuve, linux-kernel, linux-serial

Hi Uwe,

On Mon, 20 Jul 2026 23:18:47 +0200
Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:

> 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) <u.kleine-koenig@baylibre.com> 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) <u.kleine-koenig@baylibre.com>
> > > > ---
> > > >  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/20260715153707.4181828-1-hugo@hugovil.com/
> > > 
> > > 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.

I forgot to mention that I temporary removed ISA in Kconfig to be able
to build and test it...

Hugo.

-- 
Hugo Villeneuve

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-20 22:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20  8:08 [PATCH] serial: 8250_hub6: Fix double definition for hub6_match_port() Uwe Kleine-König (The Capable Hub)
2026-07-20 10:31 ` Uwe Kleine-König (The Capable Hub)
2026-07-20 14:07   ` Hugo Villeneuve
2026-07-20 21:18     ` Uwe Kleine-König
2026-07-20 22:53       ` Hugo Villeneuve

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox