kprintf to device_printf conversion.
authorMichael Neumann <mneumann@dragonflybsd.org>
Wed, 21 May 2008 19:56:46 +0000 (19:56 +0000)
committerMichael Neumann <mneumann@dragonflybsd.org>
Wed, 21 May 2008 19:56:46 +0000 (19:56 +0000)
sys/bus/usb/ehci.c
sys/bus/usb/ehci_pci.c
sys/bus/usb/ohci.c
sys/bus/usb/uhci.c
sys/bus/usb/uhub.c
sys/bus/usb/usb.c

index b390d78..047f0a8 100644 (file)
@@ -1,6 +1,6 @@
 /*     $NetBSD: ehci.c,v 1.91 2005/02/27 00:27:51 perry Exp $ */
 /*     $FreeBSD: src/sys/dev/usb/ehci.c,v 1.36.2.3 2006/09/24 13:39:04 iedowse Exp $   */
-/*     $DragonFly: src/sys/bus/usb/ehci.c,v 1.32 2007/06/29 22:56:31 hasso Exp $       */
+/*     $DragonFly: src/sys/bus/usb/ehci.c,v 1.33 2008/05/21 19:56:46 mneumann Exp $    */
 
 /*
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -325,23 +325,24 @@ ehci_init(ehci_softc_t *sc)
        sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
 
        vers = EREAD2(sc, EHCI_HCIVERSION);
-       kprintf("%s: EHCI version %x.%x\n", device_get_nameunit(sc->sc_bus.bdev),
-              vers >> 8, vers & 0xff);
+       device_printf(sc->sc_bus.bdev,
+           "EHCI version %x.%x\n", vers >> 8, vers & 0xff);
 
        sparams = EREAD4(sc, EHCI_HCSPARAMS);
        DPRINTF(("ehci_init: sparams=0x%x\n", sparams));
        sc->sc_npcomp = EHCI_HCS_N_PCC(sparams);
        ncomp = EHCI_HCS_N_CC(sparams);
        if (ncomp != sc->sc_ncomp) {
-               kprintf("%s: wrong number of companions (%d != %d)\n",
-                      device_get_nameunit(sc->sc_bus.bdev),
-                      ncomp, sc->sc_ncomp);
+               device_printf(sc->sc_bus.bdev,
+                   "wrong number of companions (%d != %d)\n",
+                   ncomp, sc->sc_ncomp);
                if (ncomp < sc->sc_ncomp)
                        sc->sc_ncomp = ncomp;
        }
        if (sc->sc_ncomp > 0) {
-               kprintf("%s: companion controller%s, %d port%s each:",
-                   device_get_nameunit(sc->sc_bus.bdev), sc->sc_ncomp!=1 ? "s" : "",
+               device_printf(sc->sc_bus.bdev,
+                   "companion controller%s, %d port%s each:",
+                   sc->sc_ncomp!=1 ? "s" : "",
                    EHCI_HCS_N_PCC(sparams),
                    EHCI_HCS_N_PCC(sparams)!=1 ? "s" : "");
                for (i = 0; i < sc->sc_ncomp; i++)
@@ -371,8 +372,7 @@ ehci_init(ehci_softc_t *sc)
                        break;
        }
        if (hcr) {
-               kprintf("%s: reset timeout\n",
-                   device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "reset timeout\n");
                return (USBD_IOERROR);
        }
 
@@ -495,7 +495,7 @@ ehci_init(ehci_softc_t *sc)
                        break;
        }
        if (hcr) {
-               kprintf("%s: run timeout\n", device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "run timeout\n");
                return (USBD_IOERROR);
        }
 
@@ -567,8 +567,8 @@ ehci_intr1(ehci_softc_t *sc)
                eintrs &= ~(EHCI_STS_INT | EHCI_STS_ERRINT);
        }
        if (eintrs & EHCI_STS_HSE) {
-               kprintf("%s: unrecoverable error, controller halted\n",
-                      device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev,
+                   "unrecoverable error, controller halted\n");
                /* XXX what else */
        }
        if (eintrs & EHCI_STS_PCD) {
@@ -589,8 +589,8 @@ ehci_intr1(ehci_softc_t *sc)
                /* Block unprocessed interrupts. */
                sc->sc_eintrs &= ~eintrs;
                EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
-               kprintf("%s: blocking intrs 0x%x\n",
-                      device_get_nameunit(sc->sc_bus.bdev), eintrs);
+               device_printf(sc->sc_bus.bdev,
+                   "blocking intrs 0x%x\n", eintrs);
        }
 
        return (1);
