mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
![Thomas Gleixner](/assets/img/avatar_default.png)
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 lines
744 B
C
26 lines
744 B
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Do sleep inside a spin-lock
|
|
* Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de>
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
#include <sound/core.h>
|
|
#include "seq_lock.h"
|
|
|
|
/* wait until all locks are released */
|
|
void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
|
|
{
|
|
int warn_count = 5 * HZ;
|
|
|
|
if (atomic_read(lockp) < 0) {
|
|
pr_warn("ALSA: seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line);
|
|
return;
|
|
}
|
|
while (atomic_read(lockp) > 0) {
|
|
if (warn_count-- == 0)
|
|
pr_warn("ALSA: seq_lock: waiting [%d left] in %s:%d\n", atomic_read(lockp), file, line);
|
|
schedule_timeout_uninterruptible(1);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(snd_use_lock_sync_helper);
|