Re: [PATCH v3] early_printk: consolidate random copies of identical code

From: Geert Uytterhoeven
Date: Sat Mar 23 2013 - 17:23:48 EST


On Fri, Mar 8, 2013 at 5:11 PM, Paul Gortmaker
<paul.gortmaker@xxxxxxxxxxxxx> wrote:
> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>
> The early console implementations are the same all over the place. Move
> the print function to kernel/printk and get rid of the copies.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Russell King <linux@xxxxxxxxxxxxxxxx>
> Acked-by: Mike Frysinger <vapier@xxxxxxxxxx>
> Cc: Michal Simek <monstr@xxxxxxxxx>
> Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
> Cc: Paul Mundt <lethal@xxxxxxxxxxxx>
> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> Cc: Chris Metcalf <cmetcalf@xxxxxxxxxx>
> Cc: Richard Weinberger <richard@xxxxxx>
> Reviewed-by: Ingo Molnar <mingo@xxxxxxxxxx>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
> ---
>
> [v3: drop sparc bits as suggested by tglx, redo build tests on sparc
> sparc32, Randy's randconfig, ppc, mips, arm...]
>
> [v2: essentially unchanged since v1, so I've left the acked/reviewed
> tags. There was a compile fail[1] for a randconfig with EARLY_PRINTK=y
> and PRINTK=n, because the early_console struct and early_printk calls
> were nested within an #ifdef CONFIG_PRINTK -- moving that whole block
> exactly as-is to be outside the #ifdef CONFIG_PRINTK fixes the randconfig
> and still works for everyday sane configs too.]
> [1] http://marc.info/?l=linux-next&m=136219350914998&w=2

> --- a/arch/sh/kernel/sh_bios.c
> +++ b/arch/sh/kernel/sh_bios.c
> @@ -144,8 +144,6 @@ static struct console bios_console = {
> .index = -1,
> };
>
> -static struct console *early_console;

This one wasn't protected by #ifdef CONFIG_EARLY_PRINTK...

> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -1724,6 +1717,29 @@ static size_t cont_print_text(char *text, size_t size) { return 0; }
>
> #endif /* CONFIG_PRINTK */
>
> +#ifdef CONFIG_EARLY_PRINTK
> +struct console *early_console;

... but this one is, causing

arch/sh/kernel/built-in.o: In function `setup_early_printk':
sh_bios.c:(.init.text+0xc80): undefined reference to `early_console'

Cfr. e.g. http://kisskb.ellerman.id.au/kisskb/buildresult/8433720/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/