@@ -417,6 +417,11 @@ static inline void debug_hrtimer_init(struct hrtimer *timer)
417417 debug_object_init (timer , & hrtimer_debug_descr );
418418}
419419
420+ static inline void debug_hrtimer_init_on_stack (struct hrtimer * timer )
421+ {
422+ debug_object_init_on_stack (timer , & hrtimer_debug_descr );
423+ }
424+
420425static inline void debug_hrtimer_activate (struct hrtimer * timer ,
421426 enum hrtimer_mode mode )
422427{
@@ -428,28 +433,6 @@ static inline void debug_hrtimer_deactivate(struct hrtimer *timer)
428433 debug_object_deactivate (timer , & hrtimer_debug_descr );
429434}
430435
431- static void __hrtimer_init (struct hrtimer * timer , clockid_t clock_id ,
432- enum hrtimer_mode mode );
433-
434- void hrtimer_init_on_stack (struct hrtimer * timer , clockid_t clock_id ,
435- enum hrtimer_mode mode )
436- {
437- debug_object_init_on_stack (timer , & hrtimer_debug_descr );
438- __hrtimer_init (timer , clock_id , mode );
439- }
440- EXPORT_SYMBOL_GPL (hrtimer_init_on_stack );
441-
442- static void __hrtimer_init_sleeper (struct hrtimer_sleeper * sl ,
443- clockid_t clock_id , enum hrtimer_mode mode );
444-
445- void hrtimer_init_sleeper_on_stack (struct hrtimer_sleeper * sl ,
446- clockid_t clock_id , enum hrtimer_mode mode )
447- {
448- debug_object_init_on_stack (& sl -> timer , & hrtimer_debug_descr );
449- __hrtimer_init_sleeper (sl , clock_id , mode );
450- }
451- EXPORT_SYMBOL_GPL (hrtimer_init_sleeper_on_stack );
452-
453436void destroy_hrtimer_on_stack (struct hrtimer * timer )
454437{
455438 debug_object_free (timer , & hrtimer_debug_descr );
@@ -459,6 +442,7 @@ EXPORT_SYMBOL_GPL(destroy_hrtimer_on_stack);
459442#else
460443
461444static inline void debug_hrtimer_init (struct hrtimer * timer ) { }
445+ static inline void debug_hrtimer_init_on_stack (struct hrtimer * timer ) { }
462446static inline void debug_hrtimer_activate (struct hrtimer * timer ,
463447 enum hrtimer_mode mode ) { }
464448static inline void debug_hrtimer_deactivate (struct hrtimer * timer ) { }
@@ -472,6 +456,13 @@ debug_init(struct hrtimer *timer, clockid_t clockid,
472456 trace_hrtimer_init (timer , clockid , mode );
473457}
474458
459+ static inline void debug_init_on_stack (struct hrtimer * timer , clockid_t clockid ,
460+ enum hrtimer_mode mode )
461+ {
462+ debug_hrtimer_init_on_stack (timer );
463+ trace_hrtimer_init (timer , clockid , mode );
464+ }
465+
475466static inline void debug_activate (struct hrtimer * timer ,
476467 enum hrtimer_mode mode )
477468{
@@ -1600,6 +1591,23 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
16001591}
16011592EXPORT_SYMBOL_GPL (hrtimer_init );
16021593
1594+ /**
1595+ * hrtimer_init_on_stack - initialize a timer in stack memory
1596+ * @timer: The timer to be initialized
1597+ * @clock_id: The clock to be used
1598+ * @mode: The timer mode
1599+ *
1600+ * Similar to hrtimer_init(), except that this one must be used if struct hrtimer is in stack
1601+ * memory.
1602+ */
1603+ void hrtimer_init_on_stack (struct hrtimer * timer , clockid_t clock_id ,
1604+ enum hrtimer_mode mode )
1605+ {
1606+ debug_init_on_stack (timer , clock_id , mode );
1607+ __hrtimer_init (timer , clock_id , mode );
1608+ }
1609+ EXPORT_SYMBOL_GPL (hrtimer_init_on_stack );
1610+
16031611/*
16041612 * A timer is active, when it is enqueued into the rbtree or the
16051613 * callback function is running or it's in the state of being migrated
@@ -1944,7 +1952,7 @@ void hrtimer_sleeper_start_expires(struct hrtimer_sleeper *sl,
19441952 * Make the enqueue delivery mode check work on RT. If the sleeper
19451953 * was initialized for hard interrupt delivery, force the mode bit.
19461954 * This is a special case for hrtimer_sleepers because
1947- * hrtimer_init_sleeper () determines the delivery mode on RT so the
1955+ * __hrtimer_init_sleeper () determines the delivery mode on RT so the
19481956 * fiddling with this decision is avoided at the call sites.
19491957 */
19501958 if (IS_ENABLED (CONFIG_PREEMPT_RT ) && sl -> timer .is_hard )
@@ -1987,19 +1995,18 @@ static void __hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
19871995}
19881996
19891997/**
1990- * hrtimer_init_sleeper - initialize sleeper to the given clock
1998+ * hrtimer_init_sleeper_on_stack - initialize a sleeper in stack memory
19911999 * @sl: sleeper to be initialized
19922000 * @clock_id: the clock to be used
19932001 * @mode: timer mode abs/rel
19942002 */
1995- void hrtimer_init_sleeper (struct hrtimer_sleeper * sl , clockid_t clock_id ,
1996- enum hrtimer_mode mode )
2003+ void hrtimer_init_sleeper_on_stack (struct hrtimer_sleeper * sl ,
2004+ clockid_t clock_id , enum hrtimer_mode mode )
19972005{
1998- debug_init (& sl -> timer , clock_id , mode );
2006+ debug_init_on_stack (& sl -> timer , clock_id , mode );
19992007 __hrtimer_init_sleeper (sl , clock_id , mode );
2000-
20012008}
2002- EXPORT_SYMBOL_GPL (hrtimer_init_sleeper );
2009+ EXPORT_SYMBOL_GPL (hrtimer_init_sleeper_on_stack );
20032010
20042011int nanosleep_copyout (struct restart_block * restart , struct timespec64 * ts )
20052012{
0 commit comments