Skip to content

Commit

Permalink
hrtimer: Factor out __hrtimer_next_event_base()
Browse files Browse the repository at this point in the history
Preparatory patch for softirq based hrtimers to avoid code duplication.

No functional change.

Signed-off-by: Anna-Maria Gleixner <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: John Stultz <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
anna-marialx authored and Ingo Molnar committed Jan 16, 2018
1 parent 138a6b7 commit ad38f59
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions kernel/time/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,13 @@ __next_base(struct hrtimer_cpu_base *cpu_base, unsigned int *active)
#define for_each_active_base(base, cpu_base, active) \
while ((base = __next_base((cpu_base), &(active))))

static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
static ktime_t __hrtimer_next_event_base(struct hrtimer_cpu_base *cpu_base,
unsigned int active,
ktime_t expires_next)
{
struct hrtimer_clock_base *base;
unsigned int active = cpu_base->active_bases;
ktime_t expires, expires_next = KTIME_MAX;
ktime_t expires;

cpu_base->next_timer = NULL;
for_each_active_base(base, cpu_base, active) {
struct timerqueue_node *next;
struct hrtimer *timer;
Expand All @@ -487,6 +487,18 @@ static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
return expires_next;
}

static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
{
unsigned int active = cpu_base->active_bases;
ktime_t expires_next = KTIME_MAX;

cpu_base->next_timer = NULL;

expires_next = __hrtimer_next_event_base(cpu_base, active, expires_next);

return expires_next;
}

static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
{
ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset;
Expand Down

0 comments on commit ad38f59

Please sign in to comment.