diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-03-25 08:06:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-01 08:22:58 -0400 |
commit | b7475eb599ddb2e8cab2dc86ff38a9507463ad6b (patch) | |
tree | 2fe390d7e2444e71297445230006dde7da24dce2 /kernel/time | |
parent | bfb83b27519aa7ed9510f601a8f825a2c1484bc2 (diff) |
tick: Simplify tick-internal.h
tick-internal.h is pretty confusing as a lot of the stub inlines
are there several times.
Distangle the maze and make clear functional sections.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/16068264.vcNp79HLaT@vostro.rjw.lan
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/tick-internal.h | 145 |
1 files changed, 49 insertions, 96 deletions
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index cba52140a298..d86eb8d485e9 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -27,14 +27,19 @@ extern bool tick_check_replacement(struct clock_event_device *curdev, | |||
27 | struct clock_event_device *newdev); | 27 | struct clock_event_device *newdev); |
28 | extern void tick_install_replacement(struct clock_event_device *dev); | 28 | extern void tick_install_replacement(struct clock_event_device *dev); |
29 | 29 | ||
30 | extern void clockevents_shutdown(struct clock_event_device *dev); | ||
31 | extern int clockevents_tick_resume(struct clock_event_device *dev); | 30 | extern int clockevents_tick_resume(struct clock_event_device *dev); |
31 | /* Check, if the device is functional or a dummy for broadcast */ | ||
32 | static inline int tick_device_is_functional(struct clock_event_device *dev) | ||
33 | { | ||
34 | return !(dev->features & CLOCK_EVT_FEAT_DUMMY); | ||
35 | } | ||
32 | 36 | ||
37 | extern void clockevents_shutdown(struct clock_event_device *dev); | ||
38 | extern int __clockevents_update_freq(struct clock_event_device *dev, u32 freq); | ||
33 | extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt); | 39 | extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt); |
40 | #endif /* GENERIC_CLOCKEVENTS */ | ||
34 | 41 | ||
35 | /* | 42 | /* Oneshot related functions */ |
36 | * NO_HZ / high resolution timer shared code | ||
37 | */ | ||
38 | #ifdef CONFIG_TICK_ONESHOT | 43 | #ifdef CONFIG_TICK_ONESHOT |
39 | extern void tick_setup_oneshot(struct clock_event_device *newdev, | 44 | extern void tick_setup_oneshot(struct clock_event_device *newdev, |
40 | void (*handler)(struct clock_event_device *), | 45 | void (*handler)(struct clock_event_device *), |
@@ -43,69 +48,19 @@ extern int tick_program_event(ktime_t expires, int force); | |||
43 | extern void tick_oneshot_notify(void); | 48 | extern void tick_oneshot_notify(void); |
44 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); | 49 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); |
45 | extern void tick_resume_oneshot(void); | 50 | extern void tick_resume_oneshot(void); |
46 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 51 | static inline bool tick_oneshot_possible(void) { return true; } |
47 | extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); | ||
48 | extern int tick_broadcast_oneshot_control(unsigned long reason); | ||
49 | extern void tick_broadcast_switch_to_oneshot(void); | ||
50 | extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); | ||
51 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); | ||
52 | extern int tick_broadcast_oneshot_active(void); | ||
53 | extern void tick_check_oneshot_broadcast_this_cpu(void); | ||
54 | bool tick_broadcast_oneshot_available(void); | ||
55 | # else /* BROADCAST */ | ||
56 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | ||
57 | { | ||
58 | BUG(); | ||
59 | } | ||
60 | static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; } | ||
61 | static inline void tick_broadcast_switch_to_oneshot(void) { } | ||
62 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | ||
63 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | ||
64 | static inline void tick_check_oneshot_broadcast_this_cpu(void) { } | ||
65 | static inline bool tick_broadcast_oneshot_available(void) { return true; } | ||
66 | # endif /* !BROADCAST */ | ||
67 | |||
68 | #else /* !ONESHOT */ | 52 | #else /* !ONESHOT */ |
69 | static inline | 53 | static inline |
70 | void tick_setup_oneshot(struct clock_event_device *newdev, | 54 | void tick_setup_oneshot(struct clock_event_device *newdev, |
71 | void (*handler)(struct clock_event_device *), | 55 | void (*handler)(struct clock_event_device *), |
72 | ktime_t nextevt) | 56 | ktime_t nextevt) { BUG(); } |
73 | { | 57 | static inline void tick_resume_oneshot(void) { BUG(); } |
74 | BUG(); | 58 | static inline int tick_program_event(ktime_t expires, int force) { return 0; } |
75 | } | ||
76 | static inline void tick_resume_oneshot(void) | ||
77 | { | ||
78 | BUG(); | ||
79 | } | ||
80 | static inline int tick_program_event(ktime_t expires, int force) | ||
81 | { | ||
82 | return 0; | ||
83 | } | ||
84 | static inline void tick_oneshot_notify(void) { } | 59 | static inline void tick_oneshot_notify(void) { } |
85 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | 60 | static inline bool tick_oneshot_possible(void) { return false; } |
86 | { | ||
87 | BUG(); | ||
88 | } | ||
89 | static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; } | ||
90 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | ||
91 | static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | ||
96 | static inline bool tick_broadcast_oneshot_available(void) { return false; } | ||
97 | #endif /* !TICK_ONESHOT */ | 61 | #endif /* !TICK_ONESHOT */ |
98 | 62 | ||
99 | /* NO_HZ_FULL internal */ | 63 | /* Broadcasting support */ |
100 | #ifdef CONFIG_NO_HZ_FULL | ||
101 | extern void tick_nohz_init(void); | ||
102 | # else | ||
103 | static inline void tick_nohz_init(void) { } | ||
104 | #endif | ||
105 | |||
106 | /* | ||
107 | * Broadcasting support | ||
108 | */ | ||
109 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 64 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
110 | extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); | 65 | extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); |
111 | extern void tick_install_broadcast_device(struct clock_event_device *dev); | 66 | extern void tick_install_broadcast_device(struct clock_event_device *dev); |
@@ -115,53 +70,51 @@ extern void tick_shutdown_broadcast(unsigned int *cpup); | |||
115 | extern void tick_suspend_broadcast(void); | 70 | extern void tick_suspend_broadcast(void); |
116 | extern int tick_resume_broadcast(void); | 71 | extern int tick_resume_broadcast(void); |
117 | extern void tick_broadcast_init(void); | 72 | extern void tick_broadcast_init(void); |
118 | extern void | 73 | extern void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); |
119 | tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); | 74 | extern int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq); |
120 | int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq); | ||
121 | |||
122 | #else /* !BROADCAST */ | 75 | #else /* !BROADCAST */ |
123 | 76 | static inline void tick_install_broadcast_device(struct clock_event_device *dev) { } | |
124 | static inline void tick_install_broadcast_device(struct clock_event_device *dev) | 77 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) { return 0; } |
125 | { | 78 | static inline int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) { return 0; } |
126 | } | ||
127 | |||
128 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) | ||
129 | { | ||
130 | return 0; | ||
131 | } | ||
132 | static inline int tick_device_uses_broadcast(struct clock_event_device *dev, | ||
133 | int cpu) | ||
134 | { | ||
135 | return 0; | ||
136 | } | ||
137 | static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { } | 79 | static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { } |
138 | static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { } | 80 | static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { } |
139 | static inline void tick_shutdown_broadcast(unsigned int *cpup) { } | 81 | static inline void tick_shutdown_broadcast(unsigned int *cpup) { } |
140 | static inline void tick_suspend_broadcast(void) { } | 82 | static inline void tick_suspend_broadcast(void) { } |
141 | static inline int tick_resume_broadcast(void) { return 0; } | 83 | static inline int tick_resume_broadcast(void) { return 0; } |
142 | static inline void tick_broadcast_init(void) { } | 84 | static inline void tick_broadcast_init(void) { } |
143 | static inline int tick_broadcast_update_freq(struct clock_event_device *dev, | 85 | static inline int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq) { return -ENODEV; } |
144 | u32 freq) { return -ENODEV; } | ||
145 | 86 | ||
146 | /* | 87 | /* Set the periodic handler in non broadcast mode */ |
147 | * Set the periodic handler in non broadcast mode | 88 | static inline void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast) |
148 | */ | ||
149 | static inline void tick_set_periodic_handler(struct clock_event_device *dev, | ||
150 | int broadcast) | ||
151 | { | 89 | { |
152 | dev->event_handler = tick_handle_periodic; | 90 | dev->event_handler = tick_handle_periodic; |
153 | } | 91 | } |
154 | #endif /* !BROADCAST */ | 92 | #endif /* !BROADCAST */ |
155 | 93 | ||
156 | /* | 94 | /* Functions related to oneshot broadcasting */ |
157 | * Check, if the device is functional or a dummy for broadcast | 95 | #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) |
158 | */ | 96 | extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); |
159 | static inline int tick_device_is_functional(struct clock_event_device *dev) | 97 | extern int tick_broadcast_oneshot_control(unsigned long reason); |
160 | { | 98 | extern void tick_broadcast_switch_to_oneshot(void); |
161 | return !(dev->features & CLOCK_EVT_FEAT_DUMMY); | 99 | extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); |
162 | } | 100 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); |
163 | 101 | extern int tick_broadcast_oneshot_active(void); | |
164 | int __clockevents_update_freq(struct clock_event_device *dev, u32 freq); | 102 | extern void tick_check_oneshot_broadcast_this_cpu(void); |
165 | 103 | bool tick_broadcast_oneshot_available(void); | |
166 | #endif /* GENERIC_CLOCKEVENTS */ | 104 | #else /* BROADCAST && ONESHOT */ |
105 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } | ||
106 | static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; } | ||
107 | static inline void tick_broadcast_switch_to_oneshot(void) { } | ||
108 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | ||
109 | static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) { return 0; } | ||
110 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | ||
111 | static inline void tick_check_oneshot_broadcast_this_cpu(void) { } | ||
112 | static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_possible(); } | ||
113 | #endif /* !BROADCAST && ONESHOT */ | ||
167 | 114 | ||
115 | /* NO_HZ_FULL internal */ | ||
116 | #ifdef CONFIG_NO_HZ_FULL | ||
117 | extern void tick_nohz_init(void); | ||
118 | # else | ||
119 | static inline void tick_nohz_init(void) { } | ||
120 | #endif | ||