@@ -951,8 +951,7 @@ ehci_power(int why, void *v)
                        usb_delay_ms(&sc->sc_bus, 1);
                }
                if (hcr != 0) {
-                       kprintf("%s: reset timeout\n",
-                           device_get_nameunit(sc->sc_bus.bdev));
+                       device_printf(sc->sc_bus.bdev, "reset timeout\n");
                }
 
                cmd &= ~EHCI_CMD_RS;
@@ -966,8 +965,7 @@ ehci_power(int why, void *v)
                        usb_delay_ms(&sc->sc_bus, 1);
                }
                if (hcr != EHCI_STS_HCH) {
-                       kprintf("%s: config timeout\n",
-                           device_get_nameunit(sc->sc_bus.bdev));
+                       device_printf(sc->sc_bus.bdev, "config timeout\n");
                }
 
                sc->sc_bus.use_polling--;
@@ -1016,8 +1014,7 @@ ehci_power(int why, void *v)
                        usb_delay_ms(&sc->sc_bus, 1);
                }
                if (hcr == EHCI_STS_HCH) {
-                       kprintf("%s: config timeout\n",
-                           device_get_nameunit(sc->sc_bus.bdev));
+                       device_printf(sc->sc_bus.bdev, "config timeout\n");
                }
 
                usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT);
