xref: /linux-6.15/include/linux/hrtimer_types.h (revision 04257da0)
150d91c76SKent Overstreet /* SPDX-License-Identifier: GPL-2.0 */
250d91c76SKent Overstreet #ifndef _LINUX_HRTIMER_TYPES_H
350d91c76SKent Overstreet #define _LINUX_HRTIMER_TYPES_H
450d91c76SKent Overstreet 
550d91c76SKent Overstreet #include <linux/types.h>
6eee51b0aSKent Overstreet #include <linux/timerqueue_types.h>
750d91c76SKent Overstreet 
850d91c76SKent Overstreet struct hrtimer_clock_base;
950d91c76SKent Overstreet 
1050d91c76SKent Overstreet /*
1150d91c76SKent Overstreet  * Return values for the callback function
1250d91c76SKent Overstreet  */
1350d91c76SKent Overstreet enum hrtimer_restart {
1450d91c76SKent Overstreet 	HRTIMER_NORESTART,	/* Timer is not restarted */
1550d91c76SKent Overstreet 	HRTIMER_RESTART,	/* Timer must be restarted */
1650d91c76SKent Overstreet };
1750d91c76SKent Overstreet 
1850d91c76SKent Overstreet /**
1950d91c76SKent Overstreet  * struct hrtimer - the basic hrtimer structure
2050d91c76SKent Overstreet  * @node:	timerqueue node, which also manages node.expires,
2150d91c76SKent Overstreet  *		the absolute expiry time in the hrtimers internal
2250d91c76SKent Overstreet  *		representation. The time is related to the clock on
2350d91c76SKent Overstreet  *		which the timer is based. Is setup by adding
2450d91c76SKent Overstreet  *		slack to the _softexpires value. For non range timers
2550d91c76SKent Overstreet  *		identical to _softexpires.
2650d91c76SKent Overstreet  * @_softexpires: the absolute earliest expiry time of the hrtimer.
2750d91c76SKent Overstreet  *		The time which was given as expiry time when the timer
2850d91c76SKent Overstreet  *		was armed.
2950d91c76SKent Overstreet  * @function:	timer expiry callback function
3050d91c76SKent Overstreet  * @base:	pointer to the timer base (per cpu and per clock)
3150d91c76SKent Overstreet  * @state:	state information (See bit values above)
3250d91c76SKent Overstreet  * @is_rel:	Set if the timer was armed relative
3350d91c76SKent Overstreet  * @is_soft:	Set if hrtimer will be expired in soft interrupt context.
3450d91c76SKent Overstreet  * @is_hard:	Set if hrtimer will be expired in hard interrupt context
3550d91c76SKent Overstreet  *		even on RT.
3650d91c76SKent Overstreet  *
379779489aSNam Cao  * The hrtimer structure must be initialized by hrtimer_setup()
3850d91c76SKent Overstreet  */
3950d91c76SKent Overstreet struct hrtimer {
4050d91c76SKent Overstreet 	struct timerqueue_node		node;
4150d91c76SKent Overstreet 	ktime_t				_softexpires;
42*04257da0SNam Cao 	enum hrtimer_restart		(*__private function)(struct hrtimer *);
4350d91c76SKent Overstreet 	struct hrtimer_clock_base	*base;
4450d91c76SKent Overstreet 	u8				state;
4550d91c76SKent Overstreet 	u8				is_rel;
4650d91c76SKent Overstreet 	u8				is_soft;
4750d91c76SKent Overstreet 	u8				is_hard;
4850d91c76SKent Overstreet };
4950d91c76SKent Overstreet 
5050d91c76SKent Overstreet #endif /* _LINUX_HRTIMER_TYPES_H */
51