mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Mike Frysinger <vapier@gentoo.org>,
	Ingo Molnar <mingo@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Russell King <linux@arm.linux.org.uk>,
	Michal Simek <monstr@monstr.eu>,
	Ralf Baechle <ralf@linux-mips.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mundt <lethal@linux-sh.org>,
	"David S. Miller" <davem@davemloft.net>,
	Chris Metcalf <cmetcalf@tilera.com>,
	Richard Weinberger <richard@nod.at>
Subject: Re: [PATCH v3] early_printk: consolidate random copies of identical code
Date: Fri, 8 Mar 2013 13:46:11 -0800	[thread overview]
Message-ID: <20130308134611.2273ba694f77f6707532485c@linux-foundation.org> (raw)
In-Reply-To: <1362759080-26098-1-git-send-email-paul.gortmaker@windriver.com>

On Fri, 8 Mar 2013 11:11:20 -0500 Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> The early console implementations are the same all over the place.  Move
> the print function to kernel/printk and get rid of the copies.
> 
> ...
> 
> [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   

I queued the below delta.

I suspect arch/powerpc/kernel/udbg.c is still broken with
CONFIG_EARLY_PRINTK=n?  My powerpc crosscompiler broke and I need to
buy a new one :(

 arch/sparc/kernel/setup_32.c |    1 
 arch/sparc/kernel/setup_64.c |    8 -----
 kernel/printk.c              |   46 ++++++++++++++++-----------------
 3 files changed, 24 insertions(+), 31 deletions(-)

diff -puN arch/sparc/kernel/setup_32.c~early_printk-consolidate-random-copies-of-identical-code-v3 arch/sparc/kernel/setup_32.c
--- a/arch/sparc/kernel/setup_32.c~early_printk-consolidate-random-copies-of-identical-code-v3
+++ a/arch/sparc/kernel/setup_32.c
@@ -309,7 +309,6 @@ void __init setup_arch(char **cmdline_p)
 
 	boot_flags_init(*cmdline_p);
 
-	early_console = &prom_early_console;
 	register_console(&prom_early_console);
 
 	printk("ARCH: ");
diff -puN arch/sparc/kernel/setup_64.c~early_printk-consolidate-random-copies-of-identical-code-v3 arch/sparc/kernel/setup_64.c
--- a/arch/sparc/kernel/setup_64.c~early_printk-consolidate-random-copies-of-identical-code-v3
+++ a/arch/sparc/kernel/setup_64.c
@@ -551,12 +551,6 @@ static void __init init_sparc64_elf_hwca
 		pause_patch();
 }
 
-static inline void register_prom_console(void)
-{
-	early_console = &prom_early_console;
-	register_console(&prom_early_console);
-}
-
 void __init setup_arch(char **cmdline_p)
 {
 	/* Initialize PROM console and command line. */
@@ -568,7 +562,7 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_EARLYFB
 	if (btext_find_display())
 #endif
-		register_prom_console();
+		register_console(&prom_early_console);
 
 	if (tlb_type == hypervisor)
 		printk("ARCH: SUN4V\n");
diff -puN kernel/printk.c~early_printk-consolidate-random-copies-of-identical-code-v3 kernel/printk.c
--- a/kernel/printk.c~early_printk-consolidate-random-copies-of-identical-code-v3
+++ a/kernel/printk.c
@@ -759,29 +759,6 @@ module_param(ignore_loglevel, bool, S_IR
 MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
 	"print all kernel messages to the console.");
 
-#ifdef CONFIG_EARLY_PRINTK
-struct console *early_console;
-
-void early_vprintk(const char *fmt, va_list ap)
-{
-	if (early_console) {
-		char buf[512];
-		int n = vscnprintf(buf, sizeof(buf), fmt, ap);
-
-		early_console->write(early_console, buf, n);
-	}
-}
-
-asmlinkage void early_printk(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	early_vprintk(fmt, ap);
-	va_end(ap);
-}
-#endif
-
 #ifdef CONFIG_BOOT_PRINTK_DELAY
 
 static int boot_delay; /* msecs delay after each printk during bootup */
@@ -1743,6 +1720,29 @@ static size_t cont_print_text(char *text
 
 #endif /* CONFIG_PRINTK */
 
+#ifdef CONFIG_EARLY_PRINTK
+struct console *early_console;
+
+void early_vprintk(const char *fmt, va_list ap)
+{
+	if (early_console) {
+		char buf[512];
+		int n = vscnprintf(buf, sizeof(buf), fmt, ap);
+
+		early_console->write(early_console, buf, n);
+	}
+}
+
+asmlinkage void early_printk(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	early_vprintk(fmt, ap);
+	va_end(ap);
+}
+#endif
+
 static int __add_preferred_console(char *name, int idx, char *options,
 				   char *brl_options)
 {
_


  reply	other threads:[~2013-03-08 21:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 19:15 [PATCH v2] " Paul Gortmaker
2013-03-07 19:25 ` Andrew Morton
2013-03-07 19:50   ` Paul Gortmaker
2013-03-07 20:05     ` Joe Perches
2013-03-07 21:35     ` Andrew Morton
2013-03-07 21:41       ` Thomas Gleixner
2013-03-07 22:47       ` Rob Landley
2013-03-08  0:49       ` Paul Gortmaker
2013-03-08  0:56         ` Andrew Morton
2013-03-08  1:15           ` Paul Gortmaker
2013-03-08  1:10         ` Steven Rostedt
2013-03-08 15:29           ` Guenter Roeck
2013-03-07 20:20   ` Paul Gortmaker
2013-03-07 21:25     ` Thomas Gleixner
2013-03-07 21:43       ` Andrew Morton
2013-03-07 22:34         ` Thomas Gleixner
2013-03-08 16:11           ` [PATCH v3] " Paul Gortmaker
2013-03-08 21:46             ` Andrew Morton [this message]
2013-03-23 21:23             ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130308134611.2273ba694f77f6707532485c@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=cmetcalf@tilera.com \
    --cc=davem@davemloft.net \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@kernel.org \
    --cc=monstr@monstr.eu \
    --cc=paul.gortmaker@windriver.com \
    --cc=ralf@linux-mips.org \
    --cc=rdunlap@infradead.org \
    --cc=richard@nod.at \
    --cc=tglx@linutronix.de \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®