aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:27:23 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:08 -0400
commitd83d2aa9485d996cfd89f04389b419c6727faacb (patch)
tree261bd8162d132ae1855127314bf33de7c130511d /arch
parent78a26e25ce4837a03ac3b6c32cdae1958e547639 (diff)
uml: GENERIC_TIME support
Enable CONFIG_GENERIC_TIME. As a side-effect of this, the UML implementations of do_gettimeofday and do_settimeofday go away, as these are provided by generic code. set_time also goes away since it was only used by do_settimeofday. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/Kconfig5
-rw-r--r--arch/um/kernel/ksyms.c3
-rw-r--r--arch/um/kernel/time.c40
3 files changed, 5 insertions, 43 deletions
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 4aabb334a84e..53597bbcd7b0 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -55,6 +55,10 @@ config GENERIC_BUG
55 default y 55 default y
56 depends on BUG 56 depends on BUG
57 57
58config GENERIC_TIME
59 bool
60 default y
61
58# Used in kernel/irq/manage.c and include/linux/irq.h 62# Used in kernel/irq/manage.c and include/linux/irq.h
59config IRQ_RELEASE_METHOD 63config IRQ_RELEASE_METHOD
60 bool 64 bool
@@ -75,6 +79,7 @@ config STATIC_LINK
75 79
76source "arch/um/Kconfig.arch" 80source "arch/um/Kconfig.arch"
77source "mm/Kconfig" 81source "mm/Kconfig"
82source "kernel/time/Kconfig"
78 83
79config LD_SCRIPT_STATIC 84config LD_SCRIPT_STATIC
80 bool 85 bool
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 4b750014925d..1b388b41d95d 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -67,9 +67,6 @@ EXPORT_SYMBOL(run_helper);
67EXPORT_SYMBOL(start_thread); 67EXPORT_SYMBOL(start_thread);
68EXPORT_SYMBOL(dump_thread); 68EXPORT_SYMBOL(dump_thread);
69 69
70EXPORT_SYMBOL(do_gettimeofday);
71EXPORT_SYMBOL(do_settimeofday);
72
73#ifdef CONFIG_SMP 70#ifdef CONFIG_SMP
74 71
75/* required for SMP */ 72/* required for SMP */
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 758d4f9cb22a..7678bcf830ba 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -123,46 +123,6 @@ void time_init(void)
123 late_time_init = register_timer; 123 late_time_init = register_timer;
124} 124}
125 125
126void do_gettimeofday(struct timeval *tv)
127{
128#ifdef CONFIG_UML_REAL_TIME_CLOCK
129 unsigned long long nsecs = get_time();
130#else
131 unsigned long long nsecs = (unsigned long long) xtime.tv_sec * BILLION +
132 xtime.tv_nsec;
133#endif
134 tv->tv_sec = nsecs / NSEC_PER_SEC;
135 /*
136 * Careful about calculations here - this was originally done as
137 * (nsecs - tv->tv_sec * NSEC_PER_SEC) / NSEC_PER_USEC
138 * which gave bogus (> 1000000) values. Dunno why, suspect gcc
139 * (4.0.0) miscompiled it, or there's a subtle 64/32-bit conversion
140 * problem that I missed.
141 */
142 nsecs -= tv->tv_sec * NSEC_PER_SEC;
143 tv->tv_usec = (unsigned long) nsecs / NSEC_PER_USEC;
144}
145
146static inline void set_time(unsigned long long nsecs)
147{
148 unsigned long long now;
149 unsigned long flags;
150
151 spin_lock_irqsave(&timer_spinlock, flags);
152 now = os_nsecs();
153 local_offset = nsecs - now;
154 spin_unlock_irqrestore(&timer_spinlock, flags);
155
156 clock_was_set();
157}
158
159int do_settimeofday(struct timespec *tv)
160{
161 set_time((unsigned long long) tv->tv_sec * NSEC_PER_SEC + tv->tv_nsec);
162
163 return 0;
164}
165
166void timer_handler(int sig, struct uml_pt_regs *regs) 126void timer_handler(int sig, struct uml_pt_regs *regs)
167{ 127{
168 if (current_thread->cpu == 0) 128 if (current_thread->cpu == 0)