@@ -1320,9 +1317,9 @@ ehci_open(usbd_pipe_handle pipe)
        default: panic("ehci_open: bad device speed %d", dev->speed);
        }
        if (speed != EHCI_QH_SPEED_HIGH && xfertype == UE_ISOCHRONOUS) {
-               kprintf("%s: *** WARNING: opening low/full speed device, this "
-                      "does not work yet.\n",
-                      device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev,
+                   "*** WARNING: opening low/full speed device, this "
+                   "does not work yet.\n");
                DPRINTFN(1,("ehci_open: hshubaddr=%d hshubport=%d\n",
                            hshubaddr, hshubport));
                return USBD_INVAL;
@@ -1943,8 +1940,8 @@ ehci_root_ctrl_start(usbd_xfer_handle xfer)
                        v = EOREAD4(sc, port);
                        DPRINTF(("ehci after reset, status=0x%08x\n", v));
                        if (v & EHCI_PS_PR) {
-                               kprintf("%s: port reset timeout\n",
-                                      device_get_nameunit(sc->sc_bus.bdev));
+                               device_printf(sc->sc_bus.bdev,
+                                   "port reset timeout\n");
                                return (USBD_TIMEOUT);
                        }
                        if (!(v & EHCI_PS_PE)) {
@@ -2005,16 +2002,14 @@ ehci_disown(ehci_softc_t *sc, int index, int lowspeed)
        if (sc->sc_npcomp != 0) {
                int i = (index-1) / sc->sc_npcomp;
                if (i >= sc->sc_ncomp)
-                       kprintf("%s: strange port\n",
-                              device_get_nameunit(sc->sc_bus.bdev));
+                       device_printf(sc->sc_bus.bdev, "strange port\n");
                else
-                       kprintf("%s: handing over %s speed device on "
-                              "port %d to %s\n",
-                              device_get_nameunit(sc->sc_bus.bdev),
-                              lowspeed ? "low" : "full",
-                              index, device_get_nameunit(sc->sc_comps[i]->bdev));
+                       device_printf(sc->sc_bus.bdev,
+                           "handing over %s speed device on port %d to %s\n",
+                           lowspeed ? "low" : "full",
+                           index, device_get_nameunit(sc->sc_comps[i]->bdev));
        } else {
-               kprintf("%s: npcomp == 0\n", device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "npcomp == 0\n");
        }
 #endif
        port = EHCI_PORTSC(index);
index 7da5526..2fd6aa1 100644 (file)
@@ -35,7 +35,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/usb/ehci_pci.c,v 1.18.2.1 2006/01/26 01:43:13 iedowse Exp $
- * $DragonFly: src/sys/bus/usb/ehci_pci.c,v 1.18 2007/08/14 20:06:13 dillon Exp $
+ * $DragonFly: src/sys/bus/usb/ehci_pci.c,v 1.19 2008/05/21 19:56:46 mneumann Exp $
  */
 
 /*
@@ -502,8 +502,8 @@ ehci_pci_takecontroller(device_t self)
                legsup = eec;
                pci_write_config(self, eecp, legsup | EHCI_LEGSUP_OSOWNED, 4);
                if (legsup & EHCI_LEGSUP_BIOSOWNED) {
-                       kprintf("%s: waiting for BIOS to give up control\n",
-                           device_get_nameunit(sc->sc_bus.bdev));
+                       device_printf(sc->sc_bus.bdev,
+                           "waiting for BIOS to give up control\n");
                        for (i = 0; i < 5000; i++) {
                                legsup = pci_read_config(self, eecp, 4);
                                if ((legsup & EHCI_LEGSUP_BIOSOWNED) == 0)
@@ -511,8 +511,8 @@ ehci_pci_takecontroller(device_t self)
                                DELAY(1000);
                        }
                        if (legsup & EHCI_LEGSUP_BIOSOWNED)
-                               kprintf("%s: timed out waiting for BIOS\n",
-                                   device_get_nameunit(sc->sc_bus.bdev));
+                               device_printf(sc->sc_bus.bdev,
+                                   "timed out waiting for BIOS\n");
                }
        }
 }
index d3f91b5..5f82caa 100644 (file)
@@ -1,6 +1,6 @@
 /*     $NetBSD: ohci.c,v 1.138 2003/02/08 03:32:50 ichiro Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.154.2.4 2006/06/26 00:31:25 iedowse Exp $  */
-/*     $DragonFly: src/sys/bus/usb/ohci.c,v 1.25 2008/04/20 13:44:25 swildner Exp $    */
+/*     $DragonFly: src/sys/bus/usb/ohci.c,v 1.26 2008/05/21 19:56:46 mneumann Exp $    */
 
 /* Also, already ported:
  *     $NetBSD: ohci.c,v 1.140 2003/05/13 04:42:00 gson Exp $
@@ -640,14 +640,13 @@ ohci_init(ohci_softc_t *sc)
        u_int32_t rev;
 
        DPRINTF(("ohci_init: start\n"));
-       kprintf("%s:", device_get_nameunit(sc->sc_bus.bdev));
+       device_printf(sc->sc_bus.bdev, "");
        rev = OREAD4(sc, OHCI_REVISION);
-       kprintf(" OHCI version %d.%d%s\n", OHCI_REV_HI(rev), OHCI_REV_LO(rev),
+       kprintf("OHCI version %d.%d%s\n", OHCI_REV_HI(rev), OHCI_REV_LO(rev),
               OHCI_REV_LEGACY(rev) ? ", legacy support" : "");
 
        if (OHCI_REV_HI(rev) != 1 || OHCI_REV_LO(rev) != 0) {
-               kprintf("%s: unsupported OHCI revision\n",
-                      device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "unsupported OHCI revision\n");
                sc->sc_bus.usbrev = USBREV_UNKNOWN;
                return (USBD_INVAL);
        }
@@ -777,8 +776,8 @@ ohci_controller_init(ohci_softc_t *sc)
                        ctl = OREAD4(sc, OHCI_CONTROL);
                }
                if ((ctl & OHCI_IR) == 0) {
-                       kprintf("%s: SMM does not respond, resetting\n",
-                              device_get_nameunit(sc->sc_bus.bdev));
+                       device_printf(sc->sc_bus.bdev,
+                           "SMM does not respond, resetting\n");
                        OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
                        goto reset;
                }
@@ -819,7 +818,7 @@ ohci_controller_init(ohci_softc_t *sc)
                        break;
        }
        if (hcr) {
-               kprintf("%s: reset timeout\n", device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "reset timeout\n");
                return (USBD_IOERROR);
        }
 #ifdef USB_DEBUG
@@ -1139,8 +1138,8 @@ ohci_intr1(ohci_softc_t *sc)
        if (eintrs & OHCI_SO) {
                sc->sc_overrun_cnt++;
                if (usbd_ratecheck(&sc->sc_overrun_ntc)) {
-                       kprintf("%s: %u scheduling overruns\n",
-                           device_get_nameunit(sc->sc_bus.bdev), sc->sc_overrun_cnt);
+                       device_printf(sc->sc_bus.bdev,
+                           "%u scheduling overruns\n", sc->sc_overrun_cnt);
                        sc->sc_overrun_cnt = 0;
                }
                /* XXX do what */
@@ -1152,12 +1151,12 @@ ohci_intr1(ohci_softc_t *sc)
                eintrs &= ~OHCI_WDH;
        }
        if (eintrs & OHCI_RD) {
-               kprintf("%s: resume detect\n", device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "resume detect\n");
                /* XXX process resume detect */
        }
        if (eintrs & OHCI_UE) {
-               kprintf("%s: unrecoverable error, controller halted\n",
-                      device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev,
+                   "unrecoverable error, controller halted\n");
                OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
                /* XXX what else */
        }
@@ -1179,8 +1178,8 @@ ohci_intr1(ohci_softc_t *sc)
                /* Block unprocessed interrupts. XXX */
                OWRITE4(sc, OHCI_INTERRUPT_DISABLE, eintrs);
                sc->sc_eintrs &= ~eintrs;
-               kprintf("%s: blocking intrs 0x%x\n",
-                      device_get_nameunit(sc->sc_bus.bdev), eintrs);
+               device_printf(sc->sc_bus.bdev,
+                   "blocking intrs 0x%x\n", eintrs);
        }
 
        return (1);
