PERFORCE change 132102 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Sun Dec 30 06:52:21 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=132102
Change 132102 by hselasky at hselasky_laptop001 on 2007/12/30 14:51:43
Update the debugging prints in "uchcom".
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/uchcom.c#10 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/uchcom.c#10 (text+ko) ====
@@ -92,13 +92,19 @@
#include <dev/usb/ucomvar.h>
#include "usbdevs.h"
-#ifdef UCHCOM_DEBUG
-#define DPRINTFN(n, x) if (uchcomdebug > (n)) logprintf x
-int uchcomdebug = 0;
+#ifdef USB_DEBUG
+#define DPRINTFN(n,fmt,...) \
+ do { if (uchcom_debug > (n)) { \
+ printf("%s: " fmt, __FUNCTION__,## __VA_ARGS__); } } while (0)
+
+static int uchcom_debug = 0;
+
+SYSCTL_NODE(_hw_usb, OID_AUTO, uchcom, CTLFLAG_RW, 0, "USB uchcom");
+SYSCTL_INT(_hw_usb_uchcom, OID_AUTO, debug, CTLFLAG_RW,
+ &uchcom_debug, 0, "uchcom debug level");
#else
-#define DPRINTFN(n, x)
+#define DPRINTFN(...) do { } while (0)
#endif
-#define DPRINTF(x) DPRINTFN(0, x)
#define UCHCOM_IFACE_INDEX 0
#define UCHCOM_CONFIG_INDEX 0
@@ -694,7 +700,7 @@
static int
uchcom_clear_chip(struct uchcom_softc *sc)
{
- DPRINTF(("%s: clear\n", USBDEVNAME(sc->sc_dev)));
+ DPRINTFN(0, "\n");
uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, 0, 0);
return;
}
@@ -723,8 +729,7 @@
idx |= mod & 0xF8;
val |= 0x10;
- DPRINTF(("%s: reset v=0x%04X, i=0x%04X\n",
- USBDEVNAME(sc->sc_dev), val, idx));
+ DPRINTFN(0, "reset v=0x%04X, i=0x%04X\n", val, idx);
uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, val, idx);
@@ -903,18 +908,17 @@
if (status == USBD_NOT_STARTED || status == USBD_CANCELLED)
return;
- DPRINTF(("%s: abnormal status: %s\n",
- USBDEVNAME(sc->sc_dev), usbd_errstr(status)));
+ DPRINTFN(0, "abnormal status: %s\n",
+ usbd_errstr(status));
usbd_clear_endpoint_stall_async(sc->sc_intr_pipe);
return;
}
- DPRINTF(("%s: intr: 0x%02X 0x%02X 0x%02X 0x%02X "
+ DPRINTFN(0, "intr: 0x%02X 0x%02X 0x%02X 0x%02X "
"0x%02X 0x%02X 0x%02X 0x%02X\n",
- USBDEVNAME(sc->sc_dev),
(unsigned)buf[0], (unsigned)buf[1],
(unsigned)buf[2], (unsigned)buf[3],
(unsigned)buf[4], (unsigned)buf[5],
- (unsigned)buf[6], (unsigned)buf[7]));
+ (unsigned)buf[6], (unsigned)buf[7]);
uchcom_convert_status(sc, buf[UCHCOM_INTR_STAT1]);
ucom_status_change(&sc->sc_ucom);
More information about the p4-projects
mailing list