aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hrtimer.h
diff options
context:
space:
mode:
authorAnna-Maria Gleixner <anna-maria@linutronix.de>2017-12-21 05:41:42 -0500
committerIngo Molnar <mingo@kernel.org>2018-01-15 20:35:47 -0500
commit28bfd18bf3daa5db8bb3422ea7138c8b7d2444ac (patch)
treef2220ee3447a5bbf6aa0f984f8f408008e042615 /include/linux/hrtimer.h
parentda21c5a58a7f30db69e04e06dfb6777ccbb1113c (diff)
hrtimer: Make the hrtimer_cpu_base::hres_active field unconditional, to simplify the code
The hrtimer_cpu_base::hres_active_member field depends on CONFIG_HIGH_RES_TIMERS=y currently, and all related functions to this member are conditional as well. To simplify the code make it unconditional and set it to zero during initialization. (This will also help with the upcoming softirq based hrtimers code.) The conditional code sections can be avoided by adding IS_ENABLED(HIGHRES) conditionals into common functions, which ensures dead code elimination. There is no functional change. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Cc: Christoph Hellwig <hch@lst.de> Cc: John Stultz <john.stultz@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: keescook@chromium.org Link: http://lkml.kernel.org/r/20171221104205.7269-14-anna-maria@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/hrtimer.h')
-rw-r--r--include/linux/hrtimer.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 56e56bcb6f0f..22627b3a33fe 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -161,8 +161,8 @@ enum hrtimer_base_type {
161 * @cpu: cpu number 161 * @cpu: cpu number
162 * @active_bases: Bitfield to mark bases with active timers 162 * @active_bases: Bitfield to mark bases with active timers
163 * @clock_was_set_seq: Sequence counter of clock was set events 163 * @clock_was_set_seq: Sequence counter of clock was set events
164 * @in_hrtirq: hrtimer_interrupt() is currently executing
165 * @hres_active: State of high resolution mode 164 * @hres_active: State of high resolution mode
165 * @in_hrtirq: hrtimer_interrupt() is currently executing
166 * @hang_detected: The last hrtimer interrupt detected a hang 166 * @hang_detected: The last hrtimer interrupt detected a hang
167 * @expires_next: absolute time of the next event, is required for remote 167 * @expires_next: absolute time of the next event, is required for remote
168 * hrtimer enqueue 168 * hrtimer enqueue
@@ -182,9 +182,9 @@ struct hrtimer_cpu_base {
182 unsigned int cpu; 182 unsigned int cpu;
183 unsigned int active_bases; 183 unsigned int active_bases;
184 unsigned int clock_was_set_seq; 184 unsigned int clock_was_set_seq;
185 unsigned int hres_active : 1;
185#ifdef CONFIG_HIGH_RES_TIMERS 186#ifdef CONFIG_HIGH_RES_TIMERS
186 unsigned int in_hrtirq : 1, 187 unsigned int in_hrtirq : 1,
187 hres_active : 1,
188 hang_detected : 1; 188 hang_detected : 1;
189 ktime_t expires_next; 189 ktime_t expires_next;
190 struct hrtimer *next_timer; 190 struct hrtimer *next_timer;
@@ -266,16 +266,17 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
266 return timer->base->get_time(); 266 return timer->base->get_time();
267} 267}
268 268
269static inline int hrtimer_is_hres_active(struct hrtimer *timer)
270{
271 return IS_ENABLED(CONFIG_HIGH_RES_TIMERS) ?
272 timer->base->cpu_base->hres_active : 0;
273}
274
269#ifdef CONFIG_HIGH_RES_TIMERS 275#ifdef CONFIG_HIGH_RES_TIMERS
270struct clock_event_device; 276struct clock_event_device;
271 277
272extern void hrtimer_interrupt(struct clock_event_device *dev); 278extern void hrtimer_interrupt(struct clock_event_device *dev);
273 279
274static inline int hrtimer_is_hres_active(struct hrtimer *timer)
275{
276 return timer->base->cpu_base->hres_active;
277}
278
279/* 280/*
280 * The resolution of the clocks. The resolution value is returned in 281 * The resolution of the clocks. The resolution value is returned in
281 * the clock_getres() system call to give application programmers an 282 * the clock_getres() system call to give application programmers an
@@ -298,11 +299,6 @@ extern unsigned int hrtimer_resolution;
298 299
299#define hrtimer_resolution (unsigned int)LOW_RES_NSEC 300#define hrtimer_resolution (unsigned int)LOW_RES_NSEC
300 301
301static inline int hrtimer_is_hres_active(struct hrtimer *timer)
302{
303 return 0;
304}
305
306static inline void clock_was_set_delayed(void) { } 302static inline void clock_was_set_delayed(void) { }
307 303
308#endif 304#endif