Skip to content

Commit 7972506

Browse files
wedsonafojeda
authored andcommitted
locking/spinlock: introduce _raw_spin_lock_init
A Rust helper (introduced in a later patch) needs to call `raw_spin_lock_init` with a passed key, rather than define one in place. In order to do that, this changes the `raw_spin_lock_init` macro to call a new `_raw_spin_lock_init` function which takes the key as an extra parameter. Co-developed-by: Alex Gaynor <[email protected]> Signed-off-by: Alex Gaynor <[email protected]> Signed-off-by: Wedson Almeida Filho <[email protected]> Co-developed-by: Miguel Ojeda <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 2265fa8 commit 7972506

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/linux/spinlock.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,17 @@
9999
extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
100100
struct lock_class_key *key, short inner);
101101

102+
static inline void _raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
103+
struct lock_class_key *key)
104+
{
105+
__raw_spin_lock_init(lock, name, key, LD_WAIT_SPIN);
106+
}
107+
102108
# define raw_spin_lock_init(lock) \
103109
do { \
104110
static struct lock_class_key __key; \
105111
\
106-
__raw_spin_lock_init((lock), #lock, &__key, LD_WAIT_SPIN); \
112+
_raw_spin_lock_init((lock), #lock, &__key); \
107113
} while (0)
108114

109115
#else

0 commit comments

Comments
 (0)