18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * lib/bust_spinlocks.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Provides a minimal bust_spinlocks for architectures which don't
68c2ecf20Sopenharmony_ci * have one of their own.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * bust_spinlocks() clears any spinlocks which would prevent oops, die(), BUG()
98c2ecf20Sopenharmony_ci * and panic() information from reaching the user.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/kernel.h>
138c2ecf20Sopenharmony_ci#include <linux/printk.h>
148c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
158c2ecf20Sopenharmony_ci#include <linux/tty.h>
168c2ecf20Sopenharmony_ci#include <linux/wait.h>
178c2ecf20Sopenharmony_ci#include <linux/vt_kern.h>
188c2ecf20Sopenharmony_ci#include <linux/console.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_civoid bust_spinlocks(int yes)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	if (yes) {
238c2ecf20Sopenharmony_ci		++oops_in_progress;
248c2ecf20Sopenharmony_ci	} else {
258c2ecf20Sopenharmony_ci#ifdef CONFIG_VT
268c2ecf20Sopenharmony_ci		unblank_screen();
278c2ecf20Sopenharmony_ci#endif
288c2ecf20Sopenharmony_ci		console_unblank();
298c2ecf20Sopenharmony_ci		if (--oops_in_progress == 0)
308c2ecf20Sopenharmony_ci			wake_up_klogd();
318c2ecf20Sopenharmony_ci	}
328c2ecf20Sopenharmony_ci}
33