diff options
| author | Dmitry Antipov <[email protected]> | 2025-06-26 07:30:54 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2025-07-16 12:11:20 +0000 |
| commit | 01afddcac630b8c6a5f44ac5d0e508ca440e44a2 (patch) | |
| tree | d442851c1555dc6b20f2197a39e77626219f0f66 /drivers/android/binder_alloc.h | |
| parent | binder: use kstrdup() in binderfs_binder_device_create() (diff) | |
| download | kernel-01afddcac630b8c6a5f44ac5d0e508ca440e44a2.tar.gz kernel-01afddcac630b8c6a5f44ac5d0e508ca440e44a2.zip | |
binder: use guards for plain mutex- and spinlock-protected sections
Use 'guard(mutex)' and 'guard(spinlock)' for plain (i.e. non-scoped)
mutex- and spinlock-protected sections, respectively, thus making
locking a bit simpler. Briefly tested with 'stress-ng --binderfs'.
Signed-off-by: Dmitry Antipov <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Acked-by: Carlos Llamas <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/android/binder_alloc.h')
| -rw-r--r-- | drivers/android/binder_alloc.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h index feecd7414241..a9d5f3169e12 100644 --- a/drivers/android/binder_alloc.h +++ b/drivers/android/binder_alloc.h @@ -160,12 +160,8 @@ void binder_alloc_print_pages(struct seq_file *m, static inline size_t binder_alloc_get_free_async_space(struct binder_alloc *alloc) { - size_t free_async_space; - - mutex_lock(&alloc->mutex); - free_async_space = alloc->free_async_space; - mutex_unlock(&alloc->mutex); - return free_async_space; + guard(mutex)(&alloc->mutex); + return alloc->free_async_space; } unsigned long |
