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