[PATCH] tick-management: broadcast functionality
[linux-2.6.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
9 extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
10 extern void tick_handle_periodic(struct clock_event_device *dev);
11
12 /*
13  * Broadcasting support
14  */
15 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
16 extern int tick_do_broadcast(cpumask_t mask);
17 extern struct tick_device tick_broadcast_device;
18 extern spinlock_t tick_broadcast_lock;
19
20 extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
21 extern int tick_check_broadcast_device(struct clock_event_device *dev);
22 extern int tick_is_broadcast_device(struct clock_event_device *dev);
23 extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
24 extern void tick_shutdown_broadcast(unsigned int *cpup);
25
26 extern void
27 tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
28
29 #else /* !BROADCAST */
30
31 static inline int tick_check_broadcast_device(struct clock_event_device *dev)
32 {
33         return 0;
34 }
35
36 static inline int tick_is_broadcast_device(struct clock_event_device *dev)
37 {
38         return 0;
39 }
40 static inline int tick_device_uses_broadcast(struct clock_event_device *dev,
41                                              int cpu)
42 {
43         return 0;
44 }
45 static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
46 static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
47 static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
48
49 /*
50  * Set the periodic handler in non broadcast mode
51  */
52 static inline void tick_set_periodic_handler(struct clock_event_device *dev,
53                                              int broadcast)
54 {
55         dev->event_handler = tick_handle_periodic;
56 }
57 #endif /* !BROADCAST */
58
59 /*
60  * Check, if the device is functional or a dummy for broadcast
61  */
62 static inline int tick_device_is_functional(struct clock_event_device *dev)
63 {
64         return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
65 }