diff mbox

powerpc: Only print clockevent settings once

Message ID 20100207222801.GE32246@kryten (mailing list archive)
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Anton Blanchard Feb. 7, 2010, 10:28 p.m. UTC
The clockevent multiplier and shift is useful information, but we
only need to print it once.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Comments

Wolfram Sang Feb. 8, 2010, 4:53 a.m. UTC | #1
On Mon, Feb 08, 2010 at 09:28:01AM +1100, Anton Blanchard wrote:
> 
> The clockevent multiplier and shift is useful information, but we
> only need to print it once.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
> 
> Index: powerpc.git/arch/powerpc/kernel/time.c
> ===================================================================
> --- powerpc.git.orig/arch/powerpc/kernel/time.c	2010-02-05 14:57:48.839716602 +1100
> +++ powerpc.git/arch/powerpc/kernel/time.c	2010-02-05 14:57:53.057212067 +1100
> @@ -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);
> +	}

What about printk_once from kernel.h?
diff mbox

Patch

Index: powerpc.git/arch/powerpc/kernel/time.c
===================================================================
--- powerpc.git.orig/arch/powerpc/kernel/time.c	2010-02-05 14:57:48.839716602 +1100
+++ powerpc.git/arch/powerpc/kernel/time.c	2010-02-05 14:57:53.057212067 +1100
@@ -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);
 }