From 879e0604ee6ac0ded87f6754141e7af25f4b7d5a Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Sun, 12 Jan 2020 06:07:54 +0000 Subject: Add KERNEL_PANICKED macro for use in place of direct panicstr tests --- sys/dev/acpica/acpi.c | 2 +- sys/dev/drm2/drm_fb_helper.c | 2 +- sys/dev/iscsi/iscsi.c | 2 +- sys/dev/mrsas/mrsas.c | 2 +- sys/dev/syscons/syscons.c | 4 ++-- sys/dev/vt/vt_core.c | 4 ++-- sys/dev/xen/console/xen_console.c | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 517ebb8e98b3..508ad45f6d9c 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -2166,7 +2166,7 @@ acpi_shutdown_final(void *arg, int howto) } else if (status != AE_NOT_EXIST) device_printf(sc->acpi_dev, "reset failed - %s\n", AcpiFormatException(status)); - } else if (sc->acpi_do_disable && panicstr == NULL) { + } else if (sc->acpi_do_disable && !KERNEL_PANICKED()) { /* * Only disable ACPI if the user requested. On some systems, writing * the disable value to SMI_CMD hangs the system. diff --git a/sys/dev/drm2/drm_fb_helper.c b/sys/dev/drm2/drm_fb_helper.c index cf98d2f9dfec..8cb913570c13 100644 --- a/sys/dev/drm2/drm_fb_helper.c +++ b/sys/dev/drm2/drm_fb_helper.c @@ -74,7 +74,7 @@ vt_kms_postswitch(void *arg) sc = (struct vt_kms_softc *)arg; - if (!kdb_active && panicstr == NULL) + if (!kdb_active && !KERNEL_PANICKED()) taskqueue_enqueue(taskqueue_thread, &sc->fb_mode_task); else drm_fb_helper_restore_fbdev_mode(sc->fb_helper); diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 7bc746b5095c..e7463876eae6 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -2501,7 +2501,7 @@ static void iscsi_shutdown_post(struct iscsi_softc *sc) { - if (panicstr == NULL) { + if (!KERNEL_PANICKED()) { ISCSI_DEBUG("removing all sessions due to shutdown"); iscsi_terminate_sessions(sc); } diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index df4fb98c53eb..00e8b6aa2cd2 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -1190,7 +1190,7 @@ mrsas_shutdown(device_t dev) sc = device_get_softc(dev); sc->remove_in_progress = 1; - if (panicstr == NULL) { + if (!KERNEL_PANICKED()) { if (sc->ocr_thread_active) wakeup(&sc->ocr_chan); i = 0; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 2b897ac26656..06d4e525e834 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -2163,7 +2163,7 @@ sccnupdate(scr_stat *scp) if (suspend_in_progress || scp->sc->font_loading_in_progress) return; - if (kdb_active || panicstr || shutdown_in_progress) { + if (kdb_active || KERNEL_PANICKED() || shutdown_in_progress) { sc_touch_scrn_saver(); } else if (scp != scp->sc->cur_scp) { return; @@ -2229,7 +2229,7 @@ scrn_timer(void *arg) } /* should we stop the screen saver? */ - if (kdb_active || panicstr || shutdown_in_progress) + if (kdb_active || KERNEL_PANICKED() || shutdown_in_progress) sc_touch_scrn_saver(); if (run_scrn_saver) { if (time_uptime > sc->scrn_time_stamp + scrn_blank_time) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 3d7eecdb1b10..76ae1e2be281 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -1301,7 +1301,7 @@ vt_flush(struct vt_device *vd) /* Check if the cursor should be displayed or not. */ if ((vd->vd_flags & VDF_MOUSECURSOR) && /* Mouse support enabled. */ !(vw->vw_flags & VWF_MOUSE_HIDE) && /* Cursor displayed. */ - !kdb_active && panicstr == NULL) { /* DDB inactive. */ + !kdb_active && !KERNEL_PANICKED()) { /* DDB inactive. */ vd->vd_mshown = 1; } else { vd->vd_mshown = 0; @@ -1398,7 +1398,7 @@ vtterm_done(struct terminal *tm) struct vt_window *vw = tm->tm_softc; struct vt_device *vd = vw->vw_device; - if (kdb_active || panicstr != NULL) { + if (kdb_active || KERNEL_PANICKED()) { /* Switch to the debugger. */ if (vd->vd_curwindow != vw) { vd->vd_curwindow = vw; diff --git a/sys/dev/xen/console/xen_console.c b/sys/dev/xen/console/xen_console.c index e61795a6317c..d7ffb591768e 100644 --- a/sys/dev/xen/console/xen_console.c +++ b/sys/dev/xen/console/xen_console.c @@ -199,7 +199,7 @@ xc_printf(const char *fmt, ...) static inline void xencons_lock(struct xencons_priv *cons) { - if (panicstr == NULL) + if (!KERNEL_PANICKED()) mtx_lock_spin(&cons->mtx); } @@ -207,7 +207,7 @@ static inline void xencons_lock(struct xencons_priv *cons) static inline void xencons_unlock(struct xencons_priv *cons) { - if (panicstr == NULL) + if (!KERNEL_PANICKED()) mtx_unlock_spin(&cons->mtx); } -- cgit v1.3