@@ -417,6 +417,11 @@ static inline void debug_hrtimer_init(struct hrtimer *timer)
417
417
debug_object_init (timer , & hrtimer_debug_descr );
418
418
}
419
419
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
+
420
425
static inline void debug_hrtimer_activate (struct hrtimer * timer ,
421
426
enum hrtimer_mode mode )
422
427
{
@@ -428,28 +433,6 @@ static inline void debug_hrtimer_deactivate(struct hrtimer *timer)
428
433
debug_object_deactivate (timer , & hrtimer_debug_descr );
429
434
}
430
435
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
-
453
436
void destroy_hrtimer_on_stack (struct hrtimer * timer )
454
437
{
455
438
debug_object_free (timer , & hrtimer_debug_descr );
@@ -459,6 +442,7 @@ EXPORT_SYMBOL_GPL(destroy_hrtimer_on_stack);
459
442
#else
460
443
461
444
static inline void debug_hrtimer_init (struct hrtimer * timer ) { }
445
+ static inline void debug_hrtimer_init_on_stack (struct hrtimer * timer ) { }
462
446
static inline void debug_hrtimer_activate (struct hrtimer * timer ,
463
447
enum hrtimer_mode mode ) { }
464
448
static inline void debug_hrtimer_deactivate (struct hrtimer * timer ) { }
@@ -472,6 +456,13 @@ debug_init(struct hrtimer *timer, clockid_t clockid,
472
456
trace_hrtimer_init (timer , clockid , mode );
473
457
}
474
458
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
+
475
466
static inline void debug_activate (struct hrtimer * timer ,
476
467
enum hrtimer_mode mode )
477
468
{
@@ -1600,6 +1591,23 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
1600
1591
}
1601
1592
EXPORT_SYMBOL_GPL (hrtimer_init );
1602
1593
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
+
1603
1611
/*
1604
1612
* A timer is active, when it is enqueued into the rbtree or the
1605
1613
* 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,
1944
1952
* Make the enqueue delivery mode check work on RT. If the sleeper
1945
1953
* was initialized for hard interrupt delivery, force the mode bit.
1946
1954
* 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
1948
1956
* fiddling with this decision is avoided at the call sites.
1949
1957
*/
1950
1958
if (IS_ENABLED (CONFIG_PREEMPT_RT ) && sl -> timer .is_hard )
@@ -1987,19 +1995,18 @@ static void __hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
1987
1995
}
1988
1996
1989
1997
/**
1990
- * hrtimer_init_sleeper - initialize sleeper to the given clock
1998
+ * hrtimer_init_sleeper_on_stack - initialize a sleeper in stack memory
1991
1999
* @sl: sleeper to be initialized
1992
2000
* @clock_id: the clock to be used
1993
2001
* @mode: timer mode abs/rel
1994
2002
*/
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 )
1997
2005
{
1998
- debug_init (& sl -> timer , clock_id , mode );
2006
+ debug_init_on_stack (& sl -> timer , clock_id , mode );
1999
2007
__hrtimer_init_sleeper (sl , clock_id , mode );
2000
-
2001
2008
}
2002
- EXPORT_SYMBOL_GPL (hrtimer_init_sleeper );
2009
+ EXPORT_SYMBOL_GPL (hrtimer_init_sleeper_on_stack );
2003
2010
2004
2011
int nanosleep_copyout (struct restart_block * restart , struct timespec64 * ts )
2005
2012
{
0 commit comments