Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking/local_lock: s/l/__l/ and s/tl/__tl/ to reduce the risk of shadowing

The Linux kernel coding style advises to avoid common variable
names in function-like macros to reduce the risk of namespace
collisions.

Throughout local_lock_internal.h, several macros use the rather common
variable names 'l' and 'tl'. This already resulted in an actual
collision: the __local_lock_acquire() function like macro is currently
shadowing the parameter 'l' of the:

class_##_name##_t class_##_name##_constructor(_type *l)

function factory from <linux/cleanup.h>.

Rename the variable 'l' to '__l' and the variable 'tl' to '__tl'
throughout the file to fix the current namespace collision and
to prevent future ones.

[ bigeasy: Rebase, update all l and tl instances in macros ]

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Waiman Long <longman@redhat.com>
Link: https://patch.msgid.link/20251127144140.215722-3-bigeasy@linutronix.de

authored by

Vincent Mailhol and committed by
Ingo Molnar
719e357f 52ed7461

+31 -31
+31 -31
include/linux/local_lock_internal.h
··· 99 99 100 100 #define __local_lock_acquire(lock) \ 101 101 do { \ 102 - local_trylock_t *tl; \ 103 - local_lock_t *l; \ 102 + local_trylock_t *__tl; \ 103 + local_lock_t *__l; \ 104 104 \ 105 - l = (local_lock_t *)(lock); \ 106 - tl = (local_trylock_t *)l; \ 105 + __l = (local_lock_t *)(lock); \ 106 + __tl = (local_trylock_t *)__l; \ 107 107 _Generic((lock), \ 108 108 local_trylock_t *: ({ \ 109 - lockdep_assert(tl->acquired == 0); \ 110 - WRITE_ONCE(tl->acquired, 1); \ 109 + lockdep_assert(__tl->acquired == 0); \ 110 + WRITE_ONCE(__tl->acquired, 1); \ 111 111 }), \ 112 112 local_lock_t *: (void)0); \ 113 - local_lock_acquire(l); \ 113 + local_lock_acquire(__l); \ 114 114 } while (0) 115 115 116 116 #define __local_lock(lock) \ ··· 133 133 134 134 #define __local_trylock(lock) \ 135 135 ({ \ 136 - local_trylock_t *tl; \ 136 + local_trylock_t *__tl; \ 137 137 \ 138 138 preempt_disable(); \ 139 - tl = (lock); \ 140 - if (READ_ONCE(tl->acquired)) { \ 139 + __tl = (lock); \ 140 + if (READ_ONCE(__tl->acquired)) { \ 141 141 preempt_enable(); \ 142 - tl = NULL; \ 142 + __tl = NULL; \ 143 143 } else { \ 144 - WRITE_ONCE(tl->acquired, 1); \ 144 + WRITE_ONCE(__tl->acquired, 1); \ 145 145 local_trylock_acquire( \ 146 - (local_lock_t *)tl); \ 146 + (local_lock_t *)__tl); \ 147 147 } \ 148 - !!tl; \ 148 + !!__tl; \ 149 149 }) 150 150 151 151 #define __local_trylock_irqsave(lock, flags) \ 152 152 ({ \ 153 - local_trylock_t *tl; \ 153 + local_trylock_t *__tl; \ 154 154 \ 155 155 local_irq_save(flags); \ 156 - tl = (lock); \ 157 - if (READ_ONCE(tl->acquired)) { \ 156 + __tl = (lock); \ 157 + if (READ_ONCE(__tl->acquired)) { \ 158 158 local_irq_restore(flags); \ 159 - tl = NULL; \ 159 + __tl = NULL; \ 160 160 } else { \ 161 - WRITE_ONCE(tl->acquired, 1); \ 161 + WRITE_ONCE(__tl->acquired, 1); \ 162 162 local_trylock_acquire( \ 163 - (local_lock_t *)tl); \ 163 + (local_lock_t *)__tl); \ 164 164 } \ 165 - !!tl; \ 165 + !!__tl; \ 166 166 }) 167 167 168 168 /* preemption or migration must be disabled before calling __local_lock_is_locked */ ··· 170 170 171 171 #define __local_lock_release(lock) \ 172 172 do { \ 173 - local_trylock_t *tl; \ 174 - local_lock_t *l; \ 173 + local_trylock_t *__tl; \ 174 + local_lock_t *__l; \ 175 175 \ 176 - l = (local_lock_t *)(lock); \ 177 - tl = (local_trylock_t *)l; \ 178 - local_lock_release(l); \ 176 + __l = (local_lock_t *)(lock); \ 177 + __tl = (local_trylock_t *)__l; \ 178 + local_lock_release(__l); \ 179 179 _Generic((lock), \ 180 180 local_trylock_t *: ({ \ 181 - lockdep_assert(tl->acquired == 1); \ 182 - WRITE_ONCE(tl->acquired, 0); \ 181 + lockdep_assert(__tl->acquired == 1); \ 182 + WRITE_ONCE(__tl->acquired, 0); \ 183 183 }), \ 184 184 local_lock_t *: (void)0); \ 185 185 } while (0) ··· 223 223 #define INIT_LOCAL_LOCK(lockname) __LOCAL_SPIN_LOCK_UNLOCKED((lockname)) 224 224 #define INIT_LOCAL_TRYLOCK(lockname) __LOCAL_SPIN_LOCK_UNLOCKED((lockname)) 225 225 226 - #define __local_lock_init(l) \ 226 + #define __local_lock_init(__l) \ 227 227 do { \ 228 - local_spin_lock_init((l)); \ 228 + local_spin_lock_init((__l)); \ 229 229 } while (0) 230 230 231 - #define __local_trylock_init(l) __local_lock_init(l) 231 + #define __local_trylock_init(__l) __local_lock_init(__l) 232 232 233 233 #define __local_lock(__lock) \ 234 234 do { \