2015-06-10 15:44 GMT+06:00 Andy Shevchenko <andriy.shevche...@linux.intel.com>:
> You do parsing twice (still original code and your piece here), and
> honestly I don't like your approach in this form.

I just researched earlyprintk and we can use not only serial, but
vga and pciserial. What if I'll rename setup_early_serial_console
to the setup_earlyprintk_console, will add variable, something like
this

static unsigned int early = 1;

to the arch/x86/kernel/earlyprintk.c and refactor the
setup_early_serial_console as:

int __init setup_earlyprintk_console(void)
{
    char *arg;

    arg = strstr(boot_command_line, "earlyprintk=");
    if (!arg)
        return -1;

    early = 0;
    return setup_early_printk(arg);
}

After this we can check in the setup_earlyprintk
is it early to set other consoles or not,

while (*buf != '\0') {
    ....

    #ifdef CONFIG_EARLY_PRINTK_EFI
            if (!strncmp(buf, "efi", 3) && early)
                early_console_register(&early_efi_console, keep);
    #endif
    ....
}
early = 1;

So, when we will call setup_earlyprintk_console from the
arch/x86/kernel/head{32,64}.c, early variable will be 0 and
it allows us to setup only  'real early' consoles and when
setup_earlyprintk will be called by the do_early_param
early variable will be one and we will be able to setup
efi console and etc....

What do you think about it?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to