Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hrtimers: Split out hrtimer_types.h

We need to reduce the scope of what's included in sched.h: task_struct
includes a hrtimer, so split out the core types into their own header.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Thomas Gleixner <tglx@linutronix.de>

+53 -43
+2 -42
include/linux/hrtimer.h
··· 13 13 #define _LINUX_HRTIMER_H 14 14 15 15 #include <linux/hrtimer_defs.h> 16 - #include <linux/rbtree.h> 16 + #include <linux/hrtimer_types.h> 17 17 #include <linux/init.h> 18 18 #include <linux/list.h> 19 19 #include <linux/percpu-defs.h> 20 + #include <linux/rbtree.h> 20 21 #include <linux/seqlock.h> 21 22 #include <linux/timer.h> 22 - #include <linux/timerqueue.h> 23 23 24 24 struct hrtimer_clock_base; 25 25 struct hrtimer_cpu_base; ··· 60 60 }; 61 61 62 62 /* 63 - * Return values for the callback function 64 - */ 65 - enum hrtimer_restart { 66 - HRTIMER_NORESTART, /* Timer is not restarted */ 67 - HRTIMER_RESTART, /* Timer must be restarted */ 68 - }; 69 - 70 - /* 71 63 * Values to track state of the timer 72 64 * 73 65 * Possible states: ··· 85 93 */ 86 94 #define HRTIMER_STATE_INACTIVE 0x00 87 95 #define HRTIMER_STATE_ENQUEUED 0x01 88 - 89 - /** 90 - * struct hrtimer - the basic hrtimer structure 91 - * @node: timerqueue node, which also manages node.expires, 92 - * the absolute expiry time in the hrtimers internal 93 - * representation. The time is related to the clock on 94 - * which the timer is based. Is setup by adding 95 - * slack to the _softexpires value. For non range timers 96 - * identical to _softexpires. 97 - * @_softexpires: the absolute earliest expiry time of the hrtimer. 98 - * The time which was given as expiry time when the timer 99 - * was armed. 100 - * @function: timer expiry callback function 101 - * @base: pointer to the timer base (per cpu and per clock) 102 - * @state: state information (See bit values above) 103 - * @is_rel: Set if the timer was armed relative 104 - * @is_soft: Set if hrtimer will be expired in soft interrupt context. 105 - * @is_hard: Set if hrtimer will be expired in hard interrupt context 106 - * even on RT. 107 - * 108 - * The hrtimer structure must be initialized by hrtimer_init() 109 - */ 110 - struct hrtimer { 111 - struct timerqueue_node node; 112 - ktime_t _softexpires; 113 - enum hrtimer_restart (*function)(struct hrtimer *); 114 - struct hrtimer_clock_base *base; 115 - u8 state; 116 - u8 is_rel; 117 - u8 is_soft; 118 - u8 is_hard; 119 - }; 120 96 121 97 /** 122 98 * struct hrtimer_sleeper - simple sleeper structure
+50
include/linux/hrtimer_types.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _LINUX_HRTIMER_TYPES_H 3 + #define _LINUX_HRTIMER_TYPES_H 4 + 5 + #include <linux/types.h> 6 + #include <linux/timerqueue.h> 7 + 8 + struct hrtimer_clock_base; 9 + 10 + /* 11 + * Return values for the callback function 12 + */ 13 + enum hrtimer_restart { 14 + HRTIMER_NORESTART, /* Timer is not restarted */ 15 + HRTIMER_RESTART, /* Timer must be restarted */ 16 + }; 17 + 18 + /** 19 + * struct hrtimer - the basic hrtimer structure 20 + * @node: timerqueue node, which also manages node.expires, 21 + * the absolute expiry time in the hrtimers internal 22 + * representation. The time is related to the clock on 23 + * which the timer is based. Is setup by adding 24 + * slack to the _softexpires value. For non range timers 25 + * identical to _softexpires. 26 + * @_softexpires: the absolute earliest expiry time of the hrtimer. 27 + * The time which was given as expiry time when the timer 28 + * was armed. 29 + * @function: timer expiry callback function 30 + * @base: pointer to the timer base (per cpu and per clock) 31 + * @state: state information (See bit values above) 32 + * @is_rel: Set if the timer was armed relative 33 + * @is_soft: Set if hrtimer will be expired in soft interrupt context. 34 + * @is_hard: Set if hrtimer will be expired in hard interrupt context 35 + * even on RT. 36 + * 37 + * The hrtimer structure must be initialized by hrtimer_init() 38 + */ 39 + struct hrtimer { 40 + struct timerqueue_node node; 41 + ktime_t _softexpires; 42 + enum hrtimer_restart (*function)(struct hrtimer *); 43 + struct hrtimer_clock_base *base; 44 + u8 state; 45 + u8 is_rel; 46 + u8 is_soft; 47 + u8 is_hard; 48 + }; 49 + 50 + #endif /* _LINUX_HRTIMER_TYPES_H */
+1 -1
include/linux/sched.h
··· 17 17 #include <linux/kmsan_types.h> 18 18 #include <linux/mutex.h> 19 19 #include <linux/plist.h> 20 - #include <linux/hrtimer.h> 20 + #include <linux/hrtimer_types.h> 21 21 #include <linux/irqflags.h> 22 22 #include <linux/seccomp.h> 23 23 #include <linux/nodemask_types.h>