@@ -3297,8 +3296,8 @@ ohci_device_isoc_enter(usbd_xfer_handle xfer)
                        nsitd = ohci_alloc_sitd(sc);
                        if (nsitd == NULL) {
                                /* XXX what now? */
-                               kprintf("%s: isoc TD alloc failed\n",
-                                      device_get_nameunit(sc->sc_bus.bdev));
+                               device_printf(sc->sc_bus.bdev,
+                                   "isoc TD alloc failed\n");
                                return;
                        }
 
@@ -3326,8 +3325,7 @@ ohci_device_isoc_enter(usbd_xfer_handle xfer)
        nsitd = ohci_alloc_sitd(sc);
        if (nsitd == NULL) {
                /* XXX what now? */
-               kprintf("%s: isoc TD alloc failed\n",
-                      device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "isoc TD alloc failed\n");
                return;
        }
        /* Fixup last used ITD */
index f272870..27ac7f2 100644 (file)
@@ -1,6 +1,6 @@
 /*     $NetBSD: uhci.c,v 1.170 2003/02/19 01:35:04 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.162.2.1 2006/03/01 01:59:04 iedowse Exp $  */
-/*     $DragonFly: src/sys/bus/usb/uhci.c,v 1.25 2007/06/29 22:56:31 hasso Exp $       */
+/*     $DragonFly: src/sys/bus/usb/uhci.c,v 1.26 2008/05/21 19:56:46 mneumann Exp $    */
 
 /*     Also already incorporated from NetBSD:
  *     $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $
@@ -1133,8 +1133,8 @@ uhci_intr1(uhci_softc_t *sc)
                return (0);
 
        if (sc->sc_suspend != PWR_RESUME) {
-               kprintf("%s: interrupt while not operating ignored\n",
-                      device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev,
+                   "interrupt while not operating ignored\n");
                UWRITE2(sc, UHCI_STS, status); /* acknowledge the ints */
                return (0);
        }
