lkml.org 
[lkml]   [2024]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v7 3/7] printk: Flag register_console() if console is set on command line
    Date
    If add_preferred_console() is not called early in setup_console(), we can
    end up having register_console() call try_enable_default_console() before a
    console device has called add_preferred_console().

    Let's set console_set_on_cmdline flag in console_setup() to prevent this
    from happening.

    Signed-off-by: Tony Lindgren <tony@atomide.com>
    ---
    kernel/printk/printk.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
    --- a/kernel/printk/printk.c
    +++ b/kernel/printk/printk.c
    @@ -2498,6 +2498,9 @@ static int __init console_setup(char *str)
    if (console_opt_save(str, brl_options))
    return 1;

    + /* Flag register_console() to not call try_enable_default_console() */
    + console_set_on_cmdline = 1;
    +
    /* Don't attempt to parse a DEVNAME:0.0 style console */
    if (strchr(str, ':'))
    return 1;
    @@ -3501,7 +3504,7 @@ void register_console(struct console *newcon)
    * Note that a console with tty binding will have CON_CONSDEV
    * flag set and will be first in the list.
    */
    - if (preferred_console < 0) {
    + if (preferred_console < 0 && !console_set_on_cmdline) {
    if (hlist_empty(&console_list) || !console_first()->device ||
    console_first()->flags & CON_BOOT) {
    try_enable_default_console(newcon);
    --
    2.44.0
    \
     
     \ /
      Last update: 2024-05-27 16:10    [W:4.899 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site