1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2022 Intel Corporation
6 #ifndef __I915_TASKLET_H__
7 #define __I915_TASKLET_H__
9 #include <linux/interrupt.h>
11 static inline void tasklet_lock(struct tasklet_struct *t)
13 while (!tasklet_trylock(t))
17 static inline bool tasklet_is_locked(const struct tasklet_struct *t)
19 return test_bit(TASKLET_STATE_RUN, &t->state);
22 static inline void __tasklet_disable_sync_once(struct tasklet_struct *t)
24 if (!atomic_fetch_inc(&t->count))
25 tasklet_unlock_spin_wait(t);
28 static inline bool __tasklet_is_enabled(const struct tasklet_struct *t)
30 return !atomic_read(&t->count);
33 static inline bool __tasklet_enable(struct tasklet_struct *t)
35 return atomic_dec_and_test(&t->count);
38 static inline bool __tasklet_is_scheduled(struct tasklet_struct *t)
40 return test_bit(TASKLET_STATE_SCHED, &t->state);
43 #endif /* __I915_TASKLET_H__ */