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
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_TIMERS353#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#else361#else
@@ -360,6 +365,14 @@ static inline void hrtimer_init_on_stack(struct hrtimer *timer, · 3 unmodified lines
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#endif377#endif
365 378
@@ -463,10 +476,8 @@ extern long hrtimer_nanosleep(const struct timespec64 *rqtp, · 97 unmodified lines
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,
include/linux/wait.h+2−2
@@ -488,8 +488,8 @@ do { \ · 487 unmodified lines
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, \

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