@@ -1147,23 +1147,23 @@ uhci_intr1(uhci_softc_t *sc)
        if (status & UHCI_STS_RD) {
                ack |= UHCI_STS_RD;
 #ifdef USB_DEBUG
-               kprintf("%s: resume detect\n", device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "resume detect\n");
 #endif
        }
        if (status & UHCI_STS_HSE) {
                ack |= UHCI_STS_HSE;
-               kprintf("%s: host system error\n", device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "host system error\n");
        }
        if (status & UHCI_STS_HCPE) {
                ack |= UHCI_STS_HCPE;
-               kprintf("%s: host controller process error\n",
-                      device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev,
+                   "host controller process error\n");
        }
        if (status & UHCI_STS_HCH) {
                /* no acknowledge needed */
                if (!sc->sc_dying) {
-                       kprintf("%s: host controller halted\n",
-                           device_get_nameunit(sc->sc_bus.bdev));
+                       device_printf(sc->sc_bus.bdev,
+                           "host controller halted\n");
 #ifdef USB_DEBUG
                        uhci_dump_all(sc);
 #endif
@@ -1498,8 +1498,7 @@ uhci_reset(uhci_softc_t *sc)
                    (UREAD2(sc, UHCI_CMD) & UHCI_CMD_HCRESET); n++)
                usb_delay_ms(&sc->sc_bus, 1);
        if (n >= UHCI_RESET_TIMEOUT)
-               kprintf("%s: controller did not reset\n",
-                      device_get_nameunit(sc->sc_bus.bdev));
+               device_printf(sc->sc_bus.bdev, "controller did not reset\n");
 }
 
 usbd_status
@@ -1529,8 +1528,7 @@ uhci_run(uhci_softc_t *sc, int run)
                usb_delay_ms(&sc->sc_bus, 1);
        }
        crit_exit();
-       kprintf("%s: cannot %s\n", device_get_nameunit(sc->sc_bus.bdev),
-              run ? "start" : "stop");
+       device_printf(sc->sc_bus.bdev, "cannot %s\n", run ? "start" : "stop");
        return (USBD_IOERROR);
 }
 
index c96a4df..96a6afa 100644 (file)
@@ -1,6 +1,6 @@
 /*     $NetBSD: uhub.c,v 1.68 2004/06/29 06:30:05 mycroft Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/uhub.c,v 1.69.2.1 2005/12/18 15:51:31 iedowse Exp $   */
-/*     $DragonFly: src/sys/bus/usb/uhub.c,v 1.20 2008/01/25 08:49:47 hasso Exp $       */
+/*     $DragonFly: src/sys/bus/usb/uhub.c,v 1.21 2008/05/21 19:56:46 mneumann Exp $    */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -184,8 +184,8 @@ uhub_attach(device_t self)
        sc->sc_dev = self;
 
        if (dev->depth > 0 && UHUB_IS_HIGH_SPEED(sc)) {
-               kprintf("%s: %s transaction translator%s\n",
-                   device_get_nameunit(sc->sc_dev),
+               device_printf(sc->sc_dev,
+                   "%s transaction translator%s\n",
                    UHUB_IS_SINGLE_TT(sc) ? "single" : "multiple",
                    UHUB_IS_SINGLE_TT(sc) ? "" : "s");
        }
@@ -197,8 +197,9 @@ uhub_attach(device_t self)
        }
 
        if (dev->depth > USB_HUB_MAX_DEPTH) {
-               kprintf("%s: hub depth (%d) exceeded, hub ignored\n",
-                      device_get_nameunit(sc->sc_dev), USB_HUB_MAX_DEPTH);
+               device_printf(sc->sc_dev,
+                   "hub depth (%d) exceeded, hub ignored\n",
+                   USB_HUB_MAX_DEPTH);
                return ENXIO;
        }
 
