Skip to contentSkip to conversation

printk: move some loglevel setup functions to kernel/printk.c

PATCH In review Amerigo Wang 2 participants 3 messages Jan 19, 2011 – Jan 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk: move some loglevel setup functions to kernel/printk.c

These parameter setup functions should go to kernel/printk.c, and should also be under CONFIG_PRINTK.

---

init/main.c +0 -23
index 00799c1..b832b69 100644
@@ -240,29 +240,6 @@ unsigned long loops_per_jiffy = (1<<12);
 
 EXPORT_SYMBOL(loops_per_jiffy);
 
-static int __init debug_kernel(char *str)
-{
-	console_loglevel = 10;
-	return 0;
-}
-
-static int __init quiet_kernel(char *str)
-{
-	console_loglevel = 4;
-	return 0;
-}
-
-early_param("debug", debug_kernel);
-early_param("quiet", quiet_kernel);
-
-static int __init loglevel(char *str)
-{
-	get_option(&str, &console_loglevel);
-	return 0;
-}
-
-early_param("loglevel", loglevel);
-
 /*
  * Unknown boot options get handed to init, unless they look like
  * unused parameters (modprobe will find them in /proc/cmdline).
kernel/printk.c +24 -0
index 53d9a9e..e495a2c 100644
@@ -467,6 +467,30 @@ static void __call_console_drivers(unsigned start, unsigned end)
 	}
 }
 
+static int __init debug_kernel(char *str)
+{
+	console_loglevel = 10;
+	return 0;
+}
+
+early_param("debug", debug_kernel);
+
+static int __init quiet_kernel(char *str)
+{
+	console_loglevel = 4;
+	return 0;
+}
+
+early_param("quiet", quiet_kernel);
+
+static int __init loglevel(char *str)
+{
+	get_option(&str, &console_loglevel);
+	return 0;
+}
+
+early_param("loglevel", loglevel);
+
 static int __read_mostly ignore_loglevel;
 
 static int __init ignore_loglevel_setup(char *str)
#1 lore raw
Quoted 1 line
Cc WANG Cong <[email protected]>, Ingo Molnar <[email protected]> (commit_signer:8/43=19%,commit_signer:4/26=15%), Andrew Morton <[email protected]> (commit_signer:7/43=16%,commit_signer:9/26=35%), Peter Zijlstra <[email protected]> (commit_signer:5/43=12%), Tejun Heo <[email protected]> (commit_signer:4/43=9%), Arnd Bergmann <[email protected]> (commit_signer:3/43=7%), James Morris <[email protected]> (commit_signer:6/26=23%), Kees Cook <[email protected]> (commit_signer:4/26=15%), Namhyung Kim <[email protected]> (commit_signer:3/26=12%)

Pease don't do that.

Quoted 1 line · On Wed, 19 Jan 2011 15:29:24 +0800 Amerigo Wang <[email protected]> wrote:

These parameter setup functions should go to kernel/printk.c,

That makes sense.

Quoted 1 line

and should also be under CONFIG_PRINTK.

Not so sure about that. console_loglevel pertains to the console system more than to printk. And the console layer is present even when CONFIG_PRINTK=n.

Now, it may be that console_loglevel never does anything useful when CONFIG_PRINTK=n. In which case one wonders why the console code exists when CONFIG_PRINTK=n.

Anyway. I didn't look at all this terribly hard. Please demonstrate to us that you did do so :)

author
#2 lore raw
Quoted 4 lines · Andrew Morton
Quoted 1 line
Cc WANG Cong<[email protected]>, Ingo Molnar<[email protected]> (commit_signer:8/43=19%,commit_signer:4/26=15%), Andrew Morton<[email protected]> (commit_signer:7/43=16%,commit_signer:9/26=35%), Peter Zijlstra<[email protected]> (commit_signer:5/43=12%), Tejun Heo<[email protected]> (commit_signer:4/43=9%), Arnd Bergmann<[email protected]> (commit_signer:3/43=7%), James Morris<[email protected]> (commit_signer:6/26=23%), Kees Cook<[email protected]> (commit_signer:4/26=15%), Namhyung Kim<[email protected]> (commit_signer:3/26=12%)

Pease don't do that.

Sorry for this, I used get_maintainers.pl in my script, and now I fixed my script. :-/

Quoted 5 lines
Quoted 1 line · On Wed, 19 Jan 2011 15:29:24 +0800 Amerigo Wang<[email protected]> wrote:

These parameter setup functions should go to kernel/printk.c,

Quoted 7 lines

That makes sense.

Quoted 1 line

and should also be under CONFIG_PRINTK.

Not so sure about that. console_loglevel pertains to the console system more than to printk. And the console layer is present even when CONFIG_PRINTK=n.

Such as?

Quoted 8 lines

Now, it may be that console_loglevel never does anything useful when CONFIG_PRINTK=n. In which case one wonders why the console code exists when CONFIG_PRINTK=n.

Anyway. I didn't look at all this terribly hard. Please demonstrate to us that you did do so :)

With CONFIG_PRINTK=n we still have consoles and can still register other consoles, but there will be no messages printed from kernel to console. So, I think "quiet" is only meaningful to CONFIG_PRINTK=y.

Thanks.