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_types.h>
7
8struct hrtimer_clock_base;
9
10/*
11 * Return values for the callback function
12 */
13enum 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 */
39struct 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 */
51