@@ -224,12 +225,13 @@ uhub_attach(device_t self)
        for (nremov = 0, port = 1; port <= nports; port++)
                if (!UHD_NOT_REMOV(&hubdesc, port))
                        nremov++;
-       kprintf("%s: %d port%s with %d removable, %s powered\n",
-              device_get_nameunit(sc->sc_dev), nports, nports != 1 ? "s" : "",
-              nremov, dev->self_powered ? "self" : "bus");
+       device_printf(sc->sc_dev,
+           "%d port%s with %d removable, %s powered\n",
+           nports, nports != 1 ? "s" : "",
+           nremov, dev->self_powered ? "self" : "bus");
 
        if (nports == 0) {
-               kprintf("%s: no ports, hub ignored\n", device_get_nameunit(sc->sc_dev));
+               device_printf(sc->sc_dev, "no ports, hub ignored\n");
                goto bad;
        }
 
@@ -248,24 +250,25 @@ uhub_attach(device_t self)
 
        if (!dev->self_powered && dev->powersrc->parent != NULL &&
            !dev->powersrc->parent->self_powered) {
-               kprintf("%s: bus powered hub connected to bus powered hub, "
-                      "ignored\n", device_get_nameunit(sc->sc_dev));
+               device_printf(sc->sc_dev,
+                   "bus powered hub connected to bus powered hub, "
+                   "ignored\n");
                goto bad;
        }
 
        /* Set up interrupt pipe. */
        err = usbd_device2interface_handle(dev, 0, &iface);
        if (err) {
-               kprintf("%s: no interface handle\n", device_get_nameunit(sc->sc_dev));
+               device_printf(sc->sc_dev, "no interface handle\n");
                goto bad;
        }
        ed = usbd_interface2endpoint_descriptor(iface, 0);
        if (ed == NULL) {
-               kprintf("%s: no endpoint descriptor\n", device_get_nameunit(sc->sc_dev));
+               device_printf(sc->sc_dev, "no endpoint descriptor\n");
                goto bad;
        }
        if ((ed->bmAttributes & UE_XFERTYPE) != UE_INTERRUPT) {
-               kprintf("%s: bad interrupt endpoint\n", device_get_nameunit(sc->sc_dev));
+               device_printf(sc->sc_dev, "bad interrupt endpoint\n");
                goto bad;
        }
 
@@ -273,8 +276,7 @@ uhub_attach(device_t self)
                  USBD_SHORT_XFER_OK, &sc->sc_ipipe, sc, sc->sc_status,
                  sizeof(sc->sc_status), uhub_intr, UHUB_INTR_INTERVAL);
        if (err) {
-               kprintf("%s: cannot open interrupt pipe\n",
-                      device_get_nameunit(sc->sc_dev));
+               device_printf(sc->sc_dev, "cannot open interrupt pipe\n");
                goto bad;
        }
 
@@ -341,9 +343,9 @@ uhub_attach(device_t self)
                /* Turn the power on. */
                err = usbd_set_port_feature(dev, port, UHF_PORT_POWER);
                if (err)
-                       kprintf("%s: port %d power on failed, %s\n",
-                              device_get_nameunit(sc->sc_dev), port,
-                              usbd_errstr(err));
+                       device_printf(sc->sc_dev,
+                           "port %d power on failed, %s\n",
+                           port, usbd_errstr(err));
                DPRINTF(("usb_init_port: turn on port %d power\n", port));
        }
 
