Use device_printf() where it makes sense.
authorHasso Tepper <hasso@dragonflybsd.org>
Sun, 19 Aug 2007 17:16:43 +0000 (17:16 +0000)
committerHasso Tepper <hasso@dragonflybsd.org>
Sun, 19 Aug 2007 17:16:43 +0000 (17:16 +0000)
sys/dev/usbmisc/uark/uark.c
sys/dev/usbmisc/ubsa/ubsa.c
sys/dev/usbmisc/umct/umct.c
sys/dev/usbmisc/umsm/umsm.c
sys/dev/usbmisc/uplcom/uplcom.c
sys/dev/usbmisc/uslcom/uslcom.c

index 5a89f64..07cf92b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $DragonFly: src/sys/dev/usbmisc/uark/uark.c,v 1.2 2007/08/17 06:40:19 hasso Exp $       */
+/*     $DragonFly: src/sys/dev/usbmisc/uark/uark.c,v 1.3 2007/08/19 17:16:43 hasso Exp $       */
 /*     $OpenBSD: uark.c,v 1.9 2007/06/13 06:25:03 mbalmer Exp $        */
 
 /*
@@ -134,7 +134,6 @@ uark_attach(device_t self)
        usb_endpoint_descriptor_t *ed;
        usbd_status error;
        char *devinfo;
-       const char *devname;
        int i;
 
        devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT);
@@ -149,12 +148,11 @@ uark_attach(device_t self)
        ucom->sc_udev = uaa->device;
        ucom->sc_iface = uaa->iface;
 
-       devname = device_get_nameunit(ucom->sc_dev);
-       kprintf("%s: %s\n", devname, devinfo);
+       device_printf(ucom->sc_dev, "%s\n", devinfo);
        kfree(devinfo, M_USBDEV);
 
        if (usbd_set_config_index(ucom->sc_udev, UARK_CONFIG_NO, 1) != 0) {
-               kprintf("%s: could not set configuration no\n", devname);
+               device_printf(ucom->sc_dev, "could not set configuration no\n");
                goto error;
        }
 
@@ -162,7 +160,7 @@ uark_attach(device_t self)
        error = usbd_device2interface_handle(ucom->sc_udev, UARK_IFACE_NO,
            &ucom->sc_iface);
        if (error != 0) {
-               kprintf("%s: could not get interface handle\n", devname);
+               device_printf(ucom->sc_dev, "could not get interface handle\n");
                goto error;
        }
 
@@ -172,8 +170,8 @@ uark_attach(device_t self)
        for (i = 0; i < id->bNumEndpoints; i++) {
                ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
                if (ed == NULL) {
-                       kprintf("%s: no endpoint descriptor found for %d\n",
-                           devname, i);
+                       device_printf(ucom->sc_dev, "no endpoint descriptor "
+                                     "found for %d\n", i);
                        goto error;
                }
 
@@ -186,7 +184,7 @@ uark_attach(device_t self)
        }
 
        if (ucom->sc_bulkin_no == -1 || ucom->sc_bulkout_no == -1) {
-               kprintf("%s: missing endpoint\n", devname);
+               device_printf(ucom->sc_dev, "missing endpoint\n");
                goto error;
        }
 
@@ -354,8 +352,7 @@ uark_break(void *vsc, int portno, int onoff)
 #ifdef UARK_DEBUG
        struct uark_softc *sc = vsc;
 
-       kprintf("%s: break %s!\n", device_get_nameunit(sc->sc_ucom->sc_dev),
-           onoff ? "on" : "off");
+       device_printf(sc->sc_ucom.sc_dev, "break %s!\n", onoff ? "on" : "off");
 
        if (onoff)
                /* break on */
index 245852a..b741600 100644 (file)
@@ -60,7 +60,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/usb/ubsa.c,v 1.11 2003/11/16 12:13:39 akiyama Exp $
- * $DragonFly: src/sys/dev/usbmisc/ubsa/ubsa.c,v 1.15 2007/08/16 07:03:30 hasso Exp $
+ * $DragonFly: src/sys/dev/usbmisc/ubsa/ubsa.c,v 1.16 2007/08/19 17:16:43 hasso Exp $
  */
 
 #include <sys/param.h>
