We have two variables with the same meaning. db_active is used in way
more places, so let's nuke db_is_active.

Now that db_active is in <sys/systm.h> for a while already and not
guarded by DDB anymore, take the opportunity to clean up some places
that use it.
---
 sys/arch/macppc/dev/zs.c               |  8 ++------
 sys/arch/sparc64/sparc64/ipifuncs.c    |  2 --
 sys/ddb/db_trap.c                      |  2 --
 sys/ddb/db_var.h                       |  1 -
 sys/dev/pci/drm/include/linux/kernel.h |  4 +---
 sys/dev/pci/drm/include/linux/kgdb.h   |  4 ++--
 sys/kern/subr_prf.c                    | 14 ++------------
 sys/kern/subr_witness.c                |  2 +-
 8 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/sys/arch/macppc/dev/zs.c b/sys/arch/macppc/dev/zs.c
index ba4453683ca..f6f1901a3e1 100644
--- a/sys/arch/macppc/dev/zs.c
+++ b/sys/arch/macppc/dev/zs.c
@@ -1091,12 +1091,8 @@ zs_abort(struct zs_chanstate *channel)
        } while (rr0 & ZSRR0_BREAK);
 
 #if defined(DDB)
-       {
-               extern int db_active;
-
-               if (!db_active)
-                       db_enter();
-       }
+       if (!db_active)
+               db_enter();
 #endif
 }
 
diff --git a/sys/arch/sparc64/sparc64/ipifuncs.c 
b/sys/arch/sparc64/sparc64/ipifuncs.c
index 1ffeb666bf4..54603319a1e 100644
--- a/sys/arch/sparc64/sparc64/ipifuncs.c
+++ b/sys/arch/sparc64/sparc64/ipifuncs.c
@@ -39,8 +39,6 @@
 #include <machine/pmap.h>
 #include <machine/sparc64.h>
 
-extern int db_active;
-
 #define SPARC64_IPI_RETRIES    10000
 
 #define        sparc64_ipi_sleep()     delay(1000)
diff --git a/sys/ddb/db_trap.c b/sys/ddb/db_trap.c
index 85467256e61..f1c6317a715 100644
--- a/sys/ddb/db_trap.c
+++ b/sys/ddb/db_trap.c
@@ -52,7 +52,6 @@ db_trap(int type, int code)
        boolean_t       bkpt;
        boolean_t       watchpt;
 
-       db_is_active = 1;
        bkpt = IS_BREAKPOINT_TRAP(type, code);
        watchpt = IS_WATCHPOINT_TRAP(type, code);
 
@@ -94,5 +93,4 @@ db_trap(int type, int code)
        }
 
        db_restart_at_pc(&ddb_regs, watchpt);
-       db_is_active = 0;
 }
diff --git a/sys/ddb/db_var.h b/sys/ddb/db_var.h
index 3bb02b5d34d..f264aaa6c7f 100644
--- a/sys/ddb/db_var.h
+++ b/sys/ddb/db_var.h
@@ -67,7 +67,6 @@ extern int    db_max_line;
 extern int     db_panic;
 extern int     db_console;
 extern int     db_log;
-extern int     db_is_active;
 extern int     db_profile;
 
 int    ddb_sysctl(int *, u_int, void *, size_t *, void *, size_t,
diff --git a/sys/dev/pci/drm/include/linux/kernel.h 
b/sys/dev/pci/drm/include/linux/kernel.h
index 188efad2f4f..d0b274c88c8 100644
--- a/sys/dev/pci/drm/include/linux/kernel.h
+++ b/sys/dev/pci/drm/include/linux/kernel.h
@@ -9,8 +9,6 @@
 #include <sys/stdarg.h>
 #include <sys/malloc.h>
 
-#include <ddb/db_var.h>
-
 #include <linux/types.h>
 #include <linux/compiler.h>
 #include <linux/bitops.h>
@@ -119,7 +117,7 @@ static inline int
 _in_dbg_master(void)
 {
 #ifdef DDB
-       return (db_is_active);
+       return (db_active);
 #endif
        return (0);
 }
diff --git a/sys/dev/pci/drm/include/linux/kgdb.h 
b/sys/dev/pci/drm/include/linux/kgdb.h
index 73759b3be75..874a0ebe0be 100644
--- a/sys/dev/pci/drm/include/linux/kgdb.h
+++ b/sys/dev/pci/drm/include/linux/kgdb.h
@@ -3,13 +3,13 @@
 #ifndef _LINUX_KGDB_H
 #define _LINUX_KGDB_H
 
-#include <ddb/db_var.h>
+#include <sys/systm.h>
 
 static inline int
 in_dbg_master(void)
 {
 #ifdef DDB
-       return (db_is_active);
+       return (db_active);
 #endif
        return (0);
 }
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 6abac53452a..87bb23d1ded 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -118,11 +118,6 @@ int        db_console = 1;
 #else
 int    db_console = 0;
 #endif
-
-/*
- * flag to indicate if we are currently in ddb (on some processor)
- */
-int db_is_active;
 #endif
 
 /*
@@ -330,16 +325,11 @@ void
 kputchar(int c, int flags, struct tty *tp)
 {
        extern int msgbufmapped;
-       int ddb_active = 0;
-
-#ifdef DDB
-       ddb_active = db_is_active;
-#endif
 
        if (panicstr)
                constty = NULL;
 
-       if ((flags & TOCONS) && tp == NULL && constty && !ddb_active) {
+       if ((flags & TOCONS) && tp == NULL && constty && !db_active) {
                tp = constty;
                flags |= TOTTY;
        }
@@ -349,7 +339,7 @@ kputchar(int c, int flags, struct tty *tp)
        if ((flags & TOLOG) &&
            c != '\0' && c != '\r' && c != 0177 && msgbufmapped)
                msgbuf_putchar(msgbufp, c);
-       if ((flags & TOCONS) && (constty == NULL || ddb_active) && c != '\0')
+       if ((flags & TOCONS) && (constty == NULL || db_active) && c != '\0')
                (*v_putc)(c);
 #ifdef DDB
        if (flags & TODDB)
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 6a45ccd3735..5c6ecfe62de 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -2051,7 +2051,7 @@ witness_ddb_list(struct proc *p)
        struct witness_cpu *wc = &witness_cpu[cpu_number()];
 
        KASSERTMSG(witness_cold == 0, "%s: witness_cold", __func__);
-       KASSERTMSG(db_is_active, "%s: not in the debugger", __func__);
+       KASSERTMSG(db_active, "%s: not in the debugger", __func__);
 
        if (witness_watch < 1)
                return;
-- 
2.22.0

Reply via email to