Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 /*
0003  * Copyright © 2022 Intel Corporation
0004  */
0005 
0006 #ifndef __I915_TASKLET_H__
0007 #define __I915_TASKLET_H__
0008 
0009 #include <linux/interrupt.h>
0010 
0011 static inline void tasklet_lock(struct tasklet_struct *t)
0012 {
0013     while (!tasklet_trylock(t))
0014         cpu_relax();
0015 }
0016 
0017 static inline bool tasklet_is_locked(const struct tasklet_struct *t)
0018 {
0019     return test_bit(TASKLET_STATE_RUN, &t->state);
0020 }
0021 
0022 static inline void __tasklet_disable_sync_once(struct tasklet_struct *t)
0023 {
0024     if (!atomic_fetch_inc(&t->count))
0025         tasklet_unlock_spin_wait(t);
0026 }
0027 
0028 static inline bool __tasklet_is_enabled(const struct tasklet_struct *t)
0029 {
0030     return !atomic_read(&t->count);
0031 }
0032 
0033 static inline bool __tasklet_enable(struct tasklet_struct *t)
0034 {
0035     return atomic_dec_and_test(&t->count);
0036 }
0037 
0038 static inline bool __tasklet_is_scheduled(struct tasklet_struct *t)
0039 {
0040     return test_bit(TASKLET_STATE_SCHED, &t->state);
0041 }
0042 
0043 #endif /* __I915_TASKLET_H__ */