@@ -276,7 +276,6 @@ ubsa_attach(device_t self)
        usb_interface_descriptor_t *id;
        usb_endpoint_descriptor_t *ed;
        char *devinfo;
-       const char *devname;
        usbd_status err;
        int i;
 
@@ -300,8 +299,7 @@ ubsa_attach(device_t self)
        ucom->sc_udev = dev;
        ucom->sc_iface = uaa->iface;
 
-       devname = device_get_nameunit(ucom->sc_dev);
-       kprintf("%s: %s\n", devname, devinfo);
+       device_printf(ucom->sc_dev, "%s\n", devinfo);
 
        DPRINTF(("ubsa attach: sc = %p\n", sc));
 
@@ -313,8 +311,8 @@ ubsa_attach(device_t self)
        /* Move the device into the configured state. */
        err = usbd_set_config_index(dev, UBSA_CONFIG_INDEX, 1);
        if (err) {
-               kprintf("%s: failed to set configuration: %s\n",
-                   devname, usbd_errstr(err));
+               device_printf(ucom->sc_dev, "failed to set configuration: %s\n",
+                             usbd_errstr(err));
                ucom->sc_dying = 1;
                goto error;
        }
@@ -323,8 +321,8 @@ ubsa_attach(device_t self)
        cdesc = usbd_get_config_descriptor(ucom->sc_udev);
 
        if (cdesc == NULL) {
-               kprintf("%s: failed to get configuration descriptor\n",
-                   device_get_nameunit(ucom->sc_dev));
+               device_printf(ucom->sc_dev, "failed to get configuration "
+                             "descriptor\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -333,8 +331,8 @@ ubsa_attach(device_t self)
        err = usbd_device2interface_handle(dev, UBSA_IFACE_INDEX,
            &ucom->sc_iface);
        if (err) {
-               kprintf("%s: failed to get interface: %s\n",
-                       devname, usbd_errstr(err));
+               device_printf(ucom->sc_dev, "failed to get interface: %s\n",
+                             usbd_errstr(err));
                ucom->sc_dying = 1;
                goto error;
        }
@@ -347,8 +345,8 @@ ubsa_attach(device_t self)
        for (i = 0; i < id->bNumEndpoints; i++) {
                ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
                if (ed == NULL) {
-                       kprintf("%s: no endpoint descriptor for %d\n",
-                           device_get_nameunit(ucom->sc_dev), i);
+                       device_printf(ucom->sc_dev, "no endpoint descriptor "
+                                     "for %d\n", i);
                        ucom->sc_dying = 1;
                        goto error;
                }
@@ -369,8 +367,7 @@ ubsa_attach(device_t self)
        }
 
        if (sc->sc_intr_number == -1) {
-               kprintf("%s: Could not find interrupt in\n",
-                   device_get_nameunit(ucom->sc_dev));
+               device_printf(ucom->sc_dev, "could not find interrupt in\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -379,15 +376,13 @@ ubsa_attach(device_t self)
        sc->sc_intr_iface = ucom->sc_iface;
 
        if (ucom->sc_bulkin_no == -1) {
-               kprintf("%s: Could not find data bulk in\n",
-                   device_get_nameunit(ucom->sc_dev));
+               device_printf(ucom->sc_dev, "could not find data bulk in\n");
                ucom->sc_dying = 1;
                goto error;
        }
 
        if (ucom->sc_bulkout_no == -1) {
-               kprintf("%s: Could not find data bulk out\n",
-                   device_get_nameunit(ucom->sc_dev));
+               device_printf(ucom->sc_dev, "could not find data bulk out\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -449,8 +444,8 @@ ubsa_request(struct ubsa_softc *sc, u_int8_t request, u_int16_t value)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, 0);
        if (err)
-               kprintf("%s: ubsa_request: %s\n",
-                   device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "ubsa_request: %s\n",
+                             usbd_errstr(err));
        return (err);
 }
 
@@ -534,9 +529,8 @@ ubsa_baudrate(struct ubsa_softc *sc, speed_t speed)
                value = B230400 / speed;
                break;
        default:
-               kprintf("%s: ubsa_param: unsupported baudrate, "
-                   "forcing default of 9600\n",
-                   device_get_nameunit(sc->sc_ucom.sc_dev));
+               device_printf(sc->sc_ucom.sc_dev, "ubsa_param: unsupported "
+                             "baudrate, forcing default of 9600\n");
                value = B230400 / B9600;
                break;
        };
@@ -577,9 +571,8 @@ ubsa_databits(struct ubsa_softc *sc, tcflag_t cflag)
        case CS7: value = 2; break;
        case CS8: value = 3; break;
        default:
-               kprintf("%s: ubsa_param: unsupported databits requested, "
-                   "forcing default of 8\n",
-                   device_get_nameunit(sc->sc_ucom.sc_dev));
+               device_printf(sc->sc_ucom.sc_dev, "ubsa_param: unsupported "
+                             "databits requested, forcing default of 8\n");
                value = 3;
        }
 
@@ -656,9 +649,9 @@ ubsa_open(void *addr, int portno)
                    ubsa_intr,
                    UBSA_INTR_INTERVAL);
                if (err) {
-                       kprintf("%s: cannot open interrupt pipe (addr %d)\n",
-                           device_get_nameunit(sc->sc_ucom.sc_dev),
-                           sc->sc_intr_number);
+                       device_printf(sc->sc_ucom.sc_dev, "cannot open "
+                                     "interrupt pipe (addr %d)\n",
+                                     sc->sc_intr_number);
                        return (EIO);
                }
        }
@@ -681,14 +674,12 @@ ubsa_close(void *addr, int portno)
        if (sc->sc_intr_pipe != NULL) {
                err = usbd_abort_pipe(sc->sc_intr_pipe);
                if (err)
-                       kprintf("%s: abort interrupt pipe failed: %s\n",
-                           device_get_nameunit(sc->sc_ucom.sc_dev),
-                           usbd_errstr(err));
+                       device_printf(sc->sc_ucom.sc_dev, "abort interrupt "
+                                     "pipe failed: %s\n", usbd_errstr(err));
                err = usbd_close_pipe(sc->sc_intr_pipe);
                if (err)
-                       kprintf("%s: close interrupt pipe failed: %s\n",
-                           device_get_nameunit(sc->sc_ucom.sc_dev),
-                           usbd_errstr(err));
+                       device_printf(sc->sc_ucom.sc_dev, "close interrupt "
+                                     "pipe failed: %s\n", usbd_errstr(err));
                kfree(sc->sc_intr_buf, M_USBDEV);
                sc->sc_intr_pipe = NULL;
        }
index 6dae3ee..5964fb5 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/usb/umct.c,v 1.12 2006/09/07 00:06:42 imp Exp $
- * $DragonFly: src/sys/dev/usbmisc/umct/umct.c,v 1.11 2007/08/18 09:44:46 hasso Exp $
+ * $DragonFly: src/sys/dev/usbmisc/umct/umct.c,v 1.12 2007/08/19 17:16:43 hasso Exp $
  */
 
 /*
@@ -171,7 +171,6 @@ umct_attach(device_t self)
        usb_interface_descriptor_t *id;
        usb_endpoint_descriptor_t *ed;
        char *devinfo;
-       const char *devname;
        usbd_status err;
        int i;
 
@@ -185,8 +184,7 @@ umct_attach(device_t self)
 
        usbd_devinfo(dev, 0, devinfo);
        device_set_desc_copy(self, devinfo);
-       devname = device_get_nameunit(ucom->sc_dev);
-       kprintf("%s: %s\n", devname, devinfo);
+       device_printf(ucom->sc_dev, "%s\n", devinfo);
 
        ucom->sc_bulkout_no = -1;
        ucom->sc_bulkin_no = -1;
@@ -195,15 +193,16 @@ umct_attach(device_t self)
 
        err = usbd_set_config_index(dev, UMCT_CONFIG_INDEX, 1);
        if (err) {
-               kprintf("%s: failed to set configuration: %s\n",
-                   devname, usbd_errstr(err));
+               device_printf(ucom->sc_dev, "failed to set configuration: %s\n",
+                             usbd_errstr(err));
                ucom->sc_dying = 1;
                goto error;
        }
 
        cdesc = usbd_get_config_descriptor(ucom->sc_udev);
        if (cdesc == NULL) {
-               kprintf("%s: failed to get configuration descriptor\n", devname);
+               device_printf(ucom->sc_dev, "failed to get configuration "
+                             "descriptor\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -211,8 +210,8 @@ umct_attach(device_t self)
        err = usbd_device2interface_handle(dev, UMCT_IFACE_INDEX,
            &ucom->sc_iface);
        if (err) {
-               kprintf("%s: failed to get interface: %s\n", devname,
-                   usbd_errstr(err));
+               device_printf(ucom->sc_dev, "failed to get interface: %s\n",
+                             usbd_errstr(err));
                ucom->sc_dying = 1;
                goto error;
        }
@@ -223,8 +222,8 @@ umct_attach(device_t self)
        for (i = 0; i < id->bNumEndpoints; i++) {
                ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
                if (ed == NULL) {
-                       kprintf("%s: no endpoint descriptor for %d\n",
-                           devname, i);
+                       device_printf(ucom->sc_dev, "no endpoint descriptor "
+                                     "for %d\n", i);
                        ucom->sc_dying = 1;
                        goto error;
                }
@@ -254,12 +253,12 @@ umct_attach(device_t self)
                        continue;
                }
 
-               kprintf("%s: warning - unsupported endpoint 0x%x\n", devname,
-                   ed->bEndpointAddress);
+               device_printf(ucom->sc_dev, "warning - unsupported endpoint "
+                             "0x%x\n", ed->bEndpointAddress);
        }
 
        if (sc->sc_intr_number == -1) {
-               kprintf("%s: Could not find interrupt in\n", devname);
+               device_printf(ucom->sc_dev, "could not find interrupt in\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -267,7 +266,7 @@ umct_attach(device_t self)
        sc->sc_intr_iface = ucom->sc_iface;
 
        if (ucom->sc_bulkout_no == -1) {
-               kprintf("%s: Could not find data bulk out\n", devname);
+               device_printf(ucom->sc_dev, "rould not find data bulk out\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -321,8 +320,8 @@ umct_request(struct umct_softc *sc, uint8_t request, int len, uint32_t value)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, oval);
        if (err)
-               kprintf("%s: ubsa_request: %s\n",
-                   device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "ubsa_request: %s\n",
+                             usbd_errstr(err));
        return (err);
 }
 
@@ -484,9 +483,9 @@ umct_open(void *addr, int portno)
                    USBD_SHORT_XFER_OK, &sc->sc_intr_pipe, sc, sc->sc_intr_buf,
                    sc->sc_isize, umct_intr, UMCT_INTR_INTERVAL);
                if (err) {
-                       kprintf("%s: cannot open interrupt pipe (addr %d)\n",
-                           device_get_nameunit(sc->sc_ucom.sc_dev),
-                           sc->sc_intr_number);
+                       device_printf(sc->sc_ucom.sc_dev, "cannot open "
+                                     "interrupt pipe (addr %d)\n",
+                                     sc->sc_intr_number);
                        kfree(sc->sc_intr_buf, M_USBDEV);
                        return (EIO);
                }
@@ -508,12 +507,12 @@ umct_close(void *addr, int portno)
        if (sc->sc_intr_pipe != NULL) {
                err = usbd_abort_pipe(sc->sc_intr_pipe);
                if (err)
-                       kprintf("%s: abort interrupt pipe failed: %s\n",
-                           device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+                       device_printf(sc->sc_ucom.sc_dev, "abort interrupt "
+                                     "pipe failed: %s\n", usbd_errstr(err));
                err = usbd_close_pipe(sc->sc_intr_pipe);
                if (err)
-                       kprintf("%s: close interrupt pipe failed: %s\n",
-                           device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+                       device_printf(sc->sc_ucom.sc_dev, "close interrupt "
+                                     "pipe failed: %s\n", usbd_errstr(err));
                kfree(sc->sc_intr_buf, M_USBDEV);
                sc->sc_intr_pipe = NULL;
        }
index c1ec1f2..dfcfd50 100644 (file)
@@ -1,4 +1,4 @@
-/*     $DragonFly: src/sys/dev/usbmisc/umsm/Attic/umsm.c,v 1.1 2007/08/16 20:38:33 hasso Exp $ */
+/*     $DragonFly: src/sys/dev/usbmisc/umsm/Attic/umsm.c,v 1.2 2007/08/19 17:16:43 hasso Exp $ */
 /*     $OpenBSD: umsm.c,v 1.15 2007/06/14 10:11:16 mbalmer Exp $       */
 
 /*
@@ -151,7 +151,7 @@ umsm_attach(device_t self)
        kfree(devinfo, M_USBDEV);
 
        if (usbd_set_config_index(ucom->sc_udev, UMSM_CONFIG_NO, 1) != 0) {
-               kprintf("%s: could not set configuration no\n", devname);
+               device_printf(ucom->sc_dev, "could not set configuration no\n");
                goto error;
        }
 
@@ -159,7 +159,7 @@ umsm_attach(device_t self)
        error = usbd_device2interface_handle(ucom->sc_udev, UMSM_IFACE_NO,
            &ucom->sc_iface);
        if (error != 0) {
-               kprintf("%s: could not get interface handle\n", devname);
+               device_printf(ucom->sc_dev, "could not get interface handle\n");
                goto error;
        }
 
@@ -169,8 +169,8 @@ umsm_attach(device_t self)
        for (i = 0; i < id->bNumEndpoints; i++) {
                ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
                if (ed == NULL) {
-                       kprintf("%s: no endpoint descriptor found for %d\n",
-                               devname, i);
+                       device_printf(ucom->sc_dev, "no endpoint descriptor "
+                                     "found for %d\n", i);
                        goto error;
                }
 
@@ -182,7 +182,7 @@ umsm_attach(device_t self)
                        ucom->sc_bulkout_no = ed->bEndpointAddress;
        }
        if (ucom->sc_bulkin_no == -1 || ucom->sc_bulkout_no == -1) {
-               kprintf("%s: missing endpoint\n", devname);
+               device_printf(ucom->sc_dev, "missing endpoint\n");
                goto error;
        }
 
index 5462a98..05c03f3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $NetBSD: uplcom.c,v 1.21 2001/11/13 06:24:56 lukem Exp $
  * $FreeBSD: src/sys/dev/usb/uplcom.c,v 1.39 2006/09/07 00:06:42 imp Exp $
- * $DragonFly: src/sys/dev/usbmisc/uplcom/uplcom.c,v 1.21 2007/08/19 10:19:43 hasso Exp $
+ * $DragonFly: src/sys/dev/usbmisc/uplcom/uplcom.c,v 1.22 2007/08/19 17:16:43 hasso Exp $
  */
 
 /*-
@@ -364,7 +364,6 @@ uplcom_attach(device_t self)
        usb_interface_descriptor_t *id;
        usb_endpoint_descriptor_t *ed;
        char *devinfo;
-       const char *devname;
        usbd_status err;
        int i;
 
@@ -380,8 +379,7 @@ uplcom_attach(device_t self)
        ucom->sc_udev = dev;
        ucom->sc_iface = uaa->iface;
 
-       devname = device_get_nameunit(ucom->sc_dev);
-       kprintf("%s: %s\n", devname, devinfo);
+       device_printf(ucom->sc_dev, "%s\n", devinfo);
 
        DPRINTF(("uplcom attach: sc = %p\n", sc));
 
@@ -420,8 +418,8 @@ uplcom_attach(device_t self)
        /* Move the device into the configured state. */
        err = usbd_set_config_index(dev, UPLCOM_CONFIG_INDEX, 1);
        if (err) {
-               kprintf("%s: failed to set configuration: %s\n",
-                       devname, usbd_errstr(err));
+               device_printf(ucom->sc_dev, "failed to set configuration: %s\n",
+                             usbd_errstr(err));
                ucom->sc_dying = 1;
                goto error;
        }
@@ -430,8 +428,8 @@ uplcom_attach(device_t self)
        cdesc = usbd_get_config_descriptor(ucom->sc_udev);
 
        if (cdesc == NULL) {
-               kprintf("%s: failed to get configuration descriptor\n",
-                       device_get_nameunit(ucom->sc_dev));
+               device_printf(ucom->sc_dev, "failed to get configuration "
+                             "descriptor\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -440,8 +438,8 @@ uplcom_attach(device_t self)
        err = usbd_device2interface_handle(dev, UPLCOM_IFACE_INDEX,
                                           &ucom->sc_iface);
        if (err) {
-               kprintf("%s: failed to get interface: %s\n",
-                       devname, usbd_errstr(err));
+               device_printf(ucom->sc_dev, "failed to get interface: %s\n",
+                             usbd_errstr(err));
                ucom->sc_dying = 1;
                goto error;
        }
@@ -454,8 +452,8 @@ uplcom_attach(device_t self)
        for (i = 0; i < id->bNumEndpoints; i++) {
                ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
                if (ed == NULL) {
-                       kprintf("%s: no endpoint descriptor for %d\n",
-                               device_get_nameunit(ucom->sc_dev), i);
+                       device_printf(ucom->sc_dev, "no endpoint descriptor "
+                                     "for %d\n", i);
                        ucom->sc_dying = 1;
                        goto error;
                }
@@ -468,8 +466,7 @@ uplcom_attach(device_t self)
        }
 
        if (sc->sc_intr_number == -1) {
-               kprintf("%s: Could not find interrupt in\n",
-                       device_get_nameunit(ucom->sc_dev));
+               device_printf(ucom->sc_dev, "could not find interrupt in\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -494,8 +491,8 @@ uplcom_attach(device_t self)
                                                   UPLCOM_SECOND_IFACE_INDEX,
                                                   &ucom->sc_iface);
                if (err) {
-                       kprintf("%s: failed to get second interface: %s\n",
-                               devname, usbd_errstr(err));
+                       device_printf(ucom->sc_dev, "failed to get second "
+                                     "interface: %s\n", usbd_errstr(err));
                        ucom->sc_dying = 1;
                        goto error;
                }
@@ -509,8 +506,8 @@ uplcom_attach(device_t self)
        for (i = 0; i < id->bNumEndpoints; i++) {
                ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
                if (ed == NULL) {
-                       kprintf("%s: no endpoint descriptor for %d\n",
-                               device_get_nameunit(ucom->sc_dev), i);
+                       device_printf(ucom->sc_dev, "no endpoint descriptor "
+                                     "for %d\n", i);
                        ucom->sc_dying = 1;
                        goto error;
                }
@@ -525,15 +522,13 @@ uplcom_attach(device_t self)
        }
 
        if (ucom->sc_bulkin_no == -1) {
-               kprintf("%s: Could not find data bulk in\n",
-                       device_get_nameunit(ucom->sc_dev));
+               device_printf(ucom->sc_dev, "could not find data bulk in\n");
                ucom->sc_dying = 1;
                goto error;
        }
 
        if (ucom->sc_bulkout_no == -1) {
-               kprintf("%s: Could not find data bulk out\n",
-                       device_get_nameunit(ucom->sc_dev));
+               device_printf(ucom->sc_dev, "could not find data bulk out\n");
                ucom->sc_dying = 1;
                goto error;
        }
@@ -551,8 +546,8 @@ uplcom_attach(device_t self)
        err = uplcom_reset(sc);
 
        if (err) {
-               kprintf("%s: reset failed: %s\n",
-                      device_get_nameunit(ucom->sc_dev), usbd_errstr(err));
+               device_printf(ucom->sc_dev, "reset failed: %s\n",
+                             usbd_errstr(err));
                ucom->sc_dying = 1;
                goto error;
        }
@@ -607,8 +602,8 @@ uplcom_reset(struct uplcom_softc *sc)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, 0);
        if (err) {
-               kprintf("%s: uplcom_reset: %s\n",
-                      device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "uplcom_reset: %s\n",
+                             usbd_errstr(err));
                return (EIO);
        }
 
@@ -654,9 +649,9 @@ uplcom_pl2303x_init(struct uplcom_softc *sc)
 
                err = usbd_do_request(sc->sc_ucom.sc_udev, &req, 0);
                if (err) {
-                       kprintf("%s: uplcom_pl2303x_init: %d: %s\n",
-                               device_get_nameunit(sc->sc_ucom.sc_dev), i,
-                               usbd_errstr(err));
+                       device_printf(sc->sc_ucom.sc_dev,
+                                     "uplcom_pl2303x_init: %d: %s\n", i,
+                                     usbd_errstr(err));
                        return (EIO);
                }
        }
@@ -681,8 +676,8 @@ uplcom_set_line_state(struct uplcom_softc *sc)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, 0);
        if (err)
-               kprintf("%s: uplcom_set_line_status: %s\n",
-                      device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "uplcom_set_line_status: "
+                             "%s\n", usbd_errstr(err));
 }
 
 static void