@@ -403,21 +405,21 @@ uhub_explore(usbd_device_handle dev)
                                /* Ignore the port error if the device
                                   vanished. */
                        } else if (status & UPS_PORT_ENABLED) {
-                               kprintf("%s: illegal enable change, port %d\n",
-                                      device_get_nameunit(sc->sc_dev), port);
+                               device_printf(sc->sc_dev,
+                                   "illegal enable change, port %d\n", port);
                        } else {
                                /* Port error condition. */
                                if (up->restartcnt) /* no message first time */
-                                       kprintf("%s: port error, restarting "
-                                              "port %d\n",
-                                              device_get_nameunit(sc->sc_dev), port);
+                                       device_printf(sc->sc_dev,
+                                           "port error, restarting "
+                                           "port %d\n", port);
 
                                if (up->restartcnt++ < USBD_RESTART_MAX)
                                        goto disco;
                                else
-                                       kprintf("%s: port error, giving up "
-                                              "port %d\n",
-                                         device_get_nameunit(sc->sc_dev), port);
+                                       device_printf(sc->sc_dev,
+                                           "port error, giving up "
+                                           "port %d\n", port);
                        }
                }
                if (!(change & UPS_C_CONNECT_STATUS)) {
@@ -429,8 +431,8 @@ uhub_explore(usbd_device_handle dev)
 #if 0 && defined(DIAGNOSTIC)
                        if (up->device == NULL &&
                            (status & UPS_CURRENT_CONNECT_STATUS))
-                               kprintf("%s: connected, no device\n",
-                                      device_get_nameunit(sc->sc_dev));
+                               device_printf(sc->sc_dev,
+                                   "connected, no device\n");
 #endif
                        continue;
                }
@@ -467,16 +469,17 @@ uhub_explore(usbd_device_handle dev)
                /* Connected */
 
                if (!(status & UPS_PORT_POWER))
-                       kprintf("%s: strange, connected port %d has no power\n",
-                              device_get_nameunit(sc->sc_dev), port);
+                       device_printf(sc->sc_dev,
+                           "strange, connected port %d has no power\n",
+                           port);
 
                /* Wait for maximum device power up time. */
                usbd_delay_ms(dev, USB_PORT_POWERUP_DELAY);
 
                /* Reset port, which implies enabling it. */
                if (usbd_reset_port(dev, port, &up->status)) {
-                       kprintf("%s: port %d reset failed\n",
-                              device_get_nameunit(sc->sc_dev), port);
+                       device_printf(sc->sc_dev,
+                           "port %d reset failed\n", port);
                        continue;
                }
                /* Get port status again, it might have changed during reset */
@@ -491,17 +494,19 @@ uhub_explore(usbd_device_handle dev)
                if (!(status & UPS_CURRENT_CONNECT_STATUS)) {
                        /* Nothing connected, just ignore it. */
 #ifdef DIAGNOSTIC
-                       kprintf("%s: port %d, device disappeared after reset\n",
-                              device_get_nameunit(sc->sc_dev), port);
+                       device_printf(sc->sc_dev,
+                           "port %d, device disappeared after reset\n",
+                           port);
 #endif
                        continue;
                }
 
 #if 0
                if (UHUB_IS_HIGH_SPEED(sc) && !(status & UPS_HIGH_SPEED)) {
-                       kprintf("%s: port %d, transaction translation not "
+                       device_printf(sc->sc_dev,
+                           "port %d, transaction translation not "
                            "implemented, low/full speed device ignored\n",
-                           device_get_nameunit(sc->sc_dev), port);
+                           port);
                        continue;
                }
 #endif
@@ -528,8 +533,9 @@ uhub_explore(usbd_device_handle dev)
                         * some other serious problem.  Since we cannot leave
                         * at 0 we have to disable the port instead.
                         */
