mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 22:21:21 +00:00
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>
This commit is contained in:
parent
da21c5a58a
commit
28bfd18bf3
2 changed files with 23 additions and 28 deletions
|
@ -512,6 +512,20 @@ static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
|
|||
offs_real, offs_boot, offs_tai);
|
||||
}
|
||||
|
||||
/*
|
||||
* Is the high resolution mode active ?
|
||||
*/
|
||||
static inline int __hrtimer_hres_active(struct hrtimer_cpu_base *cpu_base)
|
||||
{
|
||||
return IS_ENABLED(CONFIG_HIGH_RES_TIMERS) ?
|
||||
cpu_base->hres_active : 0;
|
||||
}
|
||||
|
||||
static inline int hrtimer_hres_active(void)
|
||||
{
|
||||
return __hrtimer_hres_active(this_cpu_ptr(&hrtimer_bases));
|
||||
}
|
||||
|
||||
/* High resolution timer related functions */
|
||||
#ifdef CONFIG_HIGH_RES_TIMERS
|
||||
|
||||
|
@ -540,19 +554,6 @@ static inline int hrtimer_is_hres_enabled(void)
|
|||
return hrtimer_hres_enabled;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is the high resolution mode active ?
|
||||
*/
|
||||
static inline int __hrtimer_hres_active(struct hrtimer_cpu_base *cpu_base)
|
||||
{
|
||||
return cpu_base->hres_active;
|
||||
}
|
||||
|
||||
static inline int hrtimer_hres_active(void)
|
||||
{
|
||||
return __hrtimer_hres_active(this_cpu_ptr(&hrtimer_bases));
|
||||
}
|
||||
|
||||
/*
|
||||
* Reprogram the event source with checking both queues for the
|
||||
* next event
|
||||
|
@ -661,7 +662,6 @@ static void hrtimer_reprogram(struct hrtimer *timer,
|
|||
static inline void hrtimer_init_hres(struct hrtimer_cpu_base *base)
|
||||
{
|
||||
base->expires_next = KTIME_MAX;
|
||||
base->hres_active = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -720,8 +720,6 @@ void clock_was_set_delayed(void)
|
|||
|
||||
#else
|
||||
|
||||
static inline int __hrtimer_hres_active(struct hrtimer_cpu_base *b) { return 0; }
|
||||
static inline int hrtimer_hres_active(void) { return 0; }
|
||||
static inline int hrtimer_is_hres_enabled(void) { return 0; }
|
||||
static inline void hrtimer_switch_to_hres(void) { }
|
||||
static inline void
|
||||
|
@ -1600,6 +1598,7 @@ int hrtimers_prepare_cpu(unsigned int cpu)
|
|||
}
|
||||
|
||||
cpu_base->cpu = cpu;
|
||||
cpu_base->hres_active = 0;
|
||||
hrtimer_init_hres(cpu_base);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue