History

hrtimer: Consolidate hrtimer_init() + hrtimer_init_sleeper() calls

hrtimer_init_sleeper() calls require prior initialisation of the hrtimer object which is embedded into the hrtimer_sleeper. Combine the initialization and spare a function call. Fixup all call sites. This is also a preparatory change for PREEMPT_RT to do hrtimer sleeper specific initializations of the embedded hrtimer without modifying any of the call sites. No functional change. [ anna-maria: Minor cleanups ] [ tglx: Adopted to the removal of the task argument of hrtimer_init_sleeper() and trivial polishing. Folded a fix from Stephen Rothwell for the vsoc code ]

Sebastian Andrzej Siewior committed 7 years ago

Commit dbc16251 parent b7449487 files · +55 −30Browse files

Showing the changes to include/linux (2 of 7 files). Show all

Unified · Split

2 files
  1. include/linux/hrtimer.h +14 −3
  2. include/linux/wait.h +2 −2
include/linux/hrtimer.h+14−3
@@ -347,10 +347,15 @@ DECLARE_PER_CPU(struct tick_device, tick_cpu_device); · 346 unmodified lines
347347 /* Initialize timers: */
348348 extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock,
349349 enum hrtimer_mode mode);
350+extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, clockid_t clock_id,
351+ enum hrtimer_mode mode);
350352
351353 #ifdef CONFIG_DEBUG_OBJECTS_TIMERS
352354 extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock,
353355 enum hrtimer_mode mode);
356+extern void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl,
357+ clockid_t clock_id,
358+ enum hrtimer_mode mode);
354359
355360 extern void destroy_hrtimer_on_stack(struct hrtimer *timer);
356361 #else
@@ -360,6 +365,14 @@ static inline void hrtimer_init_on_stack(struct hrtimer *timer, · 3 unmodified lines
360365 {
361366 hrtimer_init(timer, which_clock, mode);
362367 }
368+
369+static inline void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl,
370+ clockid_t clock_id,
371+ enum hrtimer_mode mode)
372+{
373+ hrtimer_init_sleeper(sl, clock_id, mode);
374+}
375+
363376 static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { }
364377 #endif
365378
@@ -463,10 +476,8 @@ extern long hrtimer_nanosleep(const struct timespec64 *rqtp, · 97 unmodified lines
463476 const enum hrtimer_mode mode,
464477 const clockid_t clockid);
465478
466−extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl);
467−
468479 extern int schedule_hrtimeout_range(ktime_t *expires, u64 delta,
469− const enum hrtimer_mode mode);
480+ const enum hrtimer_mode mode);
470481 extern int schedule_hrtimeout_range_clock(ktime_t *expires,
471482 u64 delta,
472483 const enum hrtimer_mode mode,
include/linux/wait.h+2−2
@@ -488,8 +488,8 @@ do { \ · 487 unmodified lines
488488 int __ret = 0; \
489489 struct hrtimer_sleeper __t; \
490490 \
491− hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); \
492− hrtimer_init_sleeper(&__t); \
491+ hrtimer_init_sleeper_on_stack(&__t, CLOCK_MONOTONIC, \
492+ HRTIMER_MODE_REL); \
493493 if ((timeout) != KTIME_MAX) \
494494 hrtimer_start_range_ns(&__t.timer, timeout, \
495495 current->timer_slack_ns, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t