44 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2022 Intel Corporation4 */5 6#ifndef __I915_TASKLET_H__7#define __I915_TASKLET_H__8 9#include <linux/interrupt.h>10 11static inline void tasklet_lock(struct tasklet_struct *t)12{13 while (!tasklet_trylock(t))14 cpu_relax();15}16 17static inline bool tasklet_is_locked(const struct tasklet_struct *t)18{19 return test_bit(TASKLET_STATE_RUN, &t->state);20}21 22static inline void __tasklet_disable_sync_once(struct tasklet_struct *t)23{24 if (!atomic_fetch_inc(&t->count))25 tasklet_unlock_spin_wait(t);26}27 28static inline bool __tasklet_is_enabled(const struct tasklet_struct *t)29{30 return !atomic_read(&t->count);31}32 33static inline bool __tasklet_enable(struct tasklet_struct *t)34{35 return atomic_dec_and_test(&t->count);36}37 38static inline bool __tasklet_is_scheduled(struct tasklet_struct *t)39{40 return test_bit(TASKLET_STATE_SCHED, &t->state);41}42 43#endif /* __I915_TASKLET_H__ */44