diff options
author | joe <joe@FreeBSD.org> | 2002-07-31 13:33:55 +0000 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2002-07-31 13:33:55 +0000 |
commit | 03e965b480798ffb5a2740bb8c871c70054ced82 (patch) | |
tree | dd95364f776cb0c0e54f022e48c5e8db7f52c692 | |
parent | db2b5421c21286b0bc2dc446ebf11eb4912f480e (diff) | |
download | FreeBSD-src-03e965b480798ffb5a2740bb8c871c70054ced82.zip FreeBSD-src-03e965b480798ffb5a2740bb8c871c70054ced82.tar.gz |
Get bored with hard coded debug level variables and introduce a debug.usb
sysctl tree for tweaking them real-time.
Reviewed by: iedowse
-rw-r--r-- | sys/dev/sound/usb/uaudio.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/ohci.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/ucom.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/udbp.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/ufm.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/ugen.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/uhci.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/uhid.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/ukbd.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/ulpt.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/umass.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/umodem.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/ums.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/uplcom.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/urio.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/usb.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/usb_port.h | 4 | ||||
-rw-r--r-- | sys/dev/usb/uscanner.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/uvisor.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/uvscom.c | 7 |
20 files changed, 58 insertions, 17 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index dc1f68e..c96355b 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -66,6 +66,7 @@ #include <sys/conf.h> #endif #include <sys/poll.h> +#include <sys/sysctl.h> #if defined(__NetBSD__) || defined(__OpenBSD__) #include <sys/audioio.h> @@ -89,6 +90,8 @@ #define DPRINTF(x) if (uaudiodebug) logprintf x #define DPRINTFN(n,x) if (uaudiodebug>(n)) logprintf x int uaudiodebug = 0; +SYSCTL_INT(_debug_usb, OID_AUTO, uaudio, CTLFLAG_RW, + &uaudiodebug, 0, "uaudio debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index b15b178..acdc78b 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -64,6 +64,7 @@ #endif #include <sys/proc.h> #include <sys/queue.h> +#include <sys/sysctl.h> #include <machine/bus.h> #include <machine/endian.h> @@ -93,6 +94,8 @@ struct cfdriver ohci_cd = { #define DPRINTF(x) if (ohcidebug) logprintf x #define DPRINTFN(n,x) if (ohcidebug>(n)) logprintf x int ohcidebug = 0; +SYSCTL_INT(_debug_usb, OID_AUTO, ohci, CTLFLAG_RW, + &ohcidebug, 0, "ohci debug level"); #ifndef __NetBSD__ #define bitmask_snprintf(q,f,b,l) snprintf((b), (l), "%b", (q), (f)) #endif diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 7da8e3b..b88d1da 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -88,6 +88,7 @@ #include <sys/proc.h> #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> @@ -100,14 +101,9 @@ #include <dev/usb/ucomvar.h> #ifdef UCOM_DEBUG -#include <sys/sysctl.h> - static int ucomdebug = 1; - -SYSCTL_NODE(_debug, OID_AUTO, usb, CTLFLAG_RW, 0, "USB debugging"); SYSCTL_INT(_debug_usb, OID_AUTO, ucom, CTLFLAG_RW, &ucomdebug, 0, "ucom debug level"); - #define DPRINTF(x) do { \ if (ucomdebug) \ logprintf x; \ diff --git a/sys/dev/usb/udbp.c b/sys/dev/usb/udbp.c index 3669680..06add0b 100644 --- a/sys/dev/usb/udbp.c +++ b/sys/dev/usb/udbp.c @@ -87,6 +87,7 @@ #include <sys/socket.h> #include <sys/ctype.h> #include <sys/errno.h> +#include <sys/sysctl.h> #include <net/if.h> #include <dev/usb/usb.h> @@ -107,6 +108,8 @@ #define DPRINTF(x) if (udbpdebug) logprintf x #define DPRINTFN(n,x) if (udbpdebug>(n)) logprintf x int udbpdebug = 9; +SYSCTL_INT(_debug_usb, OID_AUTO, udbp, CTLFLAG_RW, + &udbpdebug, 0, "udbp debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 0ad7679..609c95d 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -55,6 +55,7 @@ #endif #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -67,6 +68,8 @@ #define DPRINTF(x) if (ufmdebug) logprintf x #define DPRINTFN(n,x) if (ufmdebug>(n)) logprintf x int ufmdebug = 100; +SYSCTL_INT(_debug_usb, OID_AUTO, ufm, CTLFLAG_RW, + &ufmdebug, 0, "ufm debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 3b1dcb5..354ce91 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -63,6 +63,7 @@ #endif #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -72,6 +73,8 @@ #define DPRINTF(x) if (ugendebug) logprintf x #define DPRINTFN(n,x) if (ugendebug>(n)) logprintf x int ugendebug = 0; +SYSCTL_INT(_debug_usb, OID_AUTO, ugen, CTLFLAG_RW, + &ugendebug, 0, "ugen debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 34b24dd..1115c69 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -66,6 +66,7 @@ #endif #include <sys/proc.h> #include <sys/queue.h> +#include <sys/sysctl.h> #include <machine/bus.h> #include <machine/endian.h> @@ -102,6 +103,8 @@ uhci_softc_t *thesc; #define DPRINTFN(n,x) if (uhcidebug>(n)) printf x int uhcidebug = 0; int uhcinoloop = 0; +SYSCTL_INT(_debug_usb, OID_AUTO, uhci, CTLFLAG_RW, + &uhcidebug, 0, "uhci debug level"); #ifndef __NetBSD__ #define bitmask_snprintf(q,f,b,l) snprintf((b), (l), "%b", (q), (f)) #endif diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 8f03247..47ff17e 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -70,6 +70,7 @@ #include <sys/proc.h> #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> @@ -86,6 +87,8 @@ #define DPRINTF(x) if (uhiddebug) logprintf x #define DPRINTFN(n,x) if (uhiddebug>(n)) logprintf x int uhiddebug = 0; +SYSCTL_INT(_debug_usb, OID_AUTO, uhid, CTLFLAG_RW, + &uhiddebug, 0, "uhid debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c index 8d078ea..a212d5b 100644 --- a/sys/dev/usb/ukbd.c +++ b/sys/dev/usb/ukbd.c @@ -57,6 +57,7 @@ #include <sys/select.h> #endif #include <sys/vnode.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> @@ -79,6 +80,8 @@ #define DPRINTF(x) if (ukbddebug) logprintf x #define DPRINTFN(n,x) if (ukbddebug>(n)) logprintf x int ukbddebug = 1; +SYSCTL_INT(_debug_usb, OID_AUTO, ukbd, CTLFLAG_RW, + &ukbddebug, 0, "ukbd debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 97e1709..bd04998 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -58,6 +58,7 @@ #include <sys/conf.h> #include <sys/vnode.h> #include <sys/syslog.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -75,6 +76,8 @@ #define DPRINTF(x) if (ulptdebug) logprintf x #define DPRINTFN(n,x) if (ulptdebug>(n)) logprintf x int ulptdebug = 0; +SYSCTL_INT(_debug_usb, OID_AUTO, ulpt, CTLFLAG_RW, + &ulptdebug, 0, "ulpt debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 5512647..5da86a8 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -104,6 +104,7 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -134,6 +135,8 @@ #define UDMASS_WIRE (UDMASS_BBB|UDMASS_CBI) #define UDMASS_ALL 0xffff0000 /* all of the above */ int umassdebug = UDMASS_ALL; +SYSCTL_INT(_debug_usb, OID_AUTO, umass, CTLFLAG_RW, + &umassdebug, 0, "umass debug level"); #else #define DIF(m, x) /* nop */ #define DPRINTF(m, x) /* nop */ diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index f04a0c3..d05b663 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -75,6 +75,7 @@ #include <sys/proc.h> #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> @@ -90,6 +91,8 @@ #define DPRINTF(x) if(umodemdebug) logprintf x #define DPRINTFN(n, x) if(umodemdebug > (n)) logprintf x int umodemdebug = 1; +SYSCTL_INT(_debug_usb, OID_AUTO, umodem, CTLFLAG_RW, + &umodemdebug, 0, "umodem debug level"); #else #define DPRINTF(x) #define DPRINTFN(n, x) diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 0c89724..210a9a2 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -58,6 +58,7 @@ #endif #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> @@ -74,6 +75,8 @@ #define DPRINTF(x) if (umsdebug) logprintf x #define DPRINTFN(n,x) if (umsdebug>(n)) logprintf x int umsdebug = 1; +SYSCTL_INT(_debug_usb, OID_AUTO, ums, CTLFLAG_RW, + &umsdebug, 0, "ums debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index aea7028..640cdfb 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -89,6 +89,7 @@ #include <sys/proc.h> #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> @@ -101,11 +102,7 @@ #include <dev/usb/ucomvar.h> #ifdef UPLCOM_DEBUG -#include <sys/sysctl.h> - static int uplcomdebug = 1; - -SYSCTL_DECL(_debug_usb); SYSCTL_INT(_debug_usb, OID_AUTO, uplcom, CTLFLAG_RW, &uplcomdebug, 0, "uplcom debug level"); diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 9a90a1b..03793d1 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -67,6 +67,7 @@ #endif #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -79,6 +80,8 @@ #define DPRINTF(x) if (uriodebug) logprintf x #define DPRINTFN(n,x) if (uriodebug>(n)) logprintf x int uriodebug = 100; +SYSCTL_INT(_debug_usb, OID_AUTO, urio, CTLFLAG_RW, + &uriodebug, 0, "urio debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 6320801..e455cee 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -70,6 +70,7 @@ #endif #include <sys/vnode.h> #include <sys/signalvar.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -91,10 +92,17 @@ MALLOC_DEFINE(M_USBHC, "USBHC", "USB host controller"); #include <dev/usb/usbdivar.h> #include <dev/usb/usb_quirks.h> +/* Define this unconditionally in case a kernel module is loaded that + * has been compiled with debugging options. + */ +SYSCTL_NODE(_debug, OID_AUTO, usb, CTLFLAG_RW, 0, "USB debugging"); + #ifdef USB_DEBUG #define DPRINTF(x) if (usbdebug) logprintf x #define DPRINTFN(n,x) if (usbdebug>(n)) logprintf x int usbdebug = 0; +SYSCTL_INT(_debug_usb, OID_AUTO, usb, CTLFLAG_RW, + &usbdebug, 0, "usb debug level"); #ifdef UHCI_DEBUG extern int uhcidebug; #endif diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 1b61d2b..affd908 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -532,6 +532,10 @@ __CONCAT(dname,_detach)(device_t self) */ #define logprintf printf +#ifdef SYSCTL_DECL +SYSCTL_DECL(_debug_usb); +#endif + #endif /* __FreeBSD__ */ #endif /* _USB_PORT_H */ diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index c68f720..7fe32db 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -64,6 +64,7 @@ #include <sys/vnode.h> #include <sys/poll.h> #include <sys/conf.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -75,6 +76,8 @@ #define DPRINTF(x) if (uscannerdebug) logprintf x #define DPRINTFN(n,x) if (uscannerdebug>(n)) logprintf x int uscannerdebug = 0; +SYSCTL_INT(_debug_usb, OID_AUTO, uscanner, CTLFLAG_RW, + &uscannerdebug, 0, "uscanner debug level"); #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index 0467de4..ba4c995 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -64,6 +64,7 @@ #endif #include <sys/conf.h> #include <sys/tty.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> @@ -78,10 +79,8 @@ #define DPRINTF(x) if (uvisordebug) printf x #define DPRINTFN(n,x) if (uvisordebug>(n)) printf x int uvisordebug = 0; -#ifdef SYSCTL_DECL SYSCTL_INT(_debug_usb, OID_AUTO, uvisor, CTLFLAG_RW, &uvisordebug, 0, "uvisor debug level"); -#endif #else #define DPRINTF(x) #define DPRINTFN(n,x) diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index a8d38c6..4f3a067 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -57,6 +57,7 @@ #include <sys/proc.h> #include <sys/vnode.h> #include <sys/poll.h> +#include <sys/sysctl.h> #include <dev/usb/usb.h> #include <dev/usb/usbcdc.h> @@ -70,14 +71,8 @@ #ifdef UVSCOM_DEBUG static int uvscomdebug = 1; - -#if defined(__FreeBSD__) -#include <sys/sysctl.h> - -SYSCTL_DECL(_debug_usb); SYSCTL_INT(_debug_usb, OID_AUTO, uvscom, CTLFLAG_RW, &uvscomdebug, 0, "uvscom debug level"); -#endif #define DPRINTFN(n, x) do { \ if (uvscomdebug > (n)) \ |