-                       kprintf("%s: device problem (%s), disabling port %d\n",
-                              device_get_nameunit(sc->sc_dev), usbd_errstr(err), port);
+                       device_printf(sc->sc_dev, 
+                           "device problem (%s), disabling port %d\n",
+                           usbd_errstr(err), port);
                        usbd_clear_port_feature(dev, port, UHF_PORT_ENABLE);
                } else {
                        /* The port set up succeeded, reset error count. */
@@ -704,8 +710,7 @@ uhub_child_detached(device_t self, device_t child)
 
 found_dev:
 #if 0
-       kprintf("%s: at %s", device_get_nameunit(dev->subdevs[i]),
-              device_get_nameunit(self));
+       device_printf(dev->subdevs[i], "at %s", device_get_nameunit(self));
        if (port != 0)
                kprintf(" port %d", port);
        kprintf(" (addr %d) disconnected\n", dev->address);
index 13b7c5c..b49ce76 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $NetBSD: usb.c,v 1.68 2002/02/20 20:30:12 christos Exp $
  * $FreeBSD: src/sys/dev/usb/usb.c,v 1.106 2005/03/27 15:31:23 iedowse Exp $
- * $DragonFly: src/sys/bus/usb/usb.c,v 1.41 2008/04/26 23:09:40 sephe Exp $
+ * $DragonFly: src/sys/bus/usb/usb.c,v 1.42 2008/05/21 19:56:46 mneumann Exp $
  */
 
 /* Also already merged from NetBSD:
@@ -228,9 +228,9 @@ usb_attach(device_t self)
        sc->sc_bus->usbctl = sc;
        sc->sc_port.power = USB_MAX_POWER;
 
-       kprintf("%s", device_get_nameunit(sc->sc_dev));
+       device_printf(sc->sc_dev, "");
        usbrev = sc->sc_bus->usbrev;
-       kprintf("USB revision %s", usbrev_str[usbrev]);
+       kprintf("USB revision %s", usbrev_str[usbrev]);
        switch (usbrev) {
        case USBREV_1_0:
        case USBREV_1_1:
@@ -261,7 +261,7 @@ usb_attach(device_t self)
        sc->sc_bus->soft = softintr_establish(IPL_SOFTNET,
            sc->sc_bus->methods->soft_intr, sc->sc_bus);
        if (sc->sc_bus->soft == NULL) {
-               kprintf("%s: can't register softintr\n", device_get_nameunit(sc->sc_dev));
+               device_printf(sc->sc_dev, "can't register softintr\n");
                sc->sc_dying = 1;
                return ENXIO;
        }
@@ -276,8 +276,8 @@ usb_attach(device_t self)
                dev = sc->sc_port.device;
                if (dev->hub == NULL) {
                        sc->sc_dying = 1;
-                       kprintf("%s: root device is not a hub\n",
-                              device_get_nameunit(sc->sc_dev));
+                       device_printf(sc->sc_dev,
+                           "root device is not a hub\n");
                        return ENXIO;
                }
                sc->sc_bus->root_hub = dev;
@@ -297,8 +297,8 @@ usb_attach(device_t self)
                }
 #endif
        } else {
-               kprintf("%s: root hub problem, error=%d\n",
-                      device_get_nameunit(sc->sc_dev), err);
+               device_printf(sc->sc_dev,
+                   "root hub problem, error=%d\n", err);
                sc->sc_dying = 1;
        }
 #if 0
@@ -335,8 +335,8 @@ usb_create_event_thread(void *arg)
 
        if (kthread_create(usb_event_thread, sc, &sc->sc_event_thread,
                           "%s", device_get_nameunit(sc->sc_dev))) {
-               kprintf("%s: unable to create event thread for\n",
-                      device_get_nameunit(sc->sc_dev));
+               device_printf(sc->sc_dev,
+                   "unable to create event thread for\n");
                panic("usb_create_event_thread");
        }
 
@@ -872,8 +872,8 @@ usb_detach(device_t self)
        if (sc->sc_event_thread != NULL) {
                wakeup(&sc->sc_bus->needs_explore);
                if (tsleep(sc, 0, "usbdet", hz * 60))
-                       kprintf("%s: event thread didn't die\n",
-                              device_get_nameunit(sc->sc_dev));
+                       device_printf(sc->sc_dev,
+                           "event thread didn't die\n");
                DPRINTF(("usb_detach: event thread dead\n"));
        }