Skip to content

Commit 50d91c7

Browse files
author
Kent Overstreet
committed
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>
1 parent 2e346b1 commit 50d91c7

File tree

3 files changed

+53
-43
lines changed

3 files changed

+53
-43
lines changed

include/linux/hrtimer.h

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
#define _LINUX_HRTIMER_H
1414

1515
#include <linux/hrtimer_defs.h>
16-
#include <linux/rbtree.h>
16+
#include <linux/hrtimer_types.h>
1717
#include <linux/init.h>
1818
#include <linux/list.h>
1919
#include <linux/percpu-defs.h>
20+
#include <linux/rbtree.h>
2021
#include <linux/seqlock.h>
2122
#include <linux/timer.h>
22-
#include <linux/timerqueue.h>
2323

2424
struct hrtimer_clock_base;
2525
struct hrtimer_cpu_base;
@@ -59,14 +59,6 @@ enum hrtimer_mode {
5959
HRTIMER_MODE_REL_PINNED_HARD = HRTIMER_MODE_REL_PINNED | HRTIMER_MODE_HARD,
6060
};
6161

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-
7062
/*
7163
* Values to track state of the timer
7264
*
@@ -94,38 +86,6 @@ enum hrtimer_restart {
9486
#define HRTIMER_STATE_INACTIVE 0x00
9587
#define HRTIMER_STATE_ENQUEUED 0x01
9688

97-
/**
98-
* struct hrtimer - the basic hrtimer structure
99-
* @node: timerqueue node, which also manages node.expires,
100-
* the absolute expiry time in the hrtimers internal
101-
* representation. The time is related to the clock on
102-
* which the timer is based. Is setup by adding
103-
* slack to the _softexpires value. For non range timers
104-
* identical to _softexpires.
105-
* @_softexpires: the absolute earliest expiry time of the hrtimer.
106-
* The time which was given as expiry time when the timer
107-
* was armed.
108-
* @function: timer expiry callback function
109-
* @base: pointer to the timer base (per cpu and per clock)
110-
* @state: state information (See bit values above)
111-
* @is_rel: Set if the timer was armed relative
112-
* @is_soft: Set if hrtimer will be expired in soft interrupt context.
113-
* @is_hard: Set if hrtimer will be expired in hard interrupt context
114-
* even on RT.
115-
*
116-
* The hrtimer structure must be initialized by hrtimer_init()
117-
*/
118-
struct hrtimer {
119-
struct timerqueue_node node;
120-
ktime_t _softexpires;
121-
enum hrtimer_restart (*function)(struct hrtimer *);
122-
struct hrtimer_clock_base *base;
123-
u8 state;
124-
u8 is_rel;
125-
u8 is_soft;
126-
u8 is_hard;
127-
};
128-
12989
/**
13090
* struct hrtimer_sleeper - simple sleeper structure
13191
* @timer: embedded timer structure

include/linux/hrtimer_types.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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 */

include/linux/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <linux/kmsan_types.h>
1818
#include <linux/mutex.h>
1919
#include <linux/plist.h>
20-
#include <linux/hrtimer.h>
20+
#include <linux/hrtimer_types.h>
2121
#include <linux/irqflags.h>
2222
#include <linux/seccomp.h>
2323
#include <linux/nodemask_types.h>

0 commit comments

Comments
 (0)