time: Make do_timer() and xtime_lock local to kernel/time/
[deliverable/linux.git] / kernel / time / tick-internal.h
CommitLineData
f8381cba
TG
1/*
2 * tick internal variable and functions used by low/high res code
3 */
e2830b5c
TH
4#include <linux/hrtimer.h>
5#include <linux/tick.h>
6441402b
TG
6
7#define TICK_DO_TIMER_NONE -1
8#define TICK_DO_TIMER_BOOT -2
9
f8381cba 10DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
f8381cba
TG
11extern ktime_t tick_next_period;
12extern ktime_t tick_period;
d3ed7824 13extern int tick_do_timer_cpu __read_mostly;
f8381cba
TG
14
15extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
16extern void tick_handle_periodic(struct clock_event_device *dev);
17
2344abbc
TG
18extern void clockevents_shutdown(struct clock_event_device *dev);
19
79bf2bb3
TG
20/*
21 * NO_HZ / high resolution timer shared code
22 */
23#ifdef CONFIG_TICK_ONESHOT
24extern void tick_setup_oneshot(struct clock_event_device *newdev,
25 void (*handler)(struct clock_event_device *),
26 ktime_t nextevt);
1fb9b7d2
TG
27extern int tick_dev_program_event(struct clock_event_device *dev,
28 ktime_t expires, int force);
79bf2bb3
TG
29extern int tick_program_event(ktime_t expires, int force);
30extern void tick_oneshot_notify(void);
31extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
cd05a1f8 32extern void tick_resume_oneshot(void);
79bf2bb3
TG
33# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
34extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
35extern void tick_broadcast_oneshot_control(unsigned long reason);
36extern void tick_broadcast_switch_to_oneshot(void);
37extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
cd05a1f8 38extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
27ce4cb4 39extern int tick_broadcast_oneshot_active(void);
fb02fbc1 40extern void tick_check_oneshot_broadcast(int cpu);
79bf2bb3
TG
41# else /* BROADCAST */
42static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
43{
44 BUG();
45}
46static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
47static inline void tick_broadcast_switch_to_oneshot(void) { }
48static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
27ce4cb4 49static inline int tick_broadcast_oneshot_active(void) { return 0; }
fb02fbc1 50static inline void tick_check_oneshot_broadcast(int cpu) { }
79bf2bb3
TG
51# endif /* !BROADCAST */
52
53#else /* !ONESHOT */
54static inline
55void tick_setup_oneshot(struct clock_event_device *newdev,
56 void (*handler)(struct clock_event_device *),
57 ktime_t nextevt)
58{
59 BUG();
60}
cd05a1f8
TG
61static inline void tick_resume_oneshot(void)
62{
63 BUG();
64}
79bf2bb3
TG
65static inline int tick_program_event(ktime_t expires, int force)
66{
67 return 0;
68}
69static inline void tick_oneshot_notify(void) { }
70static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
71{
72 BUG();
73}
74static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
75static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
cd05a1f8
TG
76static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
77{
78 return 0;
79}
f8e256c6 80static inline int tick_broadcast_oneshot_active(void) { return 0; }
79bf2bb3
TG
81#endif /* !TICK_ONESHOT */
82
f8381cba
TG
83/*
84 * Broadcasting support
85 */
86#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
f8381cba
TG
87extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
88extern int tick_check_broadcast_device(struct clock_event_device *dev);
89extern int tick_is_broadcast_device(struct clock_event_device *dev);
90extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
91extern void tick_shutdown_broadcast(unsigned int *cpup);
6321dd60
TG
92extern void tick_suspend_broadcast(void);
93extern int tick_resume_broadcast(void);
f8381cba
TG
94
95extern void
96tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
97
98#else /* !BROADCAST */
99
100static inline int tick_check_broadcast_device(struct clock_event_device *dev)
101{
102 return 0;
103}
104
105static inline int tick_is_broadcast_device(struct clock_event_device *dev)
106{
107 return 0;
108}
109static inline int tick_device_uses_broadcast(struct clock_event_device *dev,
110 int cpu)
111{
112 return 0;
113}
114static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
115static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
116static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
6321dd60
TG
117static inline void tick_suspend_broadcast(void) { }
118static inline int tick_resume_broadcast(void) { return 0; }
f8381cba
TG
119
120/*
121 * Set the periodic handler in non broadcast mode
122 */
123static inline void tick_set_periodic_handler(struct clock_event_device *dev,
124 int broadcast)
125{
126 dev->event_handler = tick_handle_periodic;
127}
128#endif /* !BROADCAST */
129
130/*
131 * Check, if the device is functional or a dummy for broadcast
132 */
133static inline int tick_device_is_functional(struct clock_event_device *dev)
134{
135 return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
136}
e2830b5c
TH
137
138extern void do_timer(unsigned long ticks);
139extern seqlock_t xtime_lock;
This page took 0.558332 seconds and 5 git commands to generate.