@@ -745,8 +740,8 @@ uplcom_break(struct uplcom_softc *sc, int onoff)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, 0);
        if (err)
-               kprintf("%s: uplcom_break: %s\n",
-                      device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "uplcom_break: %s\n",
+                             usbd_errstr(err));
 }
 
 static usbd_status
@@ -768,8 +763,8 @@ uplcom_set_crtscts(struct uplcom_softc *sc)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, 0);
        if (err) {
-               kprintf("%s: uplcom_set_crtscts: %s\n",
-                      device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "uplcom_set_crtscts: %s\n",
+                             usbd_errstr(err));
                return (err);
        }
 
@@ -800,8 +795,8 @@ uplcom_set_line_coding(struct uplcom_softc *sc, usb_cdc_line_state_t *state)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, state);
        if (err) {
-               kprintf("%s: uplcom_set_line_coding: %s\n",
-                      device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "uplcom_set_line_coding: "
+                             "%s\n", usbd_errstr(err));
                return (err);
        }
 
@@ -904,9 +899,9 @@ uplcom_open(void *addr, int portno)
                                          uplcom_intr,
                                          uplcominterval);
                if (err) {
-                       kprintf("%s: cannot open interrupt pipe (addr %d)\n",
-                              device_get_nameunit(sc->sc_ucom.sc_dev),
-                              sc->sc_intr_number);
+                       device_printf(sc->sc_ucom.sc_dev, "cannot open "
+                                     "interrupt pipe (addr %d)\n",
+                                     sc->sc_intr_number);
                        return (EIO);
                }
        }
