mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 7/19] UML - timer handler tidying
@ 2006-07-07  0:33 Jeff Dike
  0 siblings, 0 replies; only message in thread
From: Jeff Dike @ 2006-07-07  0:33 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, user-mode-linux-devel

Get rid of a user of timer_irq_inited (and first_tick) by observing
that prev_ticks can be used to decide if this is the first call.

Signed-off-by: Jeff Dike <jdike@addtoit.com>

Index: linux-2.6.16-rc-mm/arch/um/kernel/time_kern.c
===================================================================
--- linux-2.6.16-rc-mm.orig/arch/um/kernel/time_kern.c	2006-06-26 17:50:17.000000000 -0400
+++ linux-2.6.16-rc-mm/arch/um/kernel/time_kern.c	2006-06-28 13:07:08.000000000 -0400
@@ -38,7 +38,6 @@ unsigned long long sched_clock(void)
 /* Changed at early boot */
 int timer_irq_inited = 0;
 
-static int first_tick;
 static unsigned long long prev_nsecs;
 #ifdef CONFIG_UML_REAL_TIME_CLOCK
 static long long delta;   		/* Deviation per interval */
@@ -48,15 +47,8 @@ void timer_irq(union uml_pt_regs *regs)
 {
 	unsigned long long ticks = 0;
 
-	if(!timer_irq_inited){
-		/* This is to ensure that ticks don't pile up when
-		 * the timer handler is suspended */
-		first_tick = 0;
-		return;
-	}
-
-	if(first_tick){
 #ifdef CONFIG_UML_REAL_TIME_CLOCK
+	if(prev_nsecs){
 		/* We've had 1 tick */
 		unsigned long long nsecs = os_nsecs();
 
@@ -69,15 +61,11 @@ void timer_irq(union uml_pt_regs *regs)
 
 		ticks += (delta * HZ) / BILLION;
 		delta -= (ticks * BILLION) / HZ;
+	}
+	else prev_nsecs = os_nsecs();
 #else
-		ticks = 1;
+	ticks = 1;
 #endif
-	}
-	else {
-		prev_nsecs = os_nsecs();
-		first_tick = 1;
-	}
-
 	while(ticks > 0){
 		do_IRQ(TIMER_IRQ, regs);
 		ticks--;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-07  0:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-07  0:33 [PATCH 7/19] UML - timer handler tidying Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome