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