All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: 8250: fix compile error with hub6_match_port() when compiled as a module
@ 2026-07-15 15:37 Hugo Villeneuve
  2026-07-20 10:39 ` Uwe Kleine-König
  2026-07-20 19:09 ` Andy Shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Hugo Villeneuve @ 2026-07-15 15:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve
  Cc: hugo, kernel test robot, linux-kernel, linux-serial

From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

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 <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202607150717.2YxVdWpX-lkp@intel.com/
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
 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>
 #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)
 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: da7b5fd4e17f8e44c5590f2d603c01d499f056e6
-- 
2.47.3


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

* Re: [PATCH] serial: 8250: fix compile error with hub6_match_port() when compiled as a module
  2026-07-15 15:37 [PATCH] serial: 8250: fix compile error with hub6_match_port() when compiled as a module Hugo Villeneuve
@ 2026-07-20 10:39 ` Uwe Kleine-König
  2026-07-20 19:09 ` Andy Shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2026-07-20 10:39 UTC (permalink / raw)
  To: Hugo Villeneuve
  Cc: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve,
	kernel test robot, linux-kernel, linux-serial

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

On Wed, Jul 15, 2026 at 11:37:05AM -0400, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> 
> 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 <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202607150717.2YxVdWpX-lkp@intel.com/
> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>

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 <u.kleine-koenig@baylibre.com>
Tested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>

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: fix compile error with hub6_match_port() when compiled as a module
  2026-07-15 15:37 [PATCH] serial: 8250: fix compile error with hub6_match_port() when compiled as a module Hugo Villeneuve
  2026-07-20 10:39 ` Uwe Kleine-König
@ 2026-07-20 19:09 ` Andy Shevchenko
  2026-07-20 19:11   ` Hugo Villeneuve
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2026-07-20 19:09 UTC (permalink / raw)
  To: Hugo Villeneuve
  Cc: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve,
	kernel test robot, linux-kernel, linux-serial

On Wed, Jul 15, 2026 at 11:37:05AM -0400, Hugo Villeneuve wrote:

> 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.

...

> +#include <linux/kconfig.h>

It's special header. It is always-included one, and hence here is a dup, please
drop this line.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] serial: 8250: fix compile error with hub6_match_port() when compiled as a module
  2026-07-20 19:09 ` Andy Shevchenko
@ 2026-07-20 19:11   ` Hugo Villeneuve
  2026-07-20 19:36     ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Hugo Villeneuve @ 2026-07-20 19:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve,
	kernel test robot, linux-kernel, linux-serial

Hi Andy,

On Mon, 20 Jul 2026 21:09:03 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Wed, Jul 15, 2026 at 11:37:05AM -0400, Hugo Villeneuve wrote:
> 
> > 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.
> 
> ...
> 
> > +#include <linux/kconfig.h>
> 
> It's special header. It is always-included one, and hence here is a dup, please
> drop this line.

Will do. I will also remove the one in max310x.c which was added by...
me :)

-- 
Hugo Villeneuve

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

* Re: [PATCH] serial: 8250: fix compile error with hub6_match_port() when compiled as a module
  2026-07-20 19:11   ` Hugo Villeneuve
@ 2026-07-20 19:36     ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2026-07-20 19:36 UTC (permalink / raw)
  To: Hugo Villeneuve
  Cc: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve,
	kernel test robot, linux-kernel, linux-serial

On Mon, Jul 20, 2026 at 03:11:40PM -0400, Hugo Villeneuve wrote:
> On Mon, 20 Jul 2026 21:09:03 +0200
> Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> > On Wed, Jul 15, 2026 at 11:37:05AM -0400, Hugo Villeneuve wrote:

...

> > > +#include <linux/kconfig.h>
> > 
> > It's special header. It is always-included one, and hence here is a dup, please
> > drop this line.
> 
> Will do. I will also remove the one in max310x.c which was added by...
> me :)

Yes, please. You can find the similar dropping changes in the lore archive from
the last week, I sent a few. There is a pointer to the commit that makes that
possible.

-- 
With Best Regards,
Andy Shevchenko



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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 15:37 [PATCH] serial: 8250: fix compile error with hub6_match_port() when compiled as a module Hugo Villeneuve
2026-07-20 10:39 ` Uwe Kleine-König
2026-07-20 19:09 ` Andy Shevchenko
2026-07-20 19:11   ` Hugo Villeneuve
2026-07-20 19:36     ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.