xen/spinlock: make spinlock initializers more readable

Use named member initializers instead of positional ones for the macros
used to initialize structures.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Juergen Gross authored and Jan Beulich committed 2023-12-12 14:05:19 +01:00
1 parent a77fcbc389
commit 7fca0463c7
1 file changed
+11 -4
+11 -4
View File
@@ -21,7 +21,7 @@ union lock_debug {
bool unseen:1;
};
};
#define _LOCK_DEBUG { LOCK_DEBUG_INITVAL }
#define _LOCK_DEBUG { .val = LOCK_DEBUG_INITVAL }
void check_lock(union lock_debug *debug, bool try);
void lock_enter(const union lock_debug *debug);
void lock_exit(const union lock_debug *debug);
@@ -94,12 +94,16 @@ struct lock_profile_qhead {
int32_t idx; /* index for printout */
};
#define _LOCK_PROFILE(name) { NULL, #name, &name, 0, 0, 0, 0, 0 }
#define _LOCK_PROFILE(lockname) { .name = #lockname, .lock = &lockname, }
#define _LOCK_PROFILE_PTR(name) \
static struct lock_profile * const __lock_profile_##name \
__used_section(".lockprofile.data") = \
&__lock_profile_data_##name
#define _SPIN_LOCK_UNLOCKED(x) { { 0 }, SPINLOCK_NO_CPU, 0, _LOCK_DEBUG, x }
#define _SPIN_LOCK_UNLOCKED(x) { \
.recurse_cpu = SPINLOCK_NO_CPU, \
.debug =_LOCK_DEBUG, \
.profile = x, \
}
#define SPIN_LOCK_UNLOCKED _SPIN_LOCK_UNLOCKED(NULL)
#define DEFINE_SPINLOCK(l) \
spinlock_t l = _SPIN_LOCK_UNLOCKED(NULL); \
@@ -142,7 +146,10 @@ extern void cf_check spinlock_profile_reset(unsigned char key);
struct lock_profile_qhead { };
#define SPIN_LOCK_UNLOCKED { { 0 }, SPINLOCK_NO_CPU, 0, _LOCK_DEBUG }
#define SPIN_LOCK_UNLOCKED { \
.recurse_cpu = SPINLOCK_NO_CPU, \
.debug =_LOCK_DEBUG, \
}
#define DEFINE_SPINLOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
#define spin_lock_init_prof(s, l) spin_lock_init(&((s)->l))
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.