Re: [PATCH -next] printk: Export match_devname_and_update_preferred_console()

From: Tony Lindgren
Date: Mon Sep 09 2024 - 06:56:47 EST


On Mon, Sep 09, 2024 at 11:25:58AM +0300, Tony Lindgren wrote:
> On Mon, Sep 09, 2024 at 03:56:52PM +0800, Yu Liao wrote:
> > When building serial_base as a module, modpost fails with the following
> > error message:
> >
> > ERROR: modpost: "match_devname_and_update_preferred_console"
> > [drivers/tty/serial/serial_base.ko] undefined!
> >
> > Export the symbol to allow using it from modules.
>
> I think the issue is with CONFIG_PRINTK is no set, and serial drivers
> select SERIAL_CORE_CONSOLE? And when serial_base is a module, there is
> no kernel console.
>
> I replied earlier today to the lkp error report along those lines, but
> please let me know if there is more to the issue than that.

Sorry I gave wrong information above. The issue can be hit also with
CONFIG_PRINTK=y and serial_base as a loadable module.

Regards,

Tony

> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202409071312.qlwtTOS1-lkp@xxxxxxxxx/
> > Fixes: 12c91cec3155 ("serial: core: Add serial_base_match_and_update_preferred_console()")
> > Signed-off-by: Yu Liao <liaoyu15@xxxxxxxxxx>
> > ---
> > kernel/printk/printk.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index c22b07049c38..6ff8d47e145f 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -2620,6 +2620,7 @@ int match_devname_and_update_preferred_console(const char *devname,
> >
> > return -ENOENT;
> > }
> > +EXPORT_SYMBOL_GPL(match_devname_and_update_preferred_console);
> >
> > bool console_suspend_enabled = true;
> > EXPORT_SYMBOL(console_suspend_enabled);
> > --
> > 2.33.0
> >