Skip to contentSkip to conversation

printk: Use symbolic defines for console loglevels instead of numbers

PATCH Superseded Alexander Kuleshov 4 participants 7 messages Mar 16, 2015 – Mar 17, 2015

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk: Use symbolic defines for console loglevels instead of numbers

---
 arch/arm/mach-omap2/serial.c | 2 +-
 arch/m68k/mac/macints.c      | 2 +-
 arch/m68k/mac/oss.c          | 4 ++--
 arch/powerpc/kernel/udbg.c   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/serial.c +1 -1
index 57dee0c..5fb50fe 100644
@@ -203,7 +203,7 @@ static int __init omap_serial_early_init(void)
 		if (cmdline_find_option(uart_name)) {
 			console_uart_id = uart->num;
 
-			if (console_loglevel >= 10) {
+			if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) {
 				uart_debug = true;
 				pr_info("%s used as console in debug mode: uart%d clocks will not be gated",
 					uart_name, uart->num);
arch/m68k/mac/macints.c +1 -1
index 5c1a6b2..8996da9 100644
@@ -315,7 +315,7 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
 	while (nmi_hold == 1)
 		udelay(1000);
 
-	if (console_loglevel >= 8) {
+	if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) {
 #if 0
 		struct pt_regs *fp = get_irq_regs();
 		show_state();
arch/m68k/mac/oss.c +2 -2
index 5403712..f38fcbf 100644
@@ -70,7 +70,7 @@ static void oss_irq(unsigned int irq, struct irq_desc *desc)
 	             (OSS_IP_IOPSCC | OSS_IP_SCSI | OSS_IP_IOPISM);
 
 #ifdef DEBUG_IRQS
-	if ((console_loglevel == 10) && !(events & OSS_IP_SCSI)) {
+	if ((console_loglevel == CONSOLE_LOGLEVEL_DEBUG) && !(events & OSS_IP_SCSI)) {
 		printk("oss_irq: irq %u events = 0x%04X\n", irq,
 			(int) oss->irq_pending);
 	}
@@ -107,7 +107,7 @@ static void oss_nubus_irq(unsigned int irq, struct irq_desc *desc)
 		return;
 
 #ifdef DEBUG_NUBUS_INT
-	if (console_loglevel > 7) {
+	if (console_loglevel > CONSOLE_LOGLEVEL_DEFAULT) {
 		printk("oss_nubus_irq: events = 0x%04X\n", events);
 	}
 #endif
arch/powerpc/kernel/udbg.c +1 -1
index b7aa072..5525a85 100644
@@ -76,7 +76,7 @@ void __init udbg_early_init(void)
 #endif
 
 #ifdef CONFIG_PPC_EARLY_DEBUG
-	console_loglevel = 10;
+	console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
 
 	register_early_udbg_console();
 #endif
Signature · 1 line
2.3.3.472.g20ceeac.dirty
#1 lore raw

arch/m68k/mac/macints.c irqreturn_t mac_nmi_handler(int irq, void *dev_id) · line 318

Quoted 8 lines · Alexander Kuleshov
arch/m68k/mac/macints.c +1 -1
@@ -315,7 +315,7 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
        while (nmi_hold == 1)
                udelay(1000);
 
-       if (console_loglevel >= 8) {
+       if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) {

CONSOLE_LOGLEVEL_DEBUG == 10, not 8

As there's no define for 8, perhaps you can use:

"if (console_loglevel > CONSOLE_LOGLEVEL_DEFAULT) {"

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#2 lore raw

Hello Geert,

Yes, i thougt about this issue. I looked in git history and found the commit - a8fe19ebfbfd90ec17c02284717238b02efb9580 where level 8 changed on 10,
so i decided to put CONSOLE_LOGLEVEL_DEBUG here.

2015-03-16 15:20 GMT+06:00 Geert Uytterhoeven <[email protected]>:

Quoted 17 lines

arch/m68k/mac/macints.c irqreturn_t mac_nmi_handler(int irq, void *dev_id) · line 318

Quoted 8 lines · Alexander Kuleshov
arch/m68k/mac/macints.c +1 -1
@@ -315,7 +315,7 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
        while (nmi_hold == 1)
                udelay(1000);
 
-       if (console_loglevel >= 8) {
+       if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) {

CONSOLE_LOGLEVEL_DEBUG == 10, not 8

As there's no define for 8, perhaps you can use:

"if (console_loglevel > CONSOLE_LOGLEVEL_DEFAULT) {"

maintainer Acked-by
#3 lore raw

Hi Alexander,

Quoted 4 lines · Alexander Kuleshov

Yes, i thougt about this issue. I looked in git history and found the commit - a8fe19ebfbfd90ec17c02284717238b02efb9580 where level 8 changed on 10,
so i decided to put CONSOLE_LOGLEVEL_DEBUG here.

Thanks, that makes sense. Please add this valuable information to the patch description, and you can add my

for the m68k part.

Quoted 17 lines

2015-03-16 15:20 GMT+06:00 Geert Uytterhoeven <[email protected]>:

Quoted 16 lines

arch/m68k/mac/macints.c irqreturn_t mac_nmi_handler(int irq, void *dev_id) · line 318

Quoted 8 lines · Alexander Kuleshov
arch/m68k/mac/macints.c +1 -1
@@ -315,7 +315,7 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
        while (nmi_hold == 1)
                udelay(1000);
 
-       if (console_loglevel >= 8) {
+       if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) {

CONSOLE_LOGLEVEL_DEBUG == 10, not 8

As there's no define for 8, perhaps you can use:

"if (console_loglevel > CONSOLE_LOGLEVEL_DEFAULT) {"

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

reviewer Acked-by on v1 1/1
#4 lore raw
In reply to Alexander Kuleshov
Quoted 7 lines · Alexander Kuleshov

---

arch/powerpc/kernel/udbg.c +0 -0
index b7aa072..5525a85 100644

arch/powerpc/kernel/udbg.c void __init udbg_early_init(void) · line 82

Quoted 8 lines
arch/powerpc/kernel/udbg.c +1 -1
@@ -76,7 +76,7 @@ void __init udbg_early_init(void)
 #endif
 
 #ifdef CONFIG_PPC_EARLY_DEBUG
-	console_loglevel = 10;
+	console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
 
 	register_early_udbg_console();
 #endif

cheers

#6 lore raw

2015-03-16 21:09 GMT+06:00 Joe Perches <[email protected]>:

Quoted 8 lines · Alexander Kuleshov
Quoted 1 line

Perhaps the entries for #define CONSOLE_LOGLEVEL_<FOO> from printk.h and #define LOGLEVEL_<FOO> from kern_levels.h can be consolidated and rationalized as well.

Hello Joe,

yes good idea. What was the purpose of adding LOGLEVEL_<FOO> macro? I see that CONSOLE_LOGLEVEL_<FOO> were added earlier. what if we remove LOGLEVL_<FOO> macro and add/adapt missing as CONSOLE_LOGLEVEL_<FOO>, like CONSOLE_LOGLEVEL_SCHED and etc...?