[PATCH] uml: timer initialization cleanup
This cleans up the mess that is the timer initialization. There used to be two timer handlers - one that basically ran during delay loop calibration and one that handled the timer afterwards. There were also two sets of timer initialization code - one that starts in user code and calls into the kernel side of the house, and one that starts in kernel code and calls user code. This eliminates one timer handler and consolidates the two sets of initialization code. [akpm@osdl.org: use new INTF_ flags] Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
598d188af1
commit
aceb343464
@ -84,29 +84,6 @@ void timer_irq(union uml_pt_regs *regs)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void time_init_kern(void)
|
||||
{
|
||||
long long nsecs;
|
||||
|
||||
nsecs = os_nsecs();
|
||||
set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
|
||||
-nsecs % BILLION);
|
||||
}
|
||||
|
||||
void do_boot_timer_handler(struct sigcontext * sc)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct pt_regs regs;
|
||||
|
||||
CHOOSE_MODE((void) (UPT_SC(®s.regs) = sc),
|
||||
(void) (regs.regs.skas.is_user = 0));
|
||||
|
||||
write_seqlock_irqsave(&xtime_lock, flags);
|
||||
do_timer(®s);
|
||||
write_sequnlock_irqrestore(&xtime_lock, flags);
|
||||
}
|
||||
|
||||
static DEFINE_SPINLOCK(timer_spinlock);
|
||||
|
||||
static unsigned long long local_offset = 0;
|
||||
@ -142,6 +119,32 @@ irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static void register_timer(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL);
|
||||
if(err != 0)
|
||||
printk(KERN_ERR "timer_init : request_irq failed - "
|
||||
"errno = %d\n", -err);
|
||||
|
||||
timer_irq_inited = 1;
|
||||
|
||||
user_time_init();
|
||||
}
|
||||
|
||||
extern void (*late_time_init)(void);
|
||||
|
||||
void time_init(void)
|
||||
{
|
||||
long long nsecs;
|
||||
|
||||
nsecs = os_nsecs();
|
||||
set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
|
||||
-nsecs % BILLION);
|
||||
late_time_init = register_timer;
|
||||
}
|
||||
|
||||
void do_gettimeofday(struct timeval *tv)
|
||||
{
|
||||
unsigned long long nsecs = get_time();
|
||||
@ -189,18 +192,3 @@ void timer_handler(int sig, union uml_pt_regs *regs)
|
||||
if(current_thread->cpu == 0)
|
||||
timer_irq(regs);
|
||||
}
|
||||
|
||||
int __init timer_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
user_time_init();
|
||||
err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL);
|
||||
if(err != 0)
|
||||
printk(KERN_ERR "timer_init : request_irq failed - "
|
||||
"errno = %d\n", -err);
|
||||
timer_irq_inited = 1;
|
||||
return(0);
|
||||
}
|
||||
|
||||
arch_initcall(timer_init);
|
||||
|
Reference in New Issue
Block a user