Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb tidy up debugging (make it compile with the 'ALL...



details:   https://anonhg.NetBSD.org/src/rev/01cf04473d7b
branches:  trunk
changeset: 828910:01cf04473d7b
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 09 17:58:09 2018 +0000

description:
tidy up debugging (make it compile with the 'ALL' kernel)

diffstat:

 sys/dev/usb/ukbd.c |  35 +++++++++++++++++------------------
 1 files changed, 17 insertions(+), 18 deletions(-)

diffs (141 lines):

diff -r 76f47e6cea40 -r 01cf04473d7b sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c        Tue Jan 09 17:35:29 2018 +0000
+++ b/sys/dev/usb/ukbd.c        Tue Jan 09 17:58:09 2018 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.140 2017/12/18 18:58:00 jmcneill Exp $        */
+/*      $NetBSD: ukbd.c,v 1.141 2018/01/09 17:58:09 christos Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.140 2017/12/18 18:58:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.141 2018/01/09 17:58:09 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -457,7 +457,7 @@
        }
 
        if (sc->sc_console_keyboard) {
-               DPRINTF(("ukbd_attach: console keyboard sc=%p\n", sc));
+               DPRINTF(("%s: console keyboard sc=%p\n", __func__, sc));
                wskbd_cnattach(&ukbd_consops, sc, &ukbd_keymapdata);
                ukbd_enable(sc, 1);
        }
@@ -499,13 +499,12 @@
        /* Should only be called to change state */
        if ((sc->sc_flags & FLAG_ENABLED) != 0 && on != 0) {
 #ifdef DIAGNOSTIC
-               printf("ukbd_enable: %s: bad call on=%d\n",
-                      device_xname(sc->sc_hdev.sc_dev), on);
+               aprint_error_dev(sc->sc_hdev.sc_dev, "bad call on=%d\n", on);
 #endif
                return EBUSY;
        }
 
-       DPRINTF(("ukbd_enable: sc=%p on=%d\n", sc, on));
+       DPRINTF(("%s: sc=%p on=%d\n", __func__, sc, on));
        if (on) {
                sc->sc_flags |= FLAG_ENABLED;
                return uhidev_open(&sc->sc_hdev);
@@ -546,7 +545,7 @@
        struct ukbd_softc *sc = device_private(self);
        int rv = 0;
 
-       DPRINTF(("ukbd_detach: sc=%p flags=%d\n", sc, flags));
+       DPRINTF(("%s: sc=%p flags=%d\n", __func__, sc, flags));
 
        pmf_device_deregister(self);
 
@@ -756,7 +755,7 @@
 #endif
 
        if (isset(ud->keys, KEY_ERROR)) {
-               DPRINTF(("ukbd_intr: KEY_ERROR\n"));
+               DPRINTF(("%s: KEY_ERROR\n", __func__));
                return;         /* ignore  */
        }
 
@@ -784,7 +783,7 @@
                return;
 
        if (sc->sc_flags & FLAG_POLLING) {
-               DPRINTFN(1,("ukbd_intr: pollchar = 0x%03x\n", ibuf[0]));
+               DPRINTFN(1,("%s: pollchar = 0x%03x\n", __func__, ibuf[0]));
                memcpy(sc->sc_pollchars, ibuf, nkeys * sizeof(uint16_t));
                sc->sc_npollchar = nkeys;
                return;
@@ -823,7 +822,7 @@
                                sc->sc_rep[npress++] = c & 0x7f;
                        }
 #endif
-                       DPRINTFN(1,("ukbd_intr: raw = %s0x%02x\n",
+                       DPRINTFN(1,("%s: raw = %s0x%02x\n", __func__,
                                    c & 0x80 ? "0xe0 " : "",
                                    cbuf[j]));
                        j++;
@@ -859,7 +858,7 @@
        struct ukbd_softc *sc = v;
        struct usbd_device *udev = sc->sc_hdev.sc_parent->sc_udev;
 
-       DPRINTF(("ukbd_set_leds: sc=%p leds=%d, sc_leds=%d\n",
+       DPRINTF(("%s: sc=%p leds=%d, sc_leds=%d\n", __func__,
                 sc, leds, sc->sc_leds));
 
        if (sc->sc_dying)
@@ -925,7 +924,7 @@
                return 0;
 #if defined(WSDISPLAY_COMPAT_RAWKBD)
        case WSKBDIO_SETMODE:
-               DPRINTF(("ukbd_ioctl: set raw = %d\n", *(int *)data));
+               DPRINTF(("%s: set raw = %d\n", __func__, *(int *)data));
                sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
 #if defined(UKBD_REPEAT)
                callout_stop(&sc->sc_rawrepeat_ch);
@@ -962,7 +961,7 @@
        } else
                broken = 0;
 
-       DPRINTFN(0,("ukbd_cngetc: enter\n"));
+       DPRINTFN(0,("%s: enter\n", __func__));
        sc->sc_flags |= FLAG_POLLING;
        if (sc->sc_npollchar <= 0)
                usbd_dopoll(sc->sc_hdev.sc_parent->sc_iface);
@@ -974,11 +973,11 @@
                       sc->sc_npollchar * sizeof(uint16_t));
                *type = c & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
                *data = c & CODEMASK;
+               DPRINTFN(0,("%s: return 0x%02x\n", __func__, c));
        } else {
                *type = 0;
                *data = 0;
        }
-       DPRINTFN(0,("ukbd_cngetc: return 0x%02x\n", c));
        if (broken)
                ukbd_cnpollc(v, 0);
 }
@@ -989,7 +988,7 @@
        struct ukbd_softc *sc = v;
        struct usbd_device *dev;
 
-       DPRINTFN(2,("ukbd_cnpollc: sc=%p on=%d\n", v, on));
+       DPRINTFN(2,("%s: sc=%p on=%d\n", __func__, v, on));
 
        usbd_interface2device_handle(sc->sc_hdev.sc_parent->sc_iface, &dev);
        if (on) {
@@ -1044,9 +1043,9 @@
                    HID_GET_USAGE_PAGE(h.usage) != HUP_KEYBOARD ||
                    h.report_ID != sc->sc_hdev.sc_report_id)
                        continue;
-               DPRINTF(("ukbd: ikey=%d usage=0x%x flags=0x%x pos=%d size=%d "
-                        "cnt=%d\n", ikey,
-                        h.usage, h.flags, h.loc.pos, h.loc.size, h.loc.count));
+               DPRINTF(("%s: ikey=%d usage=0x%x flags=0x%x pos=%d size=%d "
+                   "cnt=%d\n", __func__, ikey, h.usage, h.flags, h.loc.pos,
+                   h.loc.size, h.loc.count));
                if (h.flags & HIO_VARIABLE) {
                        if (h.loc.size != 1) {
                                hid_end_parse(d);



Home | Main Index | Thread Index | Old Index