1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Do sleep inside a spin-lock
7 #include <linux/export.h>
8 #include <sound/core.h>
11 /* wait until all locks are released */
12 void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
14 int warn_count = 5 * HZ;
16 if (atomic_read(lockp) < 0) {
17 pr_warn("ALSA: seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line);
20 while (atomic_read(lockp) > 0) {
21 if (warn_count-- == 0)
22 pr_warn("ALSA: seq_lock: waiting [%d left] in %s:%d\n", atomic_read(lockp), file, line);
23 schedule_timeout_uninterruptible(1);
26 EXPORT_SYMBOL(snd_use_lock_sync_helper);