Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / kernel / time / tick-internal.h
1 /*
2  * tick internal variable and functions used by low/high res code
3  */
4 DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
5 extern spinlock_t tick_device_lock;
6 extern ktime_t tick_next_period;
7 extern ktime_t tick_period;
8 extern int tick_do_timer_cpu __read_mostly;
9
10 extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
11 extern void tick_handle_periodic(struct clock_event_device *dev);
12
13 extern void clockevents_shutdown(struct clock_event_device *dev);
14
15 /*
16  * NO_HZ / high resolution timer shared code
17  */
18 #ifdef CONFIG_TICK_ONESHOT
19 extern void tick_setup_oneshot(struct clock_event_device *newdev,
20                                void (*handler)(struct clock_event_device *),
21                                ktime_t nextevt);
22 extern int tick_dev_program_event(struct clock_event_device *dev,
23                                   ktime_t expires, int force);
24 extern int tick_program_event(ktime_t expires, int force);
25 extern void tick_oneshot_notify(void);
26 extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
27 extern void tick_resume_oneshot(void);
28 # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
29 extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
30 extern void tick_broadcast_oneshot_control(unsigned long reason);
31 extern void tick_broadcast_switch_to_oneshot(void);
32 extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
33 extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
34 # else /* BROADCAST */
35 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
36 {
37         BUG();
38 }
39 static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
40 static inline void tick_broadcast_switch_to_oneshot(void) { }
41 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
42 # endif /* !BROADCAST */
43
44 #else /* !ONESHOT */
45 static inline
46 void tick_setup_oneshot(struct clock_event_device *newdev,
47                         void (*handler)(struct clock_event_device *),
48                         ktime_t nextevt)
49 {
50         BUG();
51 }
52 static inline void tick_resume_oneshot(void)
53 {
54         BUG();
55 }
56 static inline int tick_program_event(ktime_t expires, int force)
57 {
58         return 0;
59 }
60 static inline void tick_oneshot_notify(void) { }
61 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
62 {
63         BUG();
64 }
65 static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
66 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
67 static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
68 {
69         return 0;
70 }
71 #endif /* !TICK_ONESHOT */
72
73 /*
74  * Broadcasting support
75  */
76 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
77 extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
78 extern int tick_check_broadcast_device(struct clock_event_device *dev);
79 extern int tick_is_broadcast_device(struct clock_event_device *dev);
80 extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
81 extern void tick_shutdown_broadcast(unsigned int *cpup);
82 extern void tick_suspend_broadcast(void);
83 extern int tick_resume_broadcast(void);
84
85 extern void
86 tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
87
88 #else /* !BROADCAST */
89
90 static inline int tick_check_broadcast_device(struct clock_event_device *dev)
91 {
92         return 0;
93 }
94
95 static inline int tick_is_broadcast_device(struct clock_event_device *dev)
96 {
97         return 0;
98 }
99 static inline int tick_device_uses_broadcast(struct clock_event_device *dev,
100                                              int cpu)
101 {
102         return 0;
103 }
104 static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
105 static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
106 static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
107 static inline void tick_suspend_broadcast(void) { }
108 static inline int tick_resume_broadcast(void) { return 0; }
109
110 /*
111  * Set the periodic handler in non broadcast mode
112  */
113 static inline void tick_set_periodic_handler(struct clock_event_device *dev,
114                                              int broadcast)
115 {
116         dev->event_handler = tick_handle_periodic;
117 }
118 #endif /* !BROADCAST */
119
120 /*
121  * Check, if the device is functional or a dummy for broadcast
122  */
123 static inline int tick_device_is_functional(struct clock_event_device *dev)
124 {
125         return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
126 }