diff options
-rw-r--r-- | sys/dev/usb/if_axe.c | 69 | ||||
-rw-r--r-- | sys/dev/usb/if_axereg.h | 1 |
2 files changed, 32 insertions, 38 deletions
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index f696c37..af9df5a 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -237,7 +237,7 @@ axe_miibus_readreg(device_t dev, int phy, int reg) AXE_UNLOCK(sc); if (err) { - printf("axe%d: read PHY failed\n", sc->axe_unit); + device_printf(sc->axe_dev, "read PHY failed\n"); return(-1); } @@ -264,7 +264,7 @@ axe_miibus_writereg(device_t dev, int phy, int reg, int val) AXE_UNLOCK(sc); if (err) { - printf("axe%d: write PHY failed\n", sc->axe_unit); + device_printf(sc->axe_dev, "write PHY failed\n"); return(-1); } @@ -368,8 +368,7 @@ axe_reset(struct axe_softc *sc) if (usbd_set_config_no(sc->axe_udev, AXE_CONFIG_NO, 1) || usbd_device2interface_handle(sc->axe_udev, AXE_IFACE_IDX, &sc->axe_iface)) { - printf("axe%d: getting interface handle failed\n", - sc->axe_unit); + device_printf(sc->axe_dev, "getting interface handle failed\n"); } /* Wait a little while for the chip to get its brains in order. */ @@ -415,11 +414,9 @@ USB_ATTACH(axe) sc->axe_udev = uaa->device; sc->axe_dev = self; - sc->axe_unit = device_get_unit(self); if (usbd_set_config_no(sc->axe_udev, AXE_CONFIG_NO, 1)) { - printf("axe%d: getting interface handle failed\n", - sc->axe_unit); + device_printf(sc->axe_dev, "getting interface handle failed\n"); USB_ATTACH_ERROR_RETURN; } @@ -427,8 +424,7 @@ USB_ATTACH(axe) if (usbd_device2interface_handle(uaa->device, AXE_IFACE_IDX, &sc->axe_iface)) { - printf("axe%d: getting interface handle failed\n", - sc->axe_unit); + device_printf(sc->axe_dev, "getting interface handle failed\n"); USB_ATTACH_ERROR_RETURN; } @@ -438,8 +434,7 @@ USB_ATTACH(axe) for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(sc->axe_iface, i); if (!ed) { - printf("axe%d: couldn't get ep %d\n", - sc->axe_unit, i); + device_printf(sc->axe_dev, "couldn't get ep %d\n", i); USB_ATTACH_ERROR_RETURN; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -479,7 +474,7 @@ USB_ATTACH(axe) ifp = sc->axe_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - printf("axe%d: can not if_alloc()\n", sc->axe_unit); + device_printf(sc->axe_dev, "can not if_alloc()\n"); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); sx_destroy(&sc->axe_sleeplock); @@ -487,7 +482,7 @@ USB_ATTACH(axe) USB_ATTACH_ERROR_RETURN; } ifp->if_softc = sc; - if_initname(ifp, "axe", sc->axe_unit); + if_initname(ifp, "axe", device_get_unit(sc->axe_dev)); ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_NEEDSGIANT; @@ -504,7 +499,7 @@ USB_ATTACH(axe) if (mii_phy_probe(self, &sc->axe_miibus, axe_ifmedia_upd, axe_ifmedia_sts)) { - printf("axe%d: MII without any PHY!\n", sc->axe_unit); + device_printf(sc->axe_dev, "MII without any PHY!\n"); if_free(ifp); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); @@ -572,8 +567,8 @@ axe_rxstart(struct ifnet *ifp) c->ue_mbuf = usb_ether_newbuf(); if (c->ue_mbuf == NULL) { - printf("%s: no memory for rx list " - "-- packet dropped!\n", device_get_nameunit(sc->axe_dev)); + device_printf(sc->axe_dev, "no memory for rx list " + "-- packet dropped!\n"); ifp->if_ierrors++; AXE_UNLOCK(sc); return; @@ -618,7 +613,7 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; } if (usbd_ratecheck(&sc->axe_rx_notice)) - printf("axe%d: usb error on rx: %s\n", sc->axe_unit, + device_printf(sc->axe_dev, "usb error on rx: %s\n", usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall(sc->axe_ep[AXE_ENDPT_RX]); @@ -677,7 +672,7 @@ axe_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) AXE_UNLOCK(sc); return; } - printf("axe%d: usb error on tx: %s\n", sc->axe_unit, + device_printf(sc->axe_dev, "usb error on tx: %s\n", usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall(sc->axe_ep[AXE_ENDPT_TX]); @@ -873,7 +868,7 @@ axe_init(void *xsc) /* Init TX ring. */ if (usb_ether_tx_list_init(sc, &sc->axe_cdata, sc->axe_udev) == ENOBUFS) { - printf("axe%d: tx list init failed\n", sc->axe_unit); + device_printf(sc->axe_dev, "tx list init failed\n"); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); return; @@ -882,7 +877,7 @@ axe_init(void *xsc) /* Init RX ring. */ if (usb_ether_rx_list_init(sc, &sc->axe_cdata, sc->axe_udev) == ENOBUFS) { - printf("axe%d: rx list init failed\n", sc->axe_unit); + device_printf(sc->axe_dev, "rx list init failed\n"); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); return; @@ -912,8 +907,8 @@ axe_init(void *xsc) err = usbd_open_pipe(sc->axe_iface, sc->axe_ed[AXE_ENDPT_RX], USBD_EXCLUSIVE_USE, &sc->axe_ep[AXE_ENDPT_RX]); if (err) { - printf("axe%d: open rx pipe failed: %s\n", - sc->axe_unit, usbd_errstr(err)); + device_printf(sc->axe_dev, "open rx pipe failed: %s\n", + usbd_errstr(err)); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); return; @@ -922,8 +917,8 @@ axe_init(void *xsc) err = usbd_open_pipe(sc->axe_iface, sc->axe_ed[AXE_ENDPT_TX], USBD_EXCLUSIVE_USE, &sc->axe_ep[AXE_ENDPT_TX]); if (err) { - printf("axe%d: open tx pipe failed: %s\n", - sc->axe_unit, usbd_errstr(err)); + device_printf(sc->axe_dev, "open tx pipe failed: %s\n", + usbd_errstr(err)); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); return; @@ -1033,7 +1028,7 @@ axe_watchdog(struct ifnet *ifp) AXE_LOCK(sc); ifp->if_oerrors++; - printf("axe%d: watchdog timeout\n", sc->axe_unit); + device_printf(sc->axe_dev, "watchdog timeout\n"); c = &sc->axe_cdata.ue_tx_chain[0]; usbd_get_xfer_status(c->ue_xfer, NULL, NULL, NULL, &stat); @@ -1069,13 +1064,13 @@ axe_stop(struct axe_softc *sc) if (sc->axe_ep[AXE_ENDPT_RX] != NULL) { err = usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_RX]); if (err) { - printf("axe%d: abort rx pipe failed: %s\n", - sc->axe_unit, usbd_errstr(err)); + device_printf(sc->axe_dev, "abort rx pipe failed: %s\n", + usbd_errstr(err)); } err = usbd_close_pipe(sc->axe_ep[AXE_ENDPT_RX]); if (err) { - printf("axe%d: close rx pipe failed: %s\n", - sc->axe_unit, usbd_errstr(err)); + device_printf(sc->axe_dev, "close rx pipe failed: %s\n", + usbd_errstr(err)); } sc->axe_ep[AXE_ENDPT_RX] = NULL; } @@ -1083,13 +1078,13 @@ axe_stop(struct axe_softc *sc) if (sc->axe_ep[AXE_ENDPT_TX] != NULL) { err = usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_TX]); if (err) { - printf("axe%d: abort tx pipe failed: %s\n", - sc->axe_unit, usbd_errstr(err)); + device_printf(sc->axe_dev, "abort tx pipe failed: %s\n", + usbd_errstr(err)); } err = usbd_close_pipe(sc->axe_ep[AXE_ENDPT_TX]); if (err) { - printf("axe%d: close tx pipe failed: %s\n", - sc->axe_unit, usbd_errstr(err)); + device_printf(sc->axe_dev, "close tx pipe failed: %s\n", + usbd_errstr(err)); } sc->axe_ep[AXE_ENDPT_TX] = NULL; } @@ -1097,13 +1092,13 @@ axe_stop(struct axe_softc *sc) if (sc->axe_ep[AXE_ENDPT_INTR] != NULL) { err = usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_INTR]); if (err) { - printf("axe%d: abort intr pipe failed: %s\n", - sc->axe_unit, usbd_errstr(err)); + device_printf(sc->axe_dev, + "abort intr pipe failed: %s\n", usbd_errstr(err)); } err = usbd_close_pipe(sc->axe_ep[AXE_ENDPT_INTR]); if (err) { - printf("axe%d: close intr pipe failed: %s\n", - sc->axe_unit, usbd_errstr(err)); + device_printf(sc->axe_dev, + "close intr pipe failed: %s\n", usbd_errstr(err)); } sc->axe_ep[AXE_ENDPT_INTR] = NULL; } diff --git a/sys/dev/usb/if_axereg.h b/sys/dev/usb/if_axereg.h index 3971c91..16d5699 100644 --- a/sys/dev/usb/if_axereg.h +++ b/sys/dev/usb/if_axereg.h @@ -134,7 +134,6 @@ struct axe_softc { usbd_interface_handle axe_iface; int axe_ed[AXE_ENDPT_MAX]; usbd_pipe_handle axe_ep[AXE_ENDPT_MAX]; - int axe_unit; int axe_if_flags; struct ue_cdata axe_cdata; struct callout_handle axe_stat_ch; |