summaryrefslogtreecommitdiff
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 01:27:25 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 09:43:08 -0700
commit791a644a8d73a9b95515f074afbb3caa0a9964fa (patch)
tree507b52d335416096b71c078d7af037530403633b /arch/um/kernel
parent31ccc1f524b626abcf5e043ad32b881219223c34 (diff)
uml: clocksource support
Add clocksource support. 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/um/kernel')
-rw-r--r--arch/um/kernel/time.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 01678487b999..3cb7135e5c47 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -97,6 +97,21 @@ static irqreturn_t um_timer(int irq, void *dev)
return IRQ_HANDLED;
}
+static cycle_t itimer_read(void)
+{
+ return os_nsecs();
+}
+
+static struct clocksource itimer_clocksource = {
+ .name = "itimer",
+ .rating = 300,
+ .read = itimer_read,
+ .mask = CLOCKSOURCE_MASK(64),
+ .mult = 1,
+ .shift = 0,
+ .flags = CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
static void __init setup_itimer(void)
{
int err;
@@ -111,6 +126,11 @@ static void __init setup_itimer(void)
clockevent_delta2ns(60 * HZ, &itimer_clockevent);
itimer_clockevent.min_delta_ns =
clockevent_delta2ns(1, &itimer_clockevent);
+ err = clocksource_register(&itimer_clocksource);
+ if (err) {
+ printk(KERN_ERR "clocksource_register returned %d\n", err);
+ return;
+ }
clockevents_register_device(&itimer_clockevent);
}