Commit b29230769e3482bbd62a07d6d9485371ee66a18f
1 parent
157b1a2385
Exists in
master
and in
7 other branches
um: Fix read_persistent_clock fallout
commit 9f31f57(um: Convert to use read_persistent_clock) moved the code, but not the variable. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Showing 1 changed file with 2 additions and 3 deletions Inline Diff
arch/um/kernel/time.c
1 | /* | 1 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/clockchips.h> | 6 | #include <linux/clockchips.h> |
7 | #include <linux/init.h> | 7 | #include <linux/init.h> |
8 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
9 | #include <linux/jiffies.h> | 9 | #include <linux/jiffies.h> |
10 | #include <linux/threads.h> | 10 | #include <linux/threads.h> |
11 | #include <asm/irq.h> | 11 | #include <asm/irq.h> |
12 | #include <asm/param.h> | 12 | #include <asm/param.h> |
13 | #include "kern_util.h" | 13 | #include "kern_util.h" |
14 | #include "os.h" | 14 | #include "os.h" |
15 | 15 | ||
16 | void timer_handler(int sig, struct uml_pt_regs *regs) | 16 | void timer_handler(int sig, struct uml_pt_regs *regs) |
17 | { | 17 | { |
18 | unsigned long flags; | 18 | unsigned long flags; |
19 | 19 | ||
20 | local_irq_save(flags); | 20 | local_irq_save(flags); |
21 | do_IRQ(TIMER_IRQ, regs); | 21 | do_IRQ(TIMER_IRQ, regs); |
22 | local_irq_restore(flags); | 22 | local_irq_restore(flags); |
23 | } | 23 | } |
24 | 24 | ||
25 | static void itimer_set_mode(enum clock_event_mode mode, | 25 | static void itimer_set_mode(enum clock_event_mode mode, |
26 | struct clock_event_device *evt) | 26 | struct clock_event_device *evt) |
27 | { | 27 | { |
28 | switch (mode) { | 28 | switch (mode) { |
29 | case CLOCK_EVT_MODE_PERIODIC: | 29 | case CLOCK_EVT_MODE_PERIODIC: |
30 | set_interval(); | 30 | set_interval(); |
31 | break; | 31 | break; |
32 | 32 | ||
33 | case CLOCK_EVT_MODE_SHUTDOWN: | 33 | case CLOCK_EVT_MODE_SHUTDOWN: |
34 | case CLOCK_EVT_MODE_UNUSED: | 34 | case CLOCK_EVT_MODE_UNUSED: |
35 | case CLOCK_EVT_MODE_ONESHOT: | 35 | case CLOCK_EVT_MODE_ONESHOT: |
36 | disable_timer(); | 36 | disable_timer(); |
37 | break; | 37 | break; |
38 | 38 | ||
39 | case CLOCK_EVT_MODE_RESUME: | 39 | case CLOCK_EVT_MODE_RESUME: |
40 | break; | 40 | break; |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | static int itimer_next_event(unsigned long delta, | 44 | static int itimer_next_event(unsigned long delta, |
45 | struct clock_event_device *evt) | 45 | struct clock_event_device *evt) |
46 | { | 46 | { |
47 | return timer_one_shot(delta + 1); | 47 | return timer_one_shot(delta + 1); |
48 | } | 48 | } |
49 | 49 | ||
50 | static struct clock_event_device itimer_clockevent = { | 50 | static struct clock_event_device itimer_clockevent = { |
51 | .name = "itimer", | 51 | .name = "itimer", |
52 | .rating = 250, | 52 | .rating = 250, |
53 | .cpumask = cpu_all_mask, | 53 | .cpumask = cpu_all_mask, |
54 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 54 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
55 | .set_mode = itimer_set_mode, | 55 | .set_mode = itimer_set_mode, |
56 | .set_next_event = itimer_next_event, | 56 | .set_next_event = itimer_next_event, |
57 | .shift = 32, | 57 | .shift = 32, |
58 | .irq = 0, | 58 | .irq = 0, |
59 | }; | 59 | }; |
60 | 60 | ||
61 | static irqreturn_t um_timer(int irq, void *dev) | 61 | static irqreturn_t um_timer(int irq, void *dev) |
62 | { | 62 | { |
63 | (*itimer_clockevent.event_handler)(&itimer_clockevent); | 63 | (*itimer_clockevent.event_handler)(&itimer_clockevent); |
64 | 64 | ||
65 | return IRQ_HANDLED; | 65 | return IRQ_HANDLED; |
66 | } | 66 | } |
67 | 67 | ||
68 | static cycle_t itimer_read(struct clocksource *cs) | 68 | static cycle_t itimer_read(struct clocksource *cs) |
69 | { | 69 | { |
70 | return os_nsecs() / 1000; | 70 | return os_nsecs() / 1000; |
71 | } | 71 | } |
72 | 72 | ||
73 | static struct clocksource itimer_clocksource = { | 73 | static struct clocksource itimer_clocksource = { |
74 | .name = "itimer", | 74 | .name = "itimer", |
75 | .rating = 300, | 75 | .rating = 300, |
76 | .read = itimer_read, | 76 | .read = itimer_read, |
77 | .mask = CLOCKSOURCE_MASK(64), | 77 | .mask = CLOCKSOURCE_MASK(64), |
78 | .mult = 1000, | 78 | .mult = 1000, |
79 | .shift = 0, | 79 | .shift = 0, |
80 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 80 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static void __init setup_itimer(void) | 83 | static void __init setup_itimer(void) |
84 | { | 84 | { |
85 | int err; | 85 | int err; |
86 | 86 | ||
87 | err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL); | 87 | err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL); |
88 | if (err != 0) | 88 | if (err != 0) |
89 | printk(KERN_ERR "register_timer : request_irq failed - " | 89 | printk(KERN_ERR "register_timer : request_irq failed - " |
90 | "errno = %d\n", -err); | 90 | "errno = %d\n", -err); |
91 | 91 | ||
92 | itimer_clockevent.mult = div_sc(HZ, NSEC_PER_SEC, 32); | 92 | itimer_clockevent.mult = div_sc(HZ, NSEC_PER_SEC, 32); |
93 | itimer_clockevent.max_delta_ns = | 93 | itimer_clockevent.max_delta_ns = |
94 | clockevent_delta2ns(60 * HZ, &itimer_clockevent); | 94 | clockevent_delta2ns(60 * HZ, &itimer_clockevent); |
95 | itimer_clockevent.min_delta_ns = | 95 | itimer_clockevent.min_delta_ns = |
96 | clockevent_delta2ns(1, &itimer_clockevent); | 96 | clockevent_delta2ns(1, &itimer_clockevent); |
97 | err = clocksource_register(&itimer_clocksource); | 97 | err = clocksource_register(&itimer_clocksource); |
98 | if (err) { | 98 | if (err) { |
99 | printk(KERN_ERR "clocksource_register returned %d\n", err); | 99 | printk(KERN_ERR "clocksource_register returned %d\n", err); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | clockevents_register_device(&itimer_clockevent); | 102 | clockevents_register_device(&itimer_clockevent); |
103 | } | 103 | } |
104 | 104 | ||
105 | void read_persistent_clock(struct timespec *ts) | 105 | void read_persistent_clock(struct timespec *ts) |
106 | { | 106 | { |
107 | nsecs = os_nsecs(); | 107 | long long nsecs = os_nsecs(); |
108 | |||
108 | set_normalized_timespec(ts, nsecs / NSEC_PER_SEC, | 109 | set_normalized_timespec(ts, nsecs / NSEC_PER_SEC, |
109 | nsecs % NSEC_PER_SEC); | 110 | nsecs % NSEC_PER_SEC); |
110 | } | 111 | } |
111 | 112 | ||
112 | void __init time_init(void) | 113 | void __init time_init(void) |
113 | { | 114 | { |
114 | long long nsecs; | ||
115 | |||
116 | timer_init(); | 115 | timer_init(); |
117 | late_time_init = setup_itimer; | 116 | late_time_init = setup_itimer; |
118 | } | 117 | } |