diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2024-08-16 20:05:54 +0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2024-08-16 20:33:54 +0300 |
commit | ed7171ff9fabc49ae6ed42fbd082a576473836fc (patch) | |
tree | 62bc21b9b590a7fefb27b6103a121f4386e1815f /include/linux/closure.h | |
parent | db3461a7743817ad7c73553902231b096616813a (diff) | |
parent | a809b92ee0f84c3f655b16a8b4d04bc3665d954a (diff) | |
download | linux-ed7171ff9fabc49ae6ed42fbd082a576473836fc.tar.xz |
Merge drm/drm-next into drm-xe-next
Get drm-xe-next on v6.11-rc2 and synchronized with drm-intel-next for
the display side. This resolves the current conflict for the
enable_display module parameter and allows further pending refactors.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Diffstat (limited to 'include/linux/closure.h')
-rw-r--r-- | include/linux/closure.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/closure.h b/include/linux/closure.h index 99155df162d0..2af44427107d 100644 --- a/include/linux/closure.h +++ b/include/linux/closure.h @@ -159,6 +159,7 @@ struct closure { #ifdef CONFIG_DEBUG_CLOSURES #define CLOSURE_MAGIC_DEAD 0xc054dead #define CLOSURE_MAGIC_ALIVE 0xc054a11e +#define CLOSURE_MAGIC_STACK 0xc05451cc unsigned int magic; struct list_head all; @@ -285,6 +286,21 @@ static inline void closure_get(struct closure *cl) } /** + * closure_get_not_zero + */ +static inline bool closure_get_not_zero(struct closure *cl) +{ + unsigned old = atomic_read(&cl->remaining); + do { + if (!(old & CLOSURE_REMAINING_MASK)) + return false; + + } while (!atomic_try_cmpxchg_acquire(&cl->remaining, &old, old + 1)); + + return true; +} + +/** * closure_init - Initialize a closure, setting the refcount to 1 * @cl: closure to initialize * @parent: parent of the new closure. cl will take a refcount on it for its @@ -308,6 +324,18 @@ static inline void closure_init_stack(struct closure *cl) { memset(cl, 0, sizeof(struct closure)); atomic_set(&cl->remaining, CLOSURE_REMAINING_INITIALIZER); +#ifdef CONFIG_DEBUG_CLOSURES + cl->magic = CLOSURE_MAGIC_STACK; +#endif +} + +static inline void closure_init_stack_release(struct closure *cl) +{ + memset(cl, 0, sizeof(struct closure)); + atomic_set_release(&cl->remaining, CLOSURE_REMAINING_INITIALIZER); +#ifdef CONFIG_DEBUG_CLOSURES + cl->magic = CLOSURE_MAGIC_STACK; +#endif } /** @@ -355,6 +383,8 @@ do { \ */ #define closure_return(_cl) continue_at((_cl), NULL, NULL) +void closure_return_sync(struct closure *cl); + /** * continue_at_nobarrier - jump to another function without barrier * |