Prefer device_printf to printf
Eliminate rue_unit from softc # saves ~200 bytes
This commit is contained in:
parent
9b1defb041
commit
339075ea3d
@ -230,8 +230,8 @@ rue_read_mem(struct rue_softc *sc, u_int16_t addr, void *buf, u_int16_t len)
|
||||
RUE_UNLOCK(sc);
|
||||
|
||||
if (err) {
|
||||
printf("rue%d: control pipe read failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "control pipe read failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -260,8 +260,8 @@ rue_write_mem(struct rue_softc *sc, u_int16_t addr, void *buf, u_int16_t len)
|
||||
RUE_UNLOCK(sc);
|
||||
|
||||
if (err) {
|
||||
printf("rue%d: control pipe write failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "control pipe write failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -377,7 +377,7 @@ rue_miibus_readreg(device_t dev, int phy, int reg)
|
||||
rval = rue_csr_read_1(sc, reg);
|
||||
return (rval);
|
||||
}
|
||||
printf("rue%d: bad phy register\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "bad phy register\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ rue_miibus_writereg(device_t dev, int phy, int reg, int data)
|
||||
rue_csr_write_1(sc, reg, data);
|
||||
return (0);
|
||||
}
|
||||
printf("rue%d: bad phy register\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "bad phy register\n");
|
||||
return (0);
|
||||
}
|
||||
rue_csr_write_2(sc, ruereg, data);
|
||||
@ -538,7 +538,7 @@ rue_reset(struct rue_softc *sc)
|
||||
break;
|
||||
}
|
||||
if (i == RUE_TIMEOUT)
|
||||
printf("rue%d: reset never completed!\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "reset never completed!\n");
|
||||
|
||||
DELAY(10000);
|
||||
}
|
||||
@ -586,18 +586,15 @@ USB_ATTACH(rue)
|
||||
|
||||
sc->rue_dev = self;
|
||||
sc->rue_udev = uaa->device;
|
||||
sc->rue_unit = device_get_unit(self);
|
||||
|
||||
if (usbd_set_config_no(sc->rue_udev, RUE_CONFIG_NO, 0)) {
|
||||
printf("rue%d: getting interface handle failed\n",
|
||||
sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "getting interface handle failed\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
err = usbd_device2interface_handle(uaa->device, RUE_IFACE_IDX, &iface);
|
||||
if (err) {
|
||||
printf("rue%d: getting interface handle failed\n",
|
||||
sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "getting interface handle failed\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -619,7 +616,7 @@ USB_ATTACH(rue)
|
||||
for (i = 0; i < id->bNumEndpoints; i++) {
|
||||
ed = usbd_interface2endpoint_descriptor(iface, i);
|
||||
if (ed == NULL) {
|
||||
printf("rue%d: couldn't get ep %d\n", sc->rue_unit, i);
|
||||
device_printf(sc->rue_dev, "couldn't get ep %d\n", i);
|
||||
goto error;
|
||||
}
|
||||
if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
|
||||
@ -645,17 +642,17 @@ USB_ATTACH(rue)
|
||||
err = rue_read_mem(sc, RUE_EEPROM_IDR0,
|
||||
(caddr_t)&eaddr, ETHER_ADDR_LEN);
|
||||
if (err) {
|
||||
printf("rue%d: couldn't get station address\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "couldn't get station address\n");
|
||||
goto error1;
|
||||
}
|
||||
|
||||
ifp = sc->rue_ifp = if_alloc(IFT_ETHER);
|
||||
if (ifp == NULL) {
|
||||
printf("rue%d: can not if_alloc()\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "can not if_alloc()\n");
|
||||
goto error1;
|
||||
}
|
||||
ifp->if_softc = sc;
|
||||
if_initname(ifp, "rue", sc->rue_unit);
|
||||
if_initname(ifp, "rue", device_get_unit(sc->rue_dev));
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
|
||||
IFF_NEEDSGIANT;
|
||||
@ -668,7 +665,7 @@ USB_ATTACH(rue)
|
||||
/* MII setup */
|
||||
if (mii_phy_probe(self, &sc->rue_miibus,
|
||||
rue_ifmedia_upd, rue_ifmedia_sts)) {
|
||||
printf("rue%d: MII without any PHY!\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "MII without any PHY!\n");
|
||||
goto error2;
|
||||
}
|
||||
|
||||
@ -744,8 +741,8 @@ rue_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
|
||||
RUE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
printf("rue%d: usb error on intr: %s\n", sc->rue_unit,
|
||||
usbd_errstr(status));
|
||||
device_printf(sc->rue_dev, "usb error on intr: %s\n",
|
||||
usbd_errstr(status));
|
||||
if (status == USBD_STALLED)
|
||||
usbd_clear_endpoint_stall(sc->rue_ep[RUE_ENDPT_INTR]);
|
||||
RUE_UNLOCK(sc);
|
||||
@ -821,8 +818,8 @@ rue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
|
||||
return;
|
||||
}
|
||||
if (usbd_ratecheck(&sc->rue_rx_notice))
|
||||
printf("rue%d: usb error on rx: %s\n", sc->rue_unit,
|
||||
usbd_errstr(status));
|
||||
device_printf(sc->rue_dev, "usb error on rx: %s\n",
|
||||
usbd_errstr(status));
|
||||
if (status == USBD_STALLED)
|
||||
usbd_clear_endpoint_stall(sc->rue_ep[RUE_ENDPT_RX]);
|
||||
goto done;
|
||||
@ -888,8 +885,8 @@ rue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
|
||||
RUE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
printf("rue%d: usb error on tx: %s\n", sc->rue_unit,
|
||||
usbd_errstr(status));
|
||||
device_printf(sc->rue_dev, "usb error on tx: %s\n",
|
||||
usbd_errstr(status));
|
||||
if (status == USBD_STALLED)
|
||||
usbd_clear_endpoint_stall(sc->rue_ep[RUE_ENDPT_TX]);
|
||||
RUE_UNLOCK(sc);
|
||||
@ -1064,7 +1061,7 @@ rue_init(void *xsc)
|
||||
/* Init TX ring. */
|
||||
if (usb_ether_tx_list_init(sc, &sc->rue_cdata,
|
||||
sc->rue_udev) == ENOBUFS) {
|
||||
printf("rue%d: tx list init failed\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "tx list init failed\n");
|
||||
RUE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
@ -1072,7 +1069,7 @@ rue_init(void *xsc)
|
||||
/* Init RX ring. */
|
||||
if (usb_ether_rx_list_init(sc, &sc->rue_cdata,
|
||||
sc->rue_udev) == ENOBUFS) {
|
||||
printf("rue%d: rx list init failed\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "rx list init failed\n");
|
||||
RUE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
@ -1114,16 +1111,16 @@ rue_init(void *xsc)
|
||||
err = usbd_open_pipe(sc->rue_iface, sc->rue_ed[RUE_ENDPT_RX],
|
||||
USBD_EXCLUSIVE_USE, &sc->rue_ep[RUE_ENDPT_RX]);
|
||||
if (err) {
|
||||
printf("rue%d: open rx pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "open rx pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
RUE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
err = usbd_open_pipe(sc->rue_iface, sc->rue_ed[RUE_ENDPT_TX],
|
||||
USBD_EXCLUSIVE_USE, &sc->rue_ep[RUE_ENDPT_TX]);
|
||||
if (err) {
|
||||
printf("rue%d: open tx pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "open tx pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
RUE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
@ -1135,8 +1132,8 @@ rue_init(void *xsc)
|
||||
sc->rue_cdata.ue_ibuf, RUE_INTR_PKTLEN,
|
||||
rue_intr, RUE_INTR_INTERVAL);
|
||||
if (err) {
|
||||
printf("rue%d: open intr pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "open intr pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
RUE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
@ -1259,7 +1256,7 @@ rue_watchdog(struct ifnet *ifp)
|
||||
RUE_LOCK(sc);
|
||||
|
||||
ifp->if_oerrors++;
|
||||
printf("rue%d: watchdog timeout\n", sc->rue_unit);
|
||||
device_printf(sc->rue_dev, "watchdog timeout\n");
|
||||
|
||||
c = &sc->rue_cdata.ue_tx_chain[0];
|
||||
usbd_get_xfer_status(c->ue_xfer, NULL, NULL, NULL, &stat);
|
||||
@ -1296,13 +1293,13 @@ rue_stop(struct rue_softc *sc)
|
||||
if (sc->rue_ep[RUE_ENDPT_RX] != NULL) {
|
||||
err = usbd_abort_pipe(sc->rue_ep[RUE_ENDPT_RX]);
|
||||
if (err) {
|
||||
printf("rue%d: abort rx pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "abort rx pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
}
|
||||
err = usbd_close_pipe(sc->rue_ep[RUE_ENDPT_RX]);
|
||||
if (err) {
|
||||
printf("rue%d: close rx pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "close rx pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
}
|
||||
sc->rue_ep[RUE_ENDPT_RX] = NULL;
|
||||
}
|
||||
@ -1310,13 +1307,13 @@ rue_stop(struct rue_softc *sc)
|
||||
if (sc->rue_ep[RUE_ENDPT_TX] != NULL) {
|
||||
err = usbd_abort_pipe(sc->rue_ep[RUE_ENDPT_TX]);
|
||||
if (err) {
|
||||
printf("rue%d: abort tx pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "abort tx pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
}
|
||||
err = usbd_close_pipe(sc->rue_ep[RUE_ENDPT_TX]);
|
||||
if (err) {
|
||||
printf("rue%d: close tx pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "close tx pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
}
|
||||
sc->rue_ep[RUE_ENDPT_TX] = NULL;
|
||||
}
|
||||
@ -1325,13 +1322,13 @@ rue_stop(struct rue_softc *sc)
|
||||
if (sc->rue_ep[RUE_ENDPT_INTR] != NULL) {
|
||||
err = usbd_abort_pipe(sc->rue_ep[RUE_ENDPT_INTR]);
|
||||
if (err) {
|
||||
printf("rue%d: abort intr pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "abort intr pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
}
|
||||
err = usbd_close_pipe(sc->rue_ep[RUE_ENDPT_INTR]);
|
||||
if (err) {
|
||||
printf("rue%d: close intr pipe failed: %s\n",
|
||||
sc->rue_unit, usbd_errstr(err));
|
||||
device_printf(sc->rue_dev, "close intr pipe failed: %s\n",
|
||||
usbd_errstr(err));
|
||||
}
|
||||
sc->rue_ep[RUE_ENDPT_INTR] = NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user