summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authorpaul <paul@FreeBSD.org>2000-05-03 17:45:04 +0000
committerpaul <paul@FreeBSD.org>2000-05-03 17:45:04 +0000
commit8864544bcf0eb6baa94793b373780ec2d5d732c7 (patch)
treee639589d1f6f856fb3e03ed1414ec343d2565744 /sys/kern/subr_bus.c
parentc7cde3fa560af8f56d6c264d3c49feeaedc35542 (diff)
downloadFreeBSD-src-8864544bcf0eb6baa94793b373780ec2d5d732c7.zip
FreeBSD-src-8864544bcf0eb6baa94793b373780ec2d5d732c7.tar.gz
If BUS_DEBUG is defined then create a sysctl, debug.bus_debug, that
is used to control whether the debug messages are output at runtime. It defaults to on so that if you define BUS_DEBUG in your kernel then you get all the debugging info when you boot. It's very useful for disabling all the debugging info when you're developing a loadable device driver and you're doing lots of loads and unloads but don't always want to see all the debugging info.
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index de36141..ddd1e4f 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -46,7 +46,12 @@
MALLOC_DEFINE(M_BUS, "bus", "Bus data structures");
#ifdef BUS_DEBUG
-#define PDEBUG(a) (printf(__FUNCTION__ ":%d: ", __LINE__), printf a, printf("\n"))
+#include <sys/sysctl.h>
+
+static int bus_debug = 1;
+SYSCTL_INT(_debug, OID_AUTO, bus_debug, CTLFLAG_RW, &bus_debug, 0, "Debug bus code");
+
+#define PDEBUG(a) if (bus_debug) {printf(__FUNCTION__ ":%d: ", __LINE__), printf a, printf("\n");}
#define DEVICENAME(d) ((d)? device_get_name(d): "no device")
#define DRIVERNAME(d) ((d)? d->name : "no driver")
#define DEVCLANAME(d) ((d)? d->name : "no devclass")
OpenPOWER on IntegriCloud