@@ -931,14 +926,12 @@ uplcom_close(void *addr, int portno)
        if (sc->sc_intr_pipe != NULL) {
                err = usbd_abort_pipe(sc->sc_intr_pipe);
                if (err)
-                       kprintf("%s: abort interrupt pipe failed: %s\n",
-                              device_get_nameunit(sc->sc_ucom.sc_dev),
-                              usbd_errstr(err));
+                       device_printf(sc->sc_ucom.sc_dev, "abort interrupt "
+                                     "pipe failed: %s\n", usbd_errstr(err));
                err = usbd_close_pipe(sc->sc_intr_pipe);
                if (err)
-                       kprintf("%s: close interrupt pipe failed: %s\n",
-                              device_get_nameunit(sc->sc_ucom.sc_dev),
-                              usbd_errstr(err));
+                       device_printf(sc->sc_ucom.sc_dev, "close interrupt "
+                                     "pipe failed: %s\n", usbd_errstr(err));
                kfree(sc->sc_intr_buf, M_USBDEV);
                sc->sc_intr_pipe = NULL;
        }
index a52c545..9424a9b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $DragonFly: src/sys/dev/usbmisc/uslcom/uslcom.c,v 1.4 2007/08/17 06:40:19 hasso Exp $   */
+/*     $DragonFly: src/sys/dev/usbmisc/uslcom/uslcom.c,v 1.5 2007/08/19 17:16:43 hasso Exp $   */
 /*     $OpenBSD: uslcom.c,v 1.12 2007/06/13 06:25:03 mbalmer Exp $     */
 
 /*
@@ -180,7 +180,6 @@ uslcom_attach(device_t self)
        usb_endpoint_descriptor_t *ed;
        usbd_status error;
        char *devinfo;
-       const char *devname;
        int i;
 
        devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT);
@@ -195,12 +194,11 @@ uslcom_attach(device_t self)
        ucom->sc_udev = uaa->device;
        ucom->sc_iface = uaa->iface;
 
-       devname = device_get_nameunit(ucom->sc_dev);
-       kprintf("%s: %s\n", devname, devinfo);
+       device_printf(ucom->sc_dev, "%s\n", devinfo);
        kfree(devinfo, M_USBDEV);
 
        if (usbd_set_config_index(ucom->sc_udev, USLCOM_CONFIG_NO, 1) != 0) {
-               kprintf("%s: could not set configuration no\n", devname);
+               device_printf(ucom->sc_dev, "could not set configuration no\n");
                goto error;
         }
 
@@ -208,7 +206,7 @@ uslcom_attach(device_t self)
        error = usbd_device2interface_handle(ucom->sc_udev, USLCOM_IFACE_NO,
            &ucom->sc_iface);
        if (error != 0) {
-               kprintf("%s: could not get interface handle\n", devname);
+               device_printf(ucom->sc_dev, "could not get interface handle\n");
                goto error;
        }
 
@@ -218,8 +216,8 @@ uslcom_attach(device_t self)
        for (i = 0; i < id->bNumEndpoints; i++) {
                ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
                if (ed == NULL) {
-                       kprintf("%s: no endpoint descriptor found for %d\n",
-                           devname, i);
+                       device_printf(ucom->sc_dev, "no endpoint descriptor "
+                                     "found for %d\n", i);
                        goto error;
                }
 
@@ -232,7 +230,7 @@ uslcom_attach(device_t self)
        }
 
        if (ucom->sc_bulkin_no == -1 || ucom->sc_bulkout_no == -1) {
-               kprintf("%s: missing endpoint\n", devname);
+               device_printf(ucom->sc_dev, "missing endpoint\n");
                goto error;
        }
 
@@ -478,7 +476,8 @@ uslcom_set_flow_ctrl(struct uslcom_softc *sc, tcflag_t cflag, tcflag_t iflag)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, modemdata);
        if (err)
-               kprintf("uslcom_set_flow: %s\n", usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "uslcom_set_flow: %s\n",
+                             usbd_errstr(err));
 
        if (ISSET(cflag, CRTSCTS)) {
                modemdata[0] &= ~0x7b;
@@ -498,6 +497,7 @@ uslcom_set_flow_ctrl(struct uslcom_softc *sc, tcflag_t cflag, tcflag_t iflag)
 
        err = usbd_do_request(sc->sc_ucom.sc_udev, &req, modemdata);
        if (err)
-               kprintf("uslcom_set_flow: %s\n", usbd_errstr(err));
+               device_printf(sc->sc_ucom.sc_dev, "uslcom_set_flow: %s\n",
+                             usbd_errstr(err));
 }