diff options
Diffstat (limited to 'sys/dev/usb/ubsa.c')
-rw-r--r-- | sys/dev/usb/ubsa.c | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index 58be7e4..12c5e8c 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -283,7 +283,6 @@ USB_ATTACH(ubsa) usb_config_descriptor_t *cdesc; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - const char *devname; usbd_status err; int i; @@ -298,12 +297,9 @@ USB_ATTACH(ubsa) sc->sc_rts = -1; ucom->sc_dev = self; - ucom->sc_udev = dev; ucom->sc_iface = uaa->iface; - devname = device_get_nameunit(ucom->sc_dev); - DPRINTF(("ubsa attach: sc = %p\n", sc)); /* initialize endpoints */ @@ -314,8 +310,8 @@ USB_ATTACH(ubsa) /* Move the device into the configured state. */ err = usbd_set_config_index(dev, UBSA_CONFIG_INDEX, 1); if (err) { - printf("%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; } @@ -324,8 +320,8 @@ USB_ATTACH(ubsa) cdesc = usbd_get_config_descriptor(ucom->sc_udev); if (cdesc == NULL) { - printf("%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; } @@ -334,8 +330,8 @@ USB_ATTACH(ubsa) err = usbd_device2interface_handle(dev, UBSA_IFACE_INDEX, &ucom->sc_iface); if (err) { - printf("%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; } @@ -348,8 +344,8 @@ USB_ATTACH(ubsa) for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i); if (ed == NULL) { - printf("%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; } @@ -370,8 +366,7 @@ USB_ATTACH(ubsa) } if (sc->sc_intr_number == -1) { - printf("%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; } @@ -380,15 +375,13 @@ USB_ATTACH(ubsa) sc->sc_intr_iface = ucom->sc_iface; if (ucom->sc_bulkin_no == -1) { - printf("%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) { - printf("%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 +442,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) - printf("%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 +527,8 @@ ubsa_baudrate(struct ubsa_softc *sc, speed_t speed) value = B230400 / speed; break; default: - printf("%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 baud, forcing default of 9600\n"); value = B230400 / B9600; break; }; @@ -577,9 +569,9 @@ ubsa_databits(struct ubsa_softc *sc, tcflag_t cflag) case CS7: value = 2; break; case CS8: value = 3; break; default: - printf("%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,8 +648,8 @@ ubsa_open(void *addr, int portno) ubsa_intr, UBSA_INTR_INTERVAL); if (err) { - printf("%s: cannot open interrupt pipe (addr %d)\n", - device_get_nameunit(sc->sc_ucom.sc_dev), + device_printf(sc->sc_ucom.sc_dev, + "cannot open interrupt pipe (addr %d)\n", sc->sc_intr_number); return (EIO); } @@ -681,13 +673,13 @@ ubsa_close(void *addr, int portno) if (sc->sc_intr_pipe != NULL) { err = usbd_abort_pipe(sc->sc_intr_pipe); if (err) - printf("%s: abort interrupt pipe failed: %s\n", - device_get_nameunit(sc->sc_ucom.sc_dev), + 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) - printf("%s: close interrupt pipe failed: %s\n", - device_get_nameunit(sc->sc_ucom.sc_dev), + device_printf(sc->sc_ucom.sc_dev, + "close interrupt pipe failed: %s\n", usbd_errstr(err)); free(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; |