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 ]
Showing the changes to include/linux (2 of 7 files). Show all
Unified · Split
| @@ -347,10 +347,15 @@ DECLARE_PER_CPU(struct tick_device, tick_cpu_device); · 346 unmodified lines | |||
| 347 | /* Initialize timers: */ | 347 | /* Initialize timers: */ |
| 348 | extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, | 348 | extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, |
| 349 | enum hrtimer_mode mode); | 349 | enum hrtimer_mode mode); |
| 350 | extern 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 |
| 352 | extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock, | 354 | extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock, |
| 353 | enum hrtimer_mode mode); | 355 | 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); | ||
| 354 | 359 | ||
| 355 | extern void destroy_hrtimer_on_stack(struct hrtimer *timer); | 360 | extern 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, · 3 unmodified lines | |||
| 360 | { | 365 | { |
| 361 | hrtimer_init(timer, which_clock, mode); | 366 | hrtimer_init(timer, which_clock, mode); |
| 362 | } | 367 | } |
| 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 | |||
| 363 | static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { } | 376 | static 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, · 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 | ||
| 466 | extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl); | ||
| 467 | |||
| 468 | extern int schedule_hrtimeout_range(ktime_t *expires, u64 delta, | 479 | extern int schedule_hrtimeout_range(ktime_t *expires, u64 delta, |
| 469 | const enum hrtimer_mode mode); | 480 | const enum hrtimer_mode mode); |
| 470 | extern int schedule_hrtimeout_range_clock(ktime_t *expires, | 481 | extern 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, |
| @@ -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, \ |