Skip to contentSkip to conversation

powerpc: Only print clockevent settings once

PATCH In review Anton Blanchard 2 participants 3 messages Feb 7, 2010 – Feb 8, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Only print clockevent settings once

The clockevent multiplier and shift is useful information, but we only need to print it once.

---

arch/powerpc/kernel/time.c +6 -2
Index: powerpc.git/arch/powerpc/kernel/time.c
===================================================================
@@ -930,13 +930,17 @@ static void __init setup_clockevent_mult
 
 static void register_decrementer_clockevent(int cpu)
 {
+	static int printed = 0;
 	struct clock_event_device *dec = &per_cpu(decrementers, cpu).event;
 
 	*dec = decrementer_clockevent;
 	dec->cpumask = cpumask_of(cpu);
 
-	printk(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
-	       dec->name, dec->mult, dec->shift, cpu);
+	if (!printed) {
+		printed = 1;
+		printk(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
+		       dec->name, dec->mult, dec->shift, cpu);
+	}
 
 	clockevents_register_device(dec);
 }
#1 lore raw
Quoted 18 lines · Anton Blanchard

The clockevent multiplier and shift is useful information, but we only need to print it once.

---

Index: powerpc.git/arch/powerpc/kernel/time.c
===================================================================

arch/powerpc/kernel/time.c +1 -0
@@ -930,13 +930,17 @@ static void __init setup_clockevent_mult
 
 static void register_decrementer_clockevent(int cpu)
 {
+	static int printed = 0;
 	struct clock_event_device *dec = &per_cpu(decrementers, cpu).event;
 

arch/powerpc/kernel/time.c static void __init setup_clockevent_mult · line 943

Quoted 10 lines
arch/powerpc/kernel/time.c +5 -2
 	*dec = decrementer_clockevent;
 	dec->cpumask = cpumask_of(cpu);
 
-	printk(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
-	       dec->name, dec->mult, dec->shift, cpu);
+	if (!printed) {
+		printed = 1;
+		printk(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
+		       dec->name, dec->mult, dec->shift, cpu);
+	}

What about printk_once from kernel.h?

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw

Hi Wolfram,

Quoted 1 line

What about printk_once from kernel.h?

Thanks for the suggestion!

Anton
--

The clockevent multiplier and shift is useful information, but we only need to print it once.

---

arch/powerpc/kernel/time.c +2 -2
Index: powerpc.git/arch/powerpc/kernel/time.c
===================================================================
@@ -935,8 +935,8 @@ static void register_decrementer_clockev
 	*dec = decrementer_clockevent;
 	dec->cpumask = cpumask_of(cpu);
 
-	printk(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
-	       dec->name, dec->mult, dec->shift, cpu);
+	printk_once(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
+		    dec->name, dec->mult, dec->shift, cpu);
 
 	clockevents_register_device(dec);
 }