diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-04-02 05:26:23 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-02 06:18:12 -0400 |
commit | 9eed56e889d8a0bb7870e1216d8d4326dd63ec50 (patch) | |
tree | 5cb1d2bf52ea072c88e3049984e15d4b190c1cf1 /include/linux/clockchips.h | |
parent | 3ae7a939165c6159afb3c09e1d7405b6d1807f2b (diff) |
clockevents: Clean up clockchips.h
Do various cleanups on the clockchips.h file:
- indent preprocessor blocks to make it more clear which block we are in,
this also makes merge resolution easier
- comment larger preprocessor blocks consistently, using the:
#if FOO
...
#else /* !FOO: */
...
#endif /* !FOO */
notation.
- unbreak lines
- etc.
No change in functionality.
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/clockchips.h')
-rw-r--r-- | include/linux/clockchips.h | 87 |
1 files changed, 41 insertions, 46 deletions
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 3ac7e2d90374..caeca76d7b32 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h | |||
@@ -22,17 +22,17 @@ enum clock_event_nofitiers { | |||
22 | 22 | ||
23 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 23 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
24 | 24 | ||
25 | #include <linux/clocksource.h> | 25 | # include <linux/clocksource.h> |
26 | #include <linux/cpumask.h> | 26 | # include <linux/cpumask.h> |
27 | #include <linux/ktime.h> | 27 | # include <linux/ktime.h> |
28 | #include <linux/notifier.h> | 28 | # include <linux/notifier.h> |
29 | 29 | ||
30 | struct clock_event_device; | 30 | struct clock_event_device; |
31 | struct module; | 31 | struct module; |
32 | 32 | ||
33 | /* Clock event mode commands for legacy ->set_mode(): OBSOLETE */ | 33 | /* Clock event mode commands for legacy ->set_mode(): OBSOLETE */ |
34 | enum clock_event_mode { | 34 | enum clock_event_mode { |
35 | CLOCK_EVT_MODE_UNUSED = 0, | 35 | CLOCK_EVT_MODE_UNUSED, |
36 | CLOCK_EVT_MODE_SHUTDOWN, | 36 | CLOCK_EVT_MODE_SHUTDOWN, |
37 | CLOCK_EVT_MODE_PERIODIC, | 37 | CLOCK_EVT_MODE_PERIODIC, |
38 | CLOCK_EVT_MODE_ONESHOT, | 38 | CLOCK_EVT_MODE_ONESHOT, |
@@ -51,7 +51,7 @@ enum clock_event_mode { | |||
51 | * from DETACHED or SHUTDOWN. | 51 | * from DETACHED or SHUTDOWN. |
52 | */ | 52 | */ |
53 | enum clock_event_state { | 53 | enum clock_event_state { |
54 | CLOCK_EVT_STATE_DETACHED = 0, | 54 | CLOCK_EVT_STATE_DETACHED, |
55 | CLOCK_EVT_STATE_SHUTDOWN, | 55 | CLOCK_EVT_STATE_SHUTDOWN, |
56 | CLOCK_EVT_STATE_PERIODIC, | 56 | CLOCK_EVT_STATE_PERIODIC, |
57 | CLOCK_EVT_STATE_ONESHOT, | 57 | CLOCK_EVT_STATE_ONESHOT, |
@@ -60,28 +60,29 @@ enum clock_event_state { | |||
60 | /* | 60 | /* |
61 | * Clock event features | 61 | * Clock event features |
62 | */ | 62 | */ |
63 | #define CLOCK_EVT_FEAT_PERIODIC 0x000001 | 63 | # define CLOCK_EVT_FEAT_PERIODIC 0x000001 |
64 | #define CLOCK_EVT_FEAT_ONESHOT 0x000002 | 64 | # define CLOCK_EVT_FEAT_ONESHOT 0x000002 |
65 | #define CLOCK_EVT_FEAT_KTIME 0x000004 | 65 | # define CLOCK_EVT_FEAT_KTIME 0x000004 |
66 | |||
66 | /* | 67 | /* |
67 | * x86(64) specific misfeatures: | 68 | * x86(64) specific (mis)features: |
68 | * | 69 | * |
69 | * - Clockevent source stops in C3 State and needs broadcast support. | 70 | * - Clockevent source stops in C3 State and needs broadcast support. |
70 | * - Local APIC timer is used as a dummy device. | 71 | * - Local APIC timer is used as a dummy device. |
71 | */ | 72 | */ |
72 | #define CLOCK_EVT_FEAT_C3STOP 0x000008 | 73 | # define CLOCK_EVT_FEAT_C3STOP 0x000008 |
73 | #define CLOCK_EVT_FEAT_DUMMY 0x000010 | 74 | # define CLOCK_EVT_FEAT_DUMMY 0x000010 |
74 | 75 | ||
75 | /* | 76 | /* |
76 | * Core shall set the interrupt affinity dynamically in broadcast mode | 77 | * Core shall set the interrupt affinity dynamically in broadcast mode |
77 | */ | 78 | */ |
78 | #define CLOCK_EVT_FEAT_DYNIRQ 0x000020 | 79 | # define CLOCK_EVT_FEAT_DYNIRQ 0x000020 |
79 | #define CLOCK_EVT_FEAT_PERCPU 0x000040 | 80 | # define CLOCK_EVT_FEAT_PERCPU 0x000040 |
80 | 81 | ||
81 | /* | 82 | /* |
82 | * Clockevent device is based on a hrtimer for broadcast | 83 | * Clockevent device is based on a hrtimer for broadcast |
83 | */ | 84 | */ |
84 | #define CLOCK_EVT_FEAT_HRTIMER 0x000080 | 85 | # define CLOCK_EVT_FEAT_HRTIMER 0x000080 |
85 | 86 | ||
86 | /** | 87 | /** |
87 | * struct clock_event_device - clock event device descriptor | 88 | * struct clock_event_device - clock event device descriptor |
@@ -116,10 +117,8 @@ enum clock_event_state { | |||
116 | */ | 117 | */ |
117 | struct clock_event_device { | 118 | struct clock_event_device { |
118 | void (*event_handler)(struct clock_event_device *); | 119 | void (*event_handler)(struct clock_event_device *); |
119 | int (*set_next_event)(unsigned long evt, | 120 | int (*set_next_event)(unsigned long evt, struct clock_event_device *); |
120 | struct clock_event_device *); | 121 | int (*set_next_ktime)(ktime_t expires, struct clock_event_device *); |
121 | int (*set_next_ktime)(ktime_t expires, | ||
122 | struct clock_event_device *); | ||
123 | ktime_t next_event; | 122 | ktime_t next_event; |
124 | u64 max_delta_ns; | 123 | u64 max_delta_ns; |
125 | u64 min_delta_ns; | 124 | u64 min_delta_ns; |
@@ -136,8 +135,7 @@ struct clock_event_device { | |||
136 | * - set_mode(), only for modes <= CLOCK_EVT_MODE_RESUME. | 135 | * - set_mode(), only for modes <= CLOCK_EVT_MODE_RESUME. |
137 | * - set_state_{shutdown|periodic|oneshot}(), tick_resume(). | 136 | * - set_state_{shutdown|periodic|oneshot}(), tick_resume(). |
138 | */ | 137 | */ |
139 | void (*set_mode)(enum clock_event_mode mode, | 138 | void (*set_mode)(enum clock_event_mode mode, struct clock_event_device *); |
140 | struct clock_event_device *); | ||
141 | int (*set_state_periodic)(struct clock_event_device *); | 139 | int (*set_state_periodic)(struct clock_event_device *); |
142 | int (*set_state_oneshot)(struct clock_event_device *); | 140 | int (*set_state_oneshot)(struct clock_event_device *); |
143 | int (*set_state_shutdown)(struct clock_event_device *); | 141 | int (*set_state_shutdown)(struct clock_event_device *); |
@@ -169,18 +167,18 @@ struct clock_event_device { | |||
169 | * | 167 | * |
170 | * factor = (clock_ticks << shift) / nanoseconds | 168 | * factor = (clock_ticks << shift) / nanoseconds |
171 | */ | 169 | */ |
172 | static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec, | 170 | static inline unsigned long |
173 | int shift) | 171 | div_sc(unsigned long ticks, unsigned long nsec, int shift) |
174 | { | 172 | { |
175 | uint64_t tmp = ((uint64_t)ticks) << shift; | 173 | u64 tmp = ((u64)ticks) << shift; |
176 | 174 | ||
177 | do_div(tmp, nsec); | 175 | do_div(tmp, nsec); |
176 | |||
178 | return (unsigned long) tmp; | 177 | return (unsigned long) tmp; |
179 | } | 178 | } |
180 | 179 | ||
181 | /* Clock event layer functions */ | 180 | /* Clock event layer functions */ |
182 | extern u64 clockevent_delta2ns(unsigned long latch, | 181 | extern u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt); |
183 | struct clock_event_device *evt); | ||
184 | extern void clockevents_register_device(struct clock_event_device *dev); | 182 | extern void clockevents_register_device(struct clock_event_device *dev); |
185 | extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu); | 183 | extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu); |
186 | 184 | ||
@@ -194,42 +192,39 @@ extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq); | |||
194 | static inline void | 192 | static inline void |
195 | clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec) | 193 | clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec) |
196 | { | 194 | { |
197 | return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, | 195 | return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, freq, minsec); |
198 | freq, minsec); | ||
199 | } | 196 | } |
200 | 197 | ||
201 | extern void clockevents_suspend(void); | 198 | extern void clockevents_suspend(void); |
202 | extern void clockevents_resume(void); | 199 | extern void clockevents_resume(void); |
203 | 200 | ||
204 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 201 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
205 | #ifdef CONFIG_ARCH_HAS_TICK_BROADCAST | 202 | # ifdef CONFIG_ARCH_HAS_TICK_BROADCAST |
206 | extern void tick_broadcast(const struct cpumask *mask); | 203 | extern void tick_broadcast(const struct cpumask *mask); |
207 | #else | 204 | # else |
208 | #define tick_broadcast NULL | 205 | # define tick_broadcast NULL |
209 | #endif | 206 | # endif |
210 | extern int tick_receive_broadcast(void); | 207 | extern int tick_receive_broadcast(void); |
211 | #endif | 208 | # endif |
212 | 209 | ||
213 | #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) | 210 | # if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) |
214 | extern void tick_setup_hrtimer_broadcast(void); | 211 | extern void tick_setup_hrtimer_broadcast(void); |
215 | extern int tick_check_broadcast_expired(void); | 212 | extern int tick_check_broadcast_expired(void); |
216 | #else | 213 | # else |
217 | static inline int tick_check_broadcast_expired(void) { return 0; } | 214 | static inline int tick_check_broadcast_expired(void) { return 0; } |
218 | static inline void tick_setup_hrtimer_broadcast(void) {}; | 215 | static inline void tick_setup_hrtimer_broadcast(void) { } |
219 | #endif | 216 | # endif |
220 | 217 | ||
221 | extern int clockevents_notify(unsigned long reason, void *arg); | 218 | extern int clockevents_notify(unsigned long reason, void *arg); |
222 | 219 | ||
223 | #else /* CONFIG_GENERIC_CLOCKEVENTS */ | 220 | #else /* !CONFIG_GENERIC_CLOCKEVENTS: */ |
224 | |||
225 | static inline void clockevents_suspend(void) {} | ||
226 | static inline void clockevents_resume(void) {} | ||
227 | 221 | ||
222 | static inline void clockevents_suspend(void) { } | ||
223 | static inline void clockevents_resume(void) { } | ||
228 | static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; } | 224 | static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; } |
229 | static inline int tick_check_broadcast_expired(void) { return 0; } | 225 | static inline int tick_check_broadcast_expired(void) { return 0; } |
230 | static inline void tick_setup_hrtimer_broadcast(void) {}; | 226 | static inline void tick_setup_hrtimer_broadcast(void) { } |
231 | static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; } | ||
232 | 227 | ||
233 | #endif | 228 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ |
234 | 229 | ||
235 | #endif | 230 | #endif /* _LINUX_CLOCKCHIPS_H */ |