aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2019-07-26 14:30:50 -0400
committerThomas Gleixner <tglx@linutronix.de>2019-08-01 11:43:15 -0400
commitdbc1625fc9deefb352f6ff26a575ae4b3ddef23a (patch)
tree7fc49674dac208e582c328956ab5ff831ffb8575 /include/linux
parentb74494872555d1f7888dfd9225700a363f4a84fc (diff)
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 ] Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20190726185752.887468908@linutronix.de
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hrtimer.h17
-rw-r--r--include/linux/wait.h4
2 files changed, 16 insertions, 5 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 3c74f89367c4..0df373bed3d7 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -347,10 +347,15 @@ DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
347/* Initialize timers: */ 347/* Initialize timers: */
348extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, 348extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock,
349 enum hrtimer_mode mode); 349 enum hrtimer_mode mode);
350extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, clockid_t clock_id,
351 enum hrtimer_mode mode);
350 352
351#ifdef CONFIG_DEBUG_OBJECTS_TIMERS 353#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
352extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock, 354extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock,
353 enum hrtimer_mode mode); 355 enum hrtimer_mode mode);
356extern void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl,
357 clockid_t clock_id,
358 enum hrtimer_mode mode);
354 359
355extern void destroy_hrtimer_on_stack(struct hrtimer *timer); 360extern void destroy_hrtimer_on_stack(struct hrtimer *timer);
356#else 361#else
@@ -360,6 +365,14 @@ static inline void hrtimer_init_on_stack(struct hrtimer *timer,
360{ 365{
361 hrtimer_init(timer, which_clock, mode); 366 hrtimer_init(timer, which_clock, mode);
362} 367}
368
369static 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
363static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { } 376static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { }
364#endif 377#endif
365 378
@@ -463,10 +476,8 @@ extern long hrtimer_nanosleep(const struct timespec64 *rqtp,
463 const enum hrtimer_mode mode, 476 const enum hrtimer_mode mode,
464 const clockid_t clockid); 477 const clockid_t clockid);
465 478
466extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl);
467
468extern int schedule_hrtimeout_range(ktime_t *expires, u64 delta, 479extern int schedule_hrtimeout_range(ktime_t *expires, u64 delta,
469 const enum hrtimer_mode mode); 480 const enum hrtimer_mode mode);
470extern int schedule_hrtimeout_range_clock(ktime_t *expires, 481extern int schedule_hrtimeout_range_clock(ktime_t *expires,
471 u64 delta, 482 u64 delta,
472 const enum hrtimer_mode mode, 483 const enum hrtimer_mode mode,
diff --git a/include/linux/wait.h b/include/linux/wait.h
index d57832774ca6..4707543ef575 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -488,8 +488,8 @@ do { \
488 int __ret = 0; \ 488 int __ret = 0; \
489 struct hrtimer_sleeper __t; \ 489 struct hrtimer_sleeper __t; \
490 \ 490 \
491 hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); \ 491 hrtimer_init_sleeper_on_stack(&__t, CLOCK_MONOTONIC, \
492 hrtimer_init_sleeper(&__t); \ 492 HRTIMER_MODE_REL); \
493 if ((timeout) != KTIME_MAX) \ 493 if ((timeout) != KTIME_MAX) \
494 hrtimer_start_range_ns(&__t.timer, timeout, \ 494 hrtimer_start_range_ns(&__t.timer, timeout, \
495 current->timer_slack_ns, \ 495 current->timer_slack_ns, \