1/* SPDX-License-Identifier: MIT */
2/* Copyright © 2025 Intel Corporation */
3
4#ifndef __I915_TIMER_UTIL_H__
5#define __I915_TIMER_UTIL_H__
6
7#include <linux/timer.h>
8#include <asm/rwonce.h>
9
10void cancel_timer(struct timer_list *t);
11void set_timer_ms(struct timer_list *t, unsigned long timeout);
12
13static inline bool timer_active(const struct timer_list *t)
14{
15 return READ_ONCE(t->expires);
16}
17
18static inline bool timer_expired(const struct timer_list *t)
19{
20 return timer_active(t) && !timer_pending(timer: t);
21}
22
23#endif /* __I915_TIMER_UTIL_H__ */
24