aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/time_kern.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-07-10 07:45:05 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 16:24:23 -0400
commitaceb343464a136e1c0de5294b097a1f9ab018870 (patch)
treedb42e6d7b059948b3ef0d957fb9dcc87462c7fd3 /arch/um/kernel/time_kern.c
parent598d188af1a0645dc75c9541eff0017a4f6d9987 (diff)
[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>
Diffstat (limited to 'arch/um/kernel/time_kern.c')
-rw-r--r--arch/um/kernel/time_kern.c64
1 files changed, 26 insertions, 38 deletions
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index d7e044b5e5ee..8e56c58320ba 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -84,29 +84,6 @@ void timer_irq(union uml_pt_regs *regs)
84 } 84 }
85} 85}
86 86
87
88void time_init_kern(void)
89{
90 long long nsecs;
91
92 nsecs = os_nsecs();
93 set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
94 -nsecs % BILLION);
95}
96
97void do_boot_timer_handler(struct sigcontext * sc)
98{
99 unsigned long flags;
100 struct pt_regs regs;
101
102 CHOOSE_MODE((void) (UPT_SC(&regs.regs) = sc),
103 (void) (regs.regs.skas.is_user = 0));
104
105 write_seqlock_irqsave(&xtime_lock, flags);
106 do_timer(&regs);
107 write_sequnlock_irqrestore(&xtime_lock, flags);
108}
109
110static DEFINE_SPINLOCK(timer_spinlock); 87static DEFINE_SPINLOCK(timer_spinlock);
111 88
112static unsigned long long local_offset = 0; 89static unsigned long long local_offset = 0;
@@ -142,6 +119,32 @@ irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs)
142 return IRQ_HANDLED; 119 return IRQ_HANDLED;
143} 120}
144 121
122static void register_timer(void)
123{
124 int err;
125
126 err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL);
127 if(err != 0)
128 printk(KERN_ERR "timer_init : request_irq failed - "
129 "errno = %d\n", -err);
130
131 timer_irq_inited = 1;
132
133 user_time_init();
134}
135
136extern void (*late_time_init)(void);
137
138void time_init(void)
139{
140 long long nsecs;
141
142 nsecs = os_nsecs();
143 set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
144 -nsecs % BILLION);
145 late_time_init = register_timer;
146}
147
145void do_gettimeofday(struct timeval *tv) 148void do_gettimeofday(struct timeval *tv)
146{ 149{
147 unsigned long long nsecs = get_time(); 150 unsigned long long nsecs = get_time();
@@ -189,18 +192,3 @@ void timer_handler(int sig, union uml_pt_regs *regs)
189 if(current_thread->cpu == 0) 192 if(current_thread->cpu == 0)
190 timer_irq(regs); 193 timer_irq(regs);
191} 194}
192
193int __init timer_init(void)
194{
195 int err;
196
197 user_time_init();
198 err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL);
199 if(err != 0)
200 printk(KERN_ERR "timer_init : request_irq failed - "
201 "errno = %d\n", -err);
202 timer_irq_inited = 1;
203 return(0);
204}
205
206arch_initcall(timer_init);