diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2007-06-10 14:49:02 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2007-06-10 14:49:02 +0000 |
commit | b36c9f662da72870bf22394171cf74a54a7f8e39 (patch) | |
tree | 2641ee87f027aa978ea64bc95fe33bcf03d1d500 /sys | |
parent | 2bca40ff67d19c516b42ca70c28870f34f7388dc (diff) |
Remove the definition and use of the USBDEVNAME macro.
(This might look easy, but it was a big diff. Thanks to dlg and especially jsg
for looking over it; we found at least four mistakes in the initial diff.)
ok jsg.
Diffstat (limited to 'sys')
60 files changed, 1327 insertions, 1328 deletions
diff --git a/sys/arch/arm/xscale/pxa27x_udc.c b/sys/arch/arm/xscale/pxa27x_udc.c index 4e5258b991d..07e86ae35e3 100644 --- a/sys/arch/arm/xscale/pxa27x_udc.c +++ b/sys/arch/arm/xscale/pxa27x_udc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa27x_udc.c,v 1.20 2007/06/10 10:15:35 mbalmer Exp $ */ +/* $OpenBSD: pxa27x_udc.c,v 1.21 2007/06/10 14:49:01 mbalmer Exp $ */ /* * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org> @@ -164,7 +164,7 @@ struct usbf_pipe_methods pxaudc_bulk_methods = { #endif /* NUSBF > 0 */ -#define DEVNAME(sc) USBDEVNAME((sc)->sc_bus.bdev) +#define DEVNAME(sc) ((sc)->sc_bus.bdev.dv_xname) #define CSR_READ_4(sc, reg) \ bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg)) diff --git a/sys/dev/pci/ehci_pci.c b/sys/dev/pci/ehci_pci.c index c2bc3b83615..195b29888ba 100644 --- a/sys/dev/pci/ehci_pci.c +++ b/sys/dev/pci/ehci_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci_pci.c,v 1.11 2007/05/20 00:52:26 jsg Exp $ */ +/* $OpenBSD: ehci_pci.c,v 1.12 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: ehci_pci.c,v 1.15 2004/04/23 21:13:06 itojun Exp $ */ /* @@ -250,7 +250,7 @@ ehci_pci_takecontroller(struct ehci_pci_softc *sc) legsup | EHCI_LEGSUP_OSOWNED); if (legsup & EHCI_LEGSUP_BIOSOWNED) { DPRINTF(("%s: waiting for BIOS to give up control\n", - USBDEVNAME(sc->sc.sc_bus.bdev))); + sc->sc.sc_bus.bdev.dv_xname)); for (i = 0; i < 5000; i++) { legsup = pci_conf_read(sc->sc_pc, sc->sc_tag, eecp); @@ -260,7 +260,7 @@ ehci_pci_takecontroller(struct ehci_pci_softc *sc) } if (legsup & EHCI_LEGSUP_BIOSOWNED) printf("%s: timed out waiting for BIOS\n", - USBDEVNAME(sc->sc.sc_bus.bdev)); + sc->sc.sc_bus.bdev.dv_xname); } } } diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index 8e140107960..75e18fee719 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci.c,v 1.72 2007/06/10 10:15:35 mbalmer Exp $ */ +/* $OpenBSD: ehci.c,v 1.73 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */ /* @@ -341,7 +341,7 @@ ehci_init(ehci_softc_t *sc) DPRINTF(("ehci_init: start\n")); vers = EREAD2(sc, EHCI_HCIVERSION); - DPRINTF(("%s: EHCI version %x.%x\n", USBDEVNAME(sc->sc_bus.bdev), + DPRINTF(("%s: EHCI version %x.%x\n", sc->sc_bus.bdev.dv_xname, vers >> 8, vers & 0xff)); #endif @@ -360,7 +360,7 @@ ehci_init(ehci_softc_t *sc) sc->sc_bus.usbrev = USBREV_2_0; /* Reset the controller */ - DPRINTF(("%s: resetting\n", USBDEVNAME(sc->sc_bus.bdev))); + DPRINTF(("%s: resetting\n", sc->sc_bus.bdev.dv_xname)); EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ usb_delay_ms(&sc->sc_bus, 1); EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); @@ -372,7 +372,7 @@ ehci_init(ehci_softc_t *sc) } if (hcr) { printf("%s: reset timeout\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); return (USBD_IOERROR); } @@ -390,7 +390,7 @@ ehci_init(ehci_softc_t *sc) EHCI_FLALIGN_ALIGN, &sc->sc_fldma); if (err) return (err); - DPRINTF(("%s: flsize=%d\n", USBDEVNAME(sc->sc_bus.bdev),sc->sc_flsize)); + DPRINTF(("%s: flsize=%d\n", sc->sc_bus.bdev.dv_xname,sc->sc_flsize)); sc->sc_flist = KERNADDR(&sc->sc_fldma, 0); EOWRITE4(sc, EHCI_PERIODICLISTBASE, DMAADDR(&sc->sc_fldma, 0)); @@ -492,7 +492,7 @@ ehci_init(ehci_softc_t *sc) break; } if (hcr) { - printf("%s: run timeout\n", USBDEVNAME(sc->sc_bus.bdev)); + printf("%s: run timeout\n", sc->sc_bus.bdev.dv_xname); return (USBD_IOERROR); } @@ -573,7 +573,7 @@ ehci_intr1(ehci_softc_t *sc) } if (eintrs & EHCI_STS_HSE) { printf("%s: unrecoverable error, controller halted\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); /* XXX what else */ } if (eintrs & EHCI_STS_PCD) { @@ -597,7 +597,7 @@ ehci_intr1(ehci_softc_t *sc) sc->sc_eintrs &= ~eintrs; EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); printf("%s: blocking intrs 0x%x\n", - USBDEVNAME(sc->sc_bus.bdev), eintrs); + sc->sc_bus.bdev.dv_xname, eintrs); } return (1); @@ -657,7 +657,7 @@ ehci_softintr(void *v) ehci_softc_t *sc = v; struct ehci_xfer *ex, *nextex; - DPRINTFN(10,("%s: ehci_softintr (%d)\n", USBDEVNAME(sc->sc_bus.bdev), + DPRINTFN(10,("%s: ehci_softintr (%d)\n", sc->sc_bus.bdev.dv_xname, sc->sc_bus.intr_context)); sc->sc_bus.intr_context++; @@ -983,7 +983,7 @@ ehci_power(int why, void *v) } if (hcr != 0) printf("%s: reset timeout\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); cmd &= ~EHCI_CMD_RS; EOWRITE4(sc, EHCI_USBCMD, cmd); @@ -997,7 +997,7 @@ ehci_power(int why, void *v) } if (hcr != EHCI_STS_HCH) printf("%s: config timeout\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); sc->sc_bus.use_polling--; break; @@ -1047,7 +1047,7 @@ ehci_power(int why, void *v) } if (hcr == EHCI_STS_HCH) printf("%s: config timeout\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT); @@ -1356,7 +1356,7 @@ ehci_open(usbd_pipe_handle pipe) if (speed != EHCI_QH_SPEED_HIGH && xfertype == UE_ISOCHRONOUS) { printf("%s: *** WARNING: opening low/full speed isochronous " "device, this does not work yet.\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); DPRINTFN(1,("ehci_open: hshubaddr=%d hshubport=%d\n", hshubaddr, hshubport)); return (USBD_INVAL); @@ -1983,7 +1983,7 @@ ehci_root_ctrl_start(usbd_xfer_handle xfer) DPRINTF(("ehci after reset, status=0x%08x\n", v)); if (v & EHCI_PS_PR) { printf("%s: port reset timeout\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); return (USBD_TIMEOUT); } if (!(v & EHCI_PS_PE)) { diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index 3a13774923f..50ce647cb9e 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.82 2007/06/09 12:22:53 mbalmer Exp $ */ +/* $OpenBSD: if_atu.c,v 1.83 2007/06/10 14:49:00 mbalmer Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. @@ -302,11 +302,11 @@ atu_usb_request(struct atu_softc *sc, u_int8_t type, if (atudebug) { if ((data == NULL) || (type & UT_READ)) { DPRINTFN(20, ("%s: req=%02x val=%02x ind=%02x " - "len=%02x\n", USBDEVNAME(sc->atu_dev), request, + "len=%02x\n", sc->atu_dev.dv_xname, request, value, index, length)); } else { DPRINTFN(20, ("%s: req=%02x val=%02x ind=%02x " - "len=%02x [%8D]\n", USBDEVNAME(sc->atu_dev), + "len=%02x [%8D]\n", sc->atu_dev.dv_xname, request, value, index, length, data, " ")); } } @@ -326,13 +326,13 @@ atu_usb_request(struct atu_softc *sc, u_int8_t type, if (atudebug) { if (type & UT_READ) { DPRINTFN(20, ("%s: transfered 0x%x bytes in\n", - USBDEVNAME(sc->atu_dev), total_len)); + sc->atu_dev.dv_xname, total_len)); DPRINTFN(20, ("%s: dump [%10D]\n", - USBDEVNAME(sc->atu_dev), data, " ")); + sc->atu_dev.dv_xname, data, " ")); } else { if (total_len != length) DPRINTF(("%s: ARG! wrote only %x bytes\n", - USBDEVNAME(sc->atu_dev), total_len)); + sc->atu_dev.dv_xname, total_len)); } } #endif /* ATU_DEBUG */ @@ -373,7 +373,7 @@ atu_wait_completion(struct atu_softc *sc, u_int8_t cmd, u_int8_t *status) u_int8_t statusreq[6]; DPRINTFN(15, ("%s: wait-completion: cmd=%02x\n", - USBDEVNAME(sc->atu_dev), cmd)); + sc->atu_dev.dv_xname, cmd)); while (1) { err = atu_get_cmd_status(sc, cmd, statusreq); @@ -383,7 +383,7 @@ atu_wait_completion(struct atu_softc *sc, u_int8_t cmd, u_int8_t *status) #ifdef ATU_DEBUG if (atudebug) { DPRINTFN(20, ("%s: status=%s cmd=%02x\n", - USBDEVNAME(sc->atu_dev), + sc->atu_dev.dv_xname, ether_sprintf(statusreq), cmd)); } #endif /* ATU_DEBUG */ @@ -394,7 +394,7 @@ atu_wait_completion(struct atu_softc *sc, u_int8_t cmd, u_int8_t *status) */ if ((statusreq[5] == STATUS_IDLE) && (idle_count++ > 20)) { DPRINTF(("%s: AAARRGGG!!! FIX ME!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return 0; } @@ -455,7 +455,7 @@ atu_send_mib(struct atu_softc *sc, u_int8_t type, u_int8_t size, return (err); DPRINTFN(15, ("%s: sendmib : waitcompletion...\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return atu_wait_completion(sc, CMD_SET_MIB, NULL); } @@ -495,7 +495,7 @@ atu_start_ibss(struct atu_softc *sc) err = atu_send_command(sc, (u_int8_t *)&Request, sizeof(Request)); if (err) { DPRINTF(("%s: start ibss failed!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } @@ -503,7 +503,7 @@ atu_start_ibss(struct atu_softc *sc) err = atu_wait_completion(sc, CMD_START_IBSS, NULL); if (err) { DPRINTF(("%s: error waiting for start_ibss\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } @@ -511,12 +511,12 @@ atu_start_ibss(struct atu_softc *sc) err = atu_get_mib(sc, MIB_MAC_MGMT__CURRENT_BSSID, sc->atu_bssid); if (err) { DPRINTF(("%s: could not get BSSID!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } DPRINTF(("%s: started a new IBSS (BSSID=%s)\n", - USBDEVNAME(sc->atu_dev), ether_sprintf(sc->atu_bssid))); + sc->atu_dev.dv_xname, ether_sprintf(sc->atu_bssid))); return 0; } #endif @@ -561,8 +561,8 @@ atu_start_scan(struct atu_softc *sc) #ifdef ATU_DEBUG if (atudebug) { DPRINTFN(20, ("%s: scan cmd len=%02x\n", - USBDEVNAME(sc->atu_dev), sizeof(Scan))); - DPRINTFN(20, ("%s: scan cmd: %52D\n", USBDEVNAME(sc->atu_dev), + sc->atu_dev.dv_xname, sizeof(Scan))); + DPRINTFN(20, ("%s: scan cmd: %52D\n", sc->atu_dev.dv_xname, (u_int8_t *)&Scan, " ")); } #endif /* ATU_DEBUG */ @@ -615,7 +615,7 @@ atu_switch_radio(struct atu_softc *sc, int state) return err; DPRINTFN(10, ("%s: radio turned %s\n", - USBDEVNAME(sc->atu_dev), state ? "on" : "off")); + sc->atu_dev.dv_xname, state ? "on" : "off")); sc->atu_radio_on = state; } return 0; @@ -632,20 +632,20 @@ atu_initial_config(struct atu_softc *sc) struct atu_cmd_card_config cmd; u_int8_t reg_domain; - DPRINTFN(10, ("%s: sending mac-addr\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(10, ("%s: sending mac-addr\n", sc->atu_dev.dv_xname)); err = atu_send_mib(sc, MIB_MAC_ADDR__ADDR, ic->ic_myaddr); if (err) { DPRINTF(("%s: error setting mac-addr\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } /* - DPRINTF(("%s: sending reg-domain\n", USBDEVNAME(sc->atu_dev))); + DPRINTF(("%s: sending reg-domain\n", sc->atu_dev.dv_xname)); err = atu_send_mib(sc, MIB_PHY__REG_DOMAIN, NR(0x30)); if (err) { DPRINTF(("%s: error setting mac-addr\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } */ @@ -709,18 +709,18 @@ atu_initial_config(struct atu_softc *sc) err = atu_get_mib(sc, MIB_PHY__REG_DOMAIN, ®_domain); if (err) { DPRINTF(("%s: could not get regdomain!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); } else { DPRINTF(("%s: we're in reg domain 0x%x according to the " - "adapter\n", USBDEVNAME(sc->atu_dev), reg_domain)); + "adapter\n", sc->atu_dev.dv_xname, reg_domain)); } #ifdef ATU_DEBUG if (atudebug) { - DPRINTFN(20, ("%s: configlen=%02x\n", USBDEVNAME(sc->atu_dev), + DPRINTFN(20, ("%s: configlen=%02x\n", sc->atu_dev.dv_xname, sizeof(cmd))); DPRINTFN(20, ("%s: configdata= %108D\n", - USBDEVNAME(sc->atu_dev), (u_int8_t *)&cmd, " ")); + sc->atu_dev.dv_xname, (u_int8_t *)&cmd, " ")); } #endif /* ATU_DEBUG */ @@ -765,7 +765,7 @@ atu_initial_config(struct atu_softc *sc) return err; DPRINTFN(10, ("%s: completed initial config\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return 0; } @@ -783,8 +783,8 @@ atu_join(struct atu_softc *sc, struct ieee80211_node *node) USETW(join.Size, sizeof(join) - 4); DPRINTFN(15, ("%s: pre-join sc->atu_bssid=%s\n", - USBDEVNAME(sc->atu_dev), ether_sprintf(sc->atu_bssid))); - DPRINTFN(15, ("%s: mode=%d\n", USBDEVNAME(sc->atu_dev), + sc->atu_dev.dv_xname, ether_sprintf(sc->atu_bssid))); + DPRINTFN(15, ("%s: mode=%d\n", sc->atu_dev.dv_xname, sc->atu_mode)); memcpy(join.bssid, node->ni_bssid, IEEE80211_ADDR_LEN); memcpy(join.essid, node->ni_essid, node->ni_esslen); @@ -799,25 +799,25 @@ atu_join(struct atu_softc *sc, struct ieee80211_node *node) join.reserved = 0x00; DPRINTFN(10, ("%s: trying to join BSSID=%s\n", - USBDEVNAME(sc->atu_dev), ether_sprintf(join.bssid))); + sc->atu_dev.dv_xname, ether_sprintf(join.bssid))); err = atu_send_command(sc, (u_int8_t *)&join, sizeof(join)); if (err) { DPRINTF(("%s: ERROR trying to join IBSS\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } err = atu_wait_completion(sc, CMD_JOIN, &status); if (err) { DPRINTF(("%s: error joining BSS!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } if (status != STATUS_COMPLETE) { DPRINTF(("%s: error joining... [status=%02x]\n", - USBDEVNAME(sc->atu_dev), status)); + sc->atu_dev.dv_xname, status)); return status; } else { - DPRINTFN(10, ("%s: joined BSS\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(10, ("%s: joined BSS\n", sc->atu_dev.dv_xname)); } return err; } @@ -883,11 +883,11 @@ atu_internal_firmware(void *arg) name = atu_radfirm[i].atur_internal; DPRINTF(("%s: loading firmware %s...\n", - USBDEVNAME(sc->atu_dev), name)); + sc->atu_dev.dv_xname, name)); err = loadfirmware(name, &firm, &bytes_left); if (err != 0) { printf("%s: %s loadfirmware error %d\n", - USBDEVNAME(sc->atu_dev), name, err); + sc->atu_dev.dv_xname, name, err); return; } @@ -902,7 +902,7 @@ atu_internal_firmware(void *arg) status); if (err) { DPRINTF(("%s: dfu_getstatus failed!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); free(firm, M_DEVBUF); return; } @@ -918,13 +918,13 @@ atu_internal_firmware(void *arg) else block_size = bytes_left; DPRINTFN(15, ("%s: firmware block %d\n", - USBDEVNAME(sc->atu_dev), block)); + sc->atu_dev.dv_xname, block)); err = atu_usb_request(sc, DFU_DNLOAD, block++, 0, block_size, ptr); if (err) { DPRINTF(("%s: dfu_dnload failed\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); free(firm, M_DEVBUF); return; } @@ -937,7 +937,7 @@ atu_internal_firmware(void *arg) default: DPRINTFN(20, ("%s: sleeping for a while\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); usbd_delay_ms(sc->atu_udev, 100); break; } @@ -948,20 +948,20 @@ atu_internal_firmware(void *arg) if (state != DFUState_ManifestSync) { DPRINTF(("%s: state != manifestsync... eek!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); } err = atu_usb_request(sc, DFU_GETSTATUS, 0, 0, 6, status); if (err) { DPRINTF(("%s: dfu_getstatus failed!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return; } - DPRINTFN(15, ("%s: sending remap\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(15, ("%s: sending remap\n", sc->atu_dev.dv_xname)); err = atu_usb_request(sc, DFU_REMAP, 0, 0, 0, NULL); if ((err) && (!ISSET(sc->atu_quirk, ATU_QUIRK_NO_REMAP))) { - DPRINTF(("%s: remap failed!\n", USBDEVNAME(sc->atu_dev))); + DPRINTF(("%s: remap failed!\n", sc->atu_dev.dv_xname)); return; } @@ -973,7 +973,7 @@ atu_internal_firmware(void *arg) usbd_delay_ms(sc->atu_udev, 56+100); printf("%s: reattaching after firmware upload\n", - USBDEVNAME(sc->atu_dev)); + sc->atu_dev.dv_xname); usb_needs_reattach(sc->atu_udev); } @@ -991,11 +991,11 @@ atu_external_firmware(void *arg) name = atu_radfirm[i].atur_external; DPRINTF(("%s: loading external firmware %s\n", - USBDEVNAME(sc->atu_dev), name)); + sc->atu_dev.dv_xname, name)); err = loadfirmware(name, &firm, &bytes_left); if (err != 0) { printf("%s: %s loadfirmware error %d\n", - USBDEVNAME(sc->atu_dev), name, err); + sc->atu_dev.dv_xname, name, err); return; } ptr = firm; @@ -1007,12 +1007,12 @@ atu_external_firmware(void *arg) block_size = bytes_left; DPRINTFN(15, ("%s: block:%d size:%d\n", - USBDEVNAME(sc->atu_dev), block, block_size)); + sc->atu_dev.dv_xname, block, block_size)); err = atu_usb_request(sc, UT_WRITE_VENDOR_DEVICE, 0x0e, 0x0802, block, block_size, ptr); if (err) { DPRINTF(("%s: could not load external firmware " - "block\n", USBDEVNAME(sc->atu_dev))); + "block\n", sc->atu_dev.dv_xname)); free(firm, M_DEVBUF); return; } @@ -1027,7 +1027,7 @@ atu_external_firmware(void *arg) block, 0, NULL); if (err) { DPRINTF(("%s: could not load last zero-length firmware " - "block\n", USBDEVNAME(sc->atu_dev))); + "block\n", sc->atu_dev.dv_xname)); return; } @@ -1040,7 +1040,7 @@ atu_external_firmware(void *arg) usbd_delay_ms(sc->atu_udev, 21 + 100); DPRINTFN(10, ("%s: external firmware upload done\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); /* complete configuration after the firmwares have been uploaded */ atu_complete_attach(sc); } @@ -1065,7 +1065,7 @@ atu_get_card_config(struct atu_softc *sc) (u_int8_t *)&rfmd_conf); if (err) { DPRINTF(("%s: could not get rfmd config!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } memcpy(ic->ic_myaddr, rfmd_conf.MACAddr, IEEE80211_ADDR_LEN); @@ -1078,7 +1078,7 @@ atu_get_card_config(struct atu_softc *sc) (u_int8_t *)&intersil_conf); if (err) { DPRINTF(("%s: could not get intersil config!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return err; } memcpy(ic->ic_myaddr, intersil_conf.MACAddr, @@ -1119,7 +1119,7 @@ atu_media_change(struct ifnet *ifp) #endif /* ATU_DEBUG */ int err; - DPRINTFN(10, ("%s: atu_media_change\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(10, ("%s: atu_media_change\n", sc->atu_dev.dv_xname)); err = ieee80211_media_change(ifp); if (err == ENETRESET) { @@ -1139,7 +1139,7 @@ atu_media_status(struct ifnet *ifp, struct ifmediareq *req) struct atu_softc *sc = ifp->if_softc; #endif /* ATU_DEBUG */ - DPRINTFN(10, ("%s: atu_media_status\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(10, ("%s: atu_media_status\n", sc->atu_dev.dv_xname)); ieee80211_media_status(ifp, req); } @@ -1153,7 +1153,7 @@ atu_task(void *arg) usbd_status err; int s; - DPRINTFN(10, ("%s: atu_task\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(10, ("%s: atu_task\n", sc->atu_dev.dv_xname)); if (sc->sc_state != ATU_S_OK) return; @@ -1164,19 +1164,19 @@ atu_task(void *arg) err = atu_start_scan(sc); if (err) { DPRINTFN(1, ("%s: atu_init: couldn't start scan!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return; } err = atu_wait_completion(sc, CMD_START_SCAN, NULL); if (err) { DPRINTF(("%s: atu_init: error waiting for scan\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return; } DPRINTF(("%s: ==========================> END OF SCAN!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); s = splnet(); /* ieee80211_next_scan(ifp); */ @@ -1184,7 +1184,7 @@ atu_task(void *arg) splx(s); DPRINTF(("%s: ----------------------======> END OF SCAN2!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); break; case ATU_C_JOIN: @@ -1199,7 +1199,7 @@ atu_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) struct atu_softc *sc = ifp->if_softc; enum ieee80211_state ostate = ic->ic_state; - DPRINTFN(10, ("%s: atu_newstate: %s -> %s\n", USBDEVNAME(sc->atu_dev), + DPRINTFN(10, ("%s: atu_newstate: %s -> %s\n", sc->atu_dev.dv_xname, ieee80211_state_name[ostate], ieee80211_state_name[nstate])); switch (nstate) { @@ -1249,20 +1249,20 @@ atu_attach(struct device *parent, struct device *self, void *aux) sc->sc_state = ATU_S_UNCONFIG; devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s", USBDEVNAME(sc->atu_dev), devinfop); + printf("\n%s: %s", sc->atu_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, ATU_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->atu_dev)); + sc->atu_dev.dv_xname); return; } err = usbd_device2interface_handle(dev, ATU_IFACE_IDX, &sc->atu_iface); if (err) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->atu_dev)); + sc->atu_dev.dv_xname); return; } @@ -1294,10 +1294,10 @@ atu_attach(struct device *parent, struct device *self, void *aux) * in DFU mode... Let's just try to get the opmode */ err = atu_get_opmode(sc, &mode); - DPRINTFN(20, ("%s: opmode: %d\n", USBDEVNAME(sc->atu_dev), mode)); + DPRINTFN(20, ("%s: opmode: %d\n", sc->atu_dev.dv_xname, mode)); if (err || (mode != MODE_NETCARD && mode != MODE_NOFLASHNETCARD)) { DPRINTF(("%s: starting internal firmware download\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); printf("\n"); @@ -1317,11 +1317,11 @@ atu_attach(struct device *parent, struct device *self, void *aux) if (mode != MODE_NETCARD) { DPRINTFN(15, ("%s: device needs external firmware\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); if (mode != MODE_NOFLASHNETCARD) { DPRINTF(("%s: EEK! unexpected opmode=%d\n", - USBDEVNAME(sc->atu_dev), mode)); + sc->atu_dev.dv_xname, mode)); } /* @@ -1335,7 +1335,7 @@ atu_attach(struct device *parent, struct device *self, void *aux) if (!err) { DPRINTF(("%s: external firmware has already" " been downloaded\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); atu_complete_attach(sc); return; } @@ -1375,10 +1375,10 @@ atu_complete_attach(struct atu_softc *sc) for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(sc->atu_iface, i); if (!ed) { - DPRINTF(("%s: num_endp:%d\n", USBDEVNAME(sc->atu_dev), + DPRINTF(("%s: num_endp:%d\n", sc->atu_dev.dv_xname, sc->atu_iface->idesc->bNumEndpoints)); DPRINTF(("%s: couldn't get ep %d\n", - USBDEVNAME(sc->atu_dev), i)); + sc->atu_dev.dv_xname, i)); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -1394,7 +1394,7 @@ atu_complete_attach(struct atu_softc *sc) err = atu_get_card_config(sc); if (err) { printf("\n%s: could not get card cfg!\n", - USBDEVNAME(sc->atu_dev)); + sc->atu_dev.dv_xname); return; } @@ -1404,11 +1404,11 @@ atu_complete_attach(struct atu_softc *sc) (u_int8_t *)&fw); if (!err) { DPRINTFN(15, ("%s: firmware: maj:%d min:%d patch:%d " - "build:%d\n", USBDEVNAME(sc->atu_dev), fw.major, fw.minor, + "build:%d\n", sc->atu_dev.dv_xname, fw.major, fw.minor, fw.patch, fw.build)); } else { DPRINTF(("%s: get firmware version failed\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); } #endif /* ATU_DEBUG */ @@ -1441,7 +1441,7 @@ atu_complete_attach(struct atu_softc *sc) ic->ic_ibss_chan = &ic->ic_channels[0]; ifp->if_softc = sc; - memcpy(ifp->if_xname, USBDEVNAME(sc->atu_dev), IFNAMSIZ); + memcpy(ifp->if_xname, sc->atu_dev.dv_xname, IFNAMSIZ); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = atu_start; ifp->if_ioctl = atu_ioctl; @@ -1483,7 +1483,7 @@ atu_detach(struct device *self, int flags) struct atu_softc *sc = (struct atu_softc *)self; struct ifnet *ifp = &sc->sc_ic.ic_if; - DPRINTFN(10, ("%s: atu_detach state=%d\n", USBDEVNAME(sc->atu_dev), + DPRINTFN(10, ("%s: atu_detach state=%d\n", sc->atu_dev.dv_xname, sc->sc_state)); if (sc->sc_state != ATU_S_UNCONFIG) { @@ -1530,14 +1530,14 @@ atu_newbuf(struct atu_softc *sc, struct atu_chain *c, struct mbuf *m) MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { DPRINTF(("%s: no memory for rx list\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return(ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { DPRINTF(("%s: no memory for rx list\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); m_freem(m_new); return(ENOBUFS); } @@ -1559,7 +1559,7 @@ atu_rx_list_init(struct atu_softc *sc) int i; DPRINTFN(15, ("%s: atu_rx_list_init: enter\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); for (i = 0; i < ATU_RX_LIST_CNT; i++) { c = &cd->atu_rx_chain[i]; @@ -1588,7 +1588,7 @@ atu_tx_list_init(struct atu_softc *sc) int i; DPRINTFN(15, ("%s: atu_tx_list_init\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); SLIST_INIT(&cd->atu_tx_free); sc->atu_cdata.atu_tx_inuse = 0; @@ -1651,7 +1651,7 @@ atu_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) u_int32_t len; int s; - DPRINTFN(25, ("%s: atu_rxeof\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(25, ("%s: atu_rxeof\n", sc->atu_dev.dv_xname)); if (sc->sc_state != ATU_S_OK) return; @@ -1661,14 +1661,14 @@ atu_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (status != USBD_NORMAL_COMPLETION) { DPRINTF(("%s: status != USBD_NORMAL_COMPLETION\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { return; } #if 0 if (status == USBD_IOERROR) { DPRINTF(("%s: rx: EEK! lost device?\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); /* * My experience with USBD_IOERROR is that trying to @@ -1686,7 +1686,7 @@ atu_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (usbd_ratecheck(&sc->atu_rx_notice)) { DPRINTF(("%s: usb error on rx: %s\n", - USBDEVNAME(sc->atu_dev), usbd_errstr(status))); + sc->atu_dev.dv_xname, usbd_errstr(status))); } if (status == USBD_STALLED) usbd_clear_endpoint_stall_async( @@ -1698,7 +1698,7 @@ atu_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (len <= 1) { DPRINTF(("%s: atu_rxeof: too short\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); goto done; } @@ -1779,7 +1779,7 @@ atu_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) usbd_status err; int s; - DPRINTFN(25, ("%s: atu_txeof status=%d\n", USBDEVNAME(sc->atu_dev), + DPRINTFN(25, ("%s: atu_txeof status=%d\n", sc->atu_dev.dv_xname, status)); if (c->atu_mbuf != NULL) { @@ -1791,7 +1791,7 @@ atu_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) return; - DPRINTF(("%s: usb error on tx: %s\n", USBDEVNAME(sc->atu_dev), + DPRINTF(("%s: usb error on tx: %s\n", sc->atu_dev.dv_xname, usbd_errstr(status))); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->atu_ep[ATU_ENDPT_TX]); @@ -1840,7 +1840,7 @@ atu_tx_start(struct atu_softc *sc, struct ieee80211_node *ni, struct ieee80211com *ic = &sc->sc_ic; #endif - DPRINTFN(25, ("%s: atu_tx_start\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(25, ("%s: atu_tx_start\n", sc->atu_dev.dv_xname)); /* Don't try to send when we're shutting down the driver */ if (sc->sc_state != ATU_S_OK) { @@ -1899,7 +1899,7 @@ atu_tx_start(struct atu_softc *sc, struct ieee80211_node *ni, err = usbd_transfer(c->atu_xfer); if (err != USBD_IN_PROGRESS) { DPRINTFN(25, ("%s: atu_tx_start: err=%d\n", - USBDEVNAME(sc->atu_dev), err)); + sc->atu_dev.dv_xname, err)); c->atu_mbuf = NULL; m_freem(m); return(EIO); @@ -1920,17 +1920,17 @@ atu_start(struct ifnet *ifp) struct mbuf *m = NULL; int s; - DPRINTFN(25, ("%s: atu_start: enter\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(25, ("%s: atu_start: enter\n", sc->atu_dev.dv_xname)); if ((ifp->if_flags & (IFF_RUNNING|IFF_UP)) != (IFF_RUNNING|IFF_UP)) { DPRINTFN(30, ("%s: atu_start: not running or up\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return; } if (ifp->if_flags & IFF_OACTIVE) { DPRINTFN(30, ("%s: atu_start: IFF_OACTIVE\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); return; } @@ -1947,7 +1947,7 @@ atu_start(struct ifnet *ifp) splx(s); if (c == NULL) { DPRINTFN(10, ("%s: out of tx xfers\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); ifp->if_flags |= IFF_OACTIVE; break; } @@ -1959,10 +1959,10 @@ atu_start(struct ifnet *ifp) IF_DEQUEUE(&ic->ic_mgtq, m); if (m == NULL) { DPRINTFN(10, ("%s: atu_start: data packet\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); if (ic->ic_state != IEEE80211_S_RUN) { DPRINTFN(25, ("%s: no data till running\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); /* put the xfer back on the list */ s = splnet(); SLIST_INSERT_HEAD(&cd->atu_tx_free, c, @@ -1975,7 +1975,7 @@ atu_start(struct ifnet *ifp) IFQ_DEQUEUE(&ifp->if_snd, m); if (m == NULL) { DPRINTFN(25, ("%s: nothing to send\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); s = splnet(); SLIST_INSERT_HEAD(&cd->atu_tx_free, c, atu_list); @@ -2000,7 +2000,7 @@ atu_start(struct ifnet *ifp) #endif } else { DPRINTFN(25, ("%s: atu_start: mgmt packet\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); /* * Hack! The referenced node pointer is in the @@ -2045,7 +2045,7 @@ atu_init(struct ifnet *ifp) s = splnet(); - DPRINTFN(10, ("%s: atu_init\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(10, ("%s: atu_init\n", sc->atu_dev.dv_xname)); if (ifp->if_flags & IFF_RUNNING) { splx(s); @@ -2054,11 +2054,11 @@ atu_init(struct ifnet *ifp) /* Init TX ring */ if (atu_tx_list_init(sc)) - printf("%s: tx list init failed\n", USBDEVNAME(sc->atu_dev)); + printf("%s: tx list init failed\n", sc->atu_dev.dv_xname); /* Init RX ring */ if (atu_rx_list_init(sc)) - printf("%s: rx list init failed\n", USBDEVNAME(sc->atu_dev)); + printf("%s: rx list init failed\n", sc->atu_dev.dv_xname); /* Load the multicast filter. */ /*atu_setmulti(sc); */ @@ -2068,7 +2068,7 @@ atu_init(struct ifnet *ifp) USBD_EXCLUSIVE_USE, &sc->atu_ep[ATU_ENDPT_RX]); if (err) { DPRINTF(("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->atu_dev), usbd_errstr(err))); + sc->atu_dev.dv_xname, usbd_errstr(err))); splx(s); return(EIO); } @@ -2077,7 +2077,7 @@ atu_init(struct ifnet *ifp) USBD_EXCLUSIVE_USE, &sc->atu_ep[ATU_ENDPT_TX]); if (err) { DPRINTF(("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->atu_dev), usbd_errstr(err))); + sc->atu_dev.dv_xname, usbd_errstr(err))); splx(s); return(EIO); } @@ -2093,18 +2093,18 @@ atu_init(struct ifnet *ifp) } DPRINTFN(10, ("%s: starting up using MAC=%s\n", - USBDEVNAME(sc->atu_dev), ether_sprintf(ic->ic_myaddr))); + sc->atu_dev.dv_xname, ether_sprintf(ic->ic_myaddr))); /* Do initial setup */ err = atu_initial_config(sc); if (err) { DPRINTF(("%s: initial config failed!\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); splx(s); return(EIO); } DPRINTFN(10, ("%s: initialised transceiver\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); /* sc->atu_rxfilt = ATU_RXFILT_UNICAST|ATU_RXFILT_BROADCAST; */ @@ -2123,7 +2123,7 @@ atu_init(struct ifnet *ifp) err = ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); if (err) DPRINTFN(1, ("%s: atu_init: error calling " - "ieee80211_net_state", USBDEVNAME(sc->atu_dev))); + "ieee80211_net_state", sc->atu_dev.dv_xname)); splx(s); return 0; @@ -2139,7 +2139,7 @@ atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data) s = splnet(); switch (command) { case SIOCSIFADDR: - DPRINTFN(15, ("%s: SIOCSIFADDR\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(15, ("%s: SIOCSIFADDR\n", sc->atu_dev.dv_xname)); ifa = (struct ifaddr *)data; ifp->if_flags |= IFF_UP; @@ -2155,7 +2155,7 @@ atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case SIOCSIFFLAGS: - DPRINTFN(15, ("%s: SIOCSIFFLAGS\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(15, ("%s: SIOCSIFFLAGS\n", sc->atu_dev.dv_xname)); if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -2180,7 +2180,7 @@ atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data) atu_init(ifp); DPRINTFN(15, ("%s: ioctl calling atu_init()\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); atu_init(ifp); err = atu_switch_radio(sc, 1); } else { @@ -2193,20 +2193,20 @@ atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case SIOCADDMULTI: - DPRINTFN(15, ("%s: SIOCADDMULTI\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(15, ("%s: SIOCADDMULTI\n", sc->atu_dev.dv_xname)); /* TODO: implement */ err = 0; break; case SIOCDELMULTI: - DPRINTFN(15, ("%s: SIOCDELMULTI\n", USBDEVNAME(sc->atu_dev))); + DPRINTFN(15, ("%s: SIOCDELMULTI\n", sc->atu_dev.dv_xname)); /* TODO: implement */ err = 0; break; default: DPRINTFN(15, ("%s: ieee80211_ioctl (%lu)\n", - USBDEVNAME(sc->atu_dev), command)); + sc->atu_dev.dv_xname, command)); err = ieee80211_ioctl(ifp, command, data); break; } @@ -2215,7 +2215,7 @@ atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data) if ((ifp->if_flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP)) { DPRINTF(("%s: atu_ioctl(): netreset\n", - USBDEVNAME(sc->atu_dev))); + sc->atu_dev.dv_xname)); atu_init(ifp); } err = 0; @@ -2233,7 +2233,7 @@ atu_watchdog(struct ifnet *ifp) usbd_status stat; int cnt, s; - DPRINTF(("%s: atu_watchdog\n", USBDEVNAME(sc->atu_dev))); + DPRINTF(("%s: atu_watchdog\n", sc->atu_dev.dv_xname)); ifp->if_timer = 0; @@ -2246,7 +2246,7 @@ atu_watchdog(struct ifnet *ifp) sc = ifp->if_softc; s = splnet(); ifp->if_oerrors++; - DPRINTF(("%s: watchdog timeout\n", USBDEVNAME(sc->atu_dev))); + DPRINTF(("%s: watchdog timeout\n", sc->atu_dev.dv_xname)); /* * TODO: @@ -2289,12 +2289,12 @@ atu_stop(struct ifnet *ifp, int disable) err = usbd_abort_pipe(sc->atu_ep[ATU_ENDPT_RX]); if (err) { DPRINTF(("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->atu_dev), usbd_errstr(err))); + sc->atu_dev.dv_xname, usbd_errstr(err))); } err = usbd_close_pipe(sc->atu_ep[ATU_ENDPT_RX]); if (err) { DPRINTF(("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->atu_dev), usbd_errstr(err))); + sc->atu_dev.dv_xname, usbd_errstr(err))); } sc->atu_ep[ATU_ENDPT_RX] = NULL; } @@ -2303,12 +2303,12 @@ atu_stop(struct ifnet *ifp, int disable) err = usbd_abort_pipe(sc->atu_ep[ATU_ENDPT_TX]); if (err) { DPRINTF(("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->atu_dev), usbd_errstr(err))); + sc->atu_dev.dv_xname, usbd_errstr(err))); } err = usbd_close_pipe(sc->atu_ep[ATU_ENDPT_TX]); if (err) { DPRINTF(("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->atu_dev), usbd_errstr(err))); + sc->atu_dev.dv_xname, usbd_errstr(err))); } sc->atu_ep[ATU_ENDPT_TX] = NULL; } diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 9259644bbc5..3787a7c5e94 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aue.c,v 1.60 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_aue.c,v 1.61 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -276,7 +276,7 @@ aue_csr_read_1(struct aue_softc *sc, int reg) if (err) { DPRINTF(("%s: aue_csr_read_1: reg=0x%x err=%s\n", - USBDEVNAME(sc->aue_dev), reg, usbd_errstr(err))); + sc->aue_dev.dv_xname, reg, usbd_errstr(err))); return (0); } @@ -303,7 +303,7 @@ aue_csr_read_2(struct aue_softc *sc, int reg) if (err) { DPRINTF(("%s: aue_csr_read_2: reg=0x%x err=%s\n", - USBDEVNAME(sc->aue_dev), reg, usbd_errstr(err))); + sc->aue_dev.dv_xname, reg, usbd_errstr(err))); return (0); } @@ -331,7 +331,7 @@ aue_csr_write_1(struct aue_softc *sc, int reg, int aval) if (err) { DPRINTF(("%s: aue_csr_write_1: reg=0x%x err=%s\n", - USBDEVNAME(sc->aue_dev), reg, usbd_errstr(err))); + sc->aue_dev.dv_xname, reg, usbd_errstr(err))); return (-1); } @@ -359,7 +359,7 @@ aue_csr_write_2(struct aue_softc *sc, int reg, int aval) if (err) { DPRINTF(("%s: aue_csr_write_2: reg=0x%x err=%s\n", - USBDEVNAME(sc->aue_dev), reg, usbd_errstr(err))); + sc->aue_dev.dv_xname, reg, usbd_errstr(err))); return (-1); } @@ -384,7 +384,7 @@ aue_eeprom_getword(struct aue_softc *sc, int addr) if (i == AUE_TIMEOUT) { printf("%s: EEPROM read timed out\n", - USBDEVNAME(sc->aue_dev)); + sc->aue_dev.dv_xname); } return (aue_csr_read_2(sc, AUE_EE_DATA)); @@ -400,7 +400,7 @@ aue_read_mac(struct aue_softc *sc, u_char *dest) int off = 0; int word; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); for (i = 0; i < 3; i++) { word = aue_eeprom_getword(sc, off + i); @@ -434,7 +434,7 @@ aue_miibus_readreg(device_ptr_t dev, int phy, int reg) if (sc->aue_dying) { #ifdef DIAGNOSTIC - printf("%s: dying\n", USBDEVNAME(sc->aue_dev)); + printf("%s: dying\n", sc->aue_dev.dv_xname); #endif return 0; } @@ -467,13 +467,13 @@ aue_miibus_readreg(device_ptr_t dev, int phy, int reg) } if (i == AUE_TIMEOUT) { - printf("%s: MII read timed out\n", USBDEVNAME(sc->aue_dev)); + printf("%s: MII read timed out\n", sc->aue_dev.dv_xname); } val = aue_csr_read_2(sc, AUE_PHY_DATA); DPRINTFN(11,("%s: %s: phy=%d reg=%d => 0x%04x\n", - USBDEVNAME(sc->aue_dev), __func__, phy, reg, val)); + sc->aue_dev.dv_xname, __func__, phy, reg, val)); aue_unlock_mii(sc); return (val); @@ -494,7 +494,7 @@ aue_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) #endif DPRINTFN(11,("%s: %s: phy=%d reg=%d data=0x%04x\n", - USBDEVNAME(sc->aue_dev), __func__, phy, reg, data)); + sc->aue_dev.dv_xname, __func__, phy, reg, data)); aue_lock_mii(sc); aue_csr_write_2(sc, AUE_PHY_DATA, data); @@ -508,7 +508,7 @@ aue_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) if (i == AUE_TIMEOUT) { printf("%s: MII read timed out\n", - USBDEVNAME(sc->aue_dev)); + sc->aue_dev.dv_xname); } aue_unlock_mii(sc); } @@ -519,7 +519,7 @@ aue_miibus_statchg(device_ptr_t dev) struct aue_softc *sc = USBGETSOFTC(dev); struct mii_data *mii = GET_MII(sc); - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); aue_lock_mii(sc); AUE_CLRBIT(sc, AUE_CTL0, AUE_CTL0_RX_ENB | AUE_CTL0_TX_ENB); @@ -548,7 +548,7 @@ aue_miibus_statchg(device_ptr_t dev) auxmode = aue_miibus_readreg(dev, 0, 0x1b); aue_miibus_writereg(dev, 0, 0x1b, auxmode | 0x04); } - DPRINTFN(5,("%s: %s: exit\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: exit\n", sc->aue_dev.dv_xname, __func__)); } #define AUE_POLY 0xEDB88320 @@ -578,7 +578,7 @@ aue_setmulti(struct aue_softc *sc) struct ether_multistep step; u_int32_t h = 0, i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); ifp = GET_IFP(sc); @@ -629,7 +629,7 @@ aue_reset(struct aue_softc *sc) { int i; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); AUE_SETBIT(sc, AUE_CTL1, AUE_CTL1_RESETMAC); @@ -639,7 +639,7 @@ aue_reset(struct aue_softc *sc) } if (i == AUE_TIMEOUT) - printf("%s: reset failed\n", USBDEVNAME(sc->aue_dev)); + printf("%s: reset failed\n", sc->aue_dev.dv_xname); #if 0 /* XXX what is mii_mode supposed to be */ @@ -715,13 +715,13 @@ aue_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(5,(" : aue_attach: sc=%p", sc)); devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->aue_dev), devinfop); + printf("\n%s: %s\n", sc->aue_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, AUE_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->aue_dev)); + sc->aue_dev.dv_xname); return; } @@ -732,7 +732,7 @@ aue_attach(struct device *parent, struct device *self, void *aux) err = usbd_device2interface_handle(dev, AUE_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->aue_dev)); + sc->aue_dev.dv_xname); return; } @@ -750,7 +750,7 @@ aue_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: couldn't get endpoint descriptor %d\n", - USBDEVNAME(sc->aue_dev), i); + sc->aue_dev.dv_xname, i); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -767,7 +767,7 @@ aue_attach(struct device *parent, struct device *self, void *aux) if (sc->aue_ed[AUE_ENDPT_RX] == 0 || sc->aue_ed[AUE_ENDPT_TX] == 0 || sc->aue_ed[AUE_ENDPT_INTR] == 0) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->aue_dev)); + printf("%s: missing endpoint\n", sc->aue_dev.dv_xname); return; } @@ -786,7 +786,7 @@ aue_attach(struct device *parent, struct device *self, void *aux) * A Pegasus chip was detected. Inform the world. */ ifp = GET_IFP(sc); - printf("%s: address %s\n", USBDEVNAME(sc->aue_dev), + printf("%s: address %s\n", sc->aue_dev.dv_xname, ether_sprintf(eaddr)); bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); @@ -797,7 +797,7 @@ aue_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = aue_ioctl; ifp->if_start = aue_start; ifp->if_watchdog = aue_watchdog; - strlcpy(ifp->if_xname, USBDEVNAME(sc->aue_dev), IFNAMSIZ); + strlcpy(ifp->if_xname, sc->aue_dev.dv_xname, IFNAMSIZ); IFQ_SET_READY(&ifp->if_snd); @@ -837,7 +837,7 @@ aue_detach(struct device *self, int flags) struct ifnet *ifp = GET_IFP(sc); int s; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); if (!sc->aue_attached) { /* Detached before attached finished, so just bail out. */ @@ -867,7 +867,7 @@ aue_detach(struct device *self, int flags) sc->aue_ep[AUE_ENDPT_RX] != NULL || sc->aue_ep[AUE_ENDPT_INTR] != NULL) printf("%s: detach has active endpoints\n", - USBDEVNAME(sc->aue_dev)); + sc->aue_dev.dv_xname); #endif sc->aue_attached = 0; @@ -891,7 +891,7 @@ aue_activate(device_ptr_t self, enum devact act) { struct aue_softc *sc = (struct aue_softc *)self; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); switch (act) { case DVACT_ACTIVATE: @@ -912,20 +912,20 @@ aue_newbuf(struct aue_softc *sc, struct aue_chain *c, struct mbuf *m) { struct mbuf *m_new = NULL; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->aue_dev.dv_xname,__func__)); if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->aue_dev)); + "-- packet dropped!\n", sc->aue_dev.dv_xname); return (ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->aue_dev)); + "-- packet dropped!\n", sc->aue_dev.dv_xname); m_freem(m_new); return (ENOBUFS); } @@ -949,7 +949,7 @@ aue_rx_list_init(struct aue_softc *sc) struct aue_chain *c; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); cd = &sc->aue_cdata; for (i = 0; i < AUE_RX_LIST_CNT; i++) { @@ -978,7 +978,7 @@ aue_tx_list_init(struct aue_softc *sc) struct aue_chain *c; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); cd = &sc->aue_cdata; for (i = 0; i < AUE_TX_LIST_CNT; i++) { @@ -1006,7 +1006,7 @@ aue_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) struct ifnet *ifp = GET_IFP(sc); struct aue_intrpkt *p = &sc->aue_cdata.aue_ibuf; - DPRINTFN(15,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__)); + DPRINTFN(15,("%s: %s: enter\n", sc->aue_dev.dv_xname,__func__)); if (sc->aue_dying) return; @@ -1021,7 +1021,7 @@ aue_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->aue_intr_errs++; if (usbd_ratecheck(&sc->aue_rx_notice)) { printf("%s: %u usb errors on intr: %s\n", - USBDEVNAME(sc->aue_dev), sc->aue_intr_errs, + sc->aue_dev.dv_xname, sc->aue_intr_errs, usbd_errstr(status)); sc->aue_intr_errs = 0; } @@ -1052,7 +1052,7 @@ aue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) struct aue_rxpkt r; int s; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->aue_dev.dv_xname,__func__)); if (sc->aue_dying) return; @@ -1066,7 +1066,7 @@ aue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->aue_rx_errs++; if (usbd_ratecheck(&sc->aue_rx_notice)) { printf("%s: %u usb errors on rx: %s\n", - USBDEVNAME(sc->aue_dev), sc->aue_rx_errs, + sc->aue_dev.dv_xname, sc->aue_rx_errs, usbd_errstr(status)); sc->aue_rx_errs = 0; } @@ -1120,7 +1120,7 @@ aue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif - DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->aue_dev), + DPRINTFN(10,("%s: %s: deliver %d\n", sc->aue_dev.dv_xname, __func__, m->m_len)); IF_INPUT(ifp, m); done1: @@ -1135,7 +1135,7 @@ aue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) USBD_NO_TIMEOUT, aue_rxeof); usbd_transfer(xfer); - DPRINTFN(10,("%s: %s: start rx\n", USBDEVNAME(sc->aue_dev), + DPRINTFN(10,("%s: %s: start rx\n", sc->aue_dev.dv_xname, __func__)); } @@ -1157,7 +1157,7 @@ aue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) s = splnet(); - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->aue_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->aue_dev.dv_xname, __func__, status)); ifp->if_timer = 0; @@ -1169,7 +1169,7 @@ aue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; } ifp->if_oerrors++; - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->aue_dev), + printf("%s: usb error on tx: %s\n", sc->aue_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->aue_ep[AUE_ENDPT_TX]); @@ -1193,7 +1193,7 @@ aue_tick(void *xsc) { struct aue_softc *sc = xsc; - DPRINTFN(15,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__)); + DPRINTFN(15,("%s: %s: enter\n", sc->aue_dev.dv_xname,__func__)); if (sc == NULL) return; @@ -1213,7 +1213,7 @@ aue_tick_task(void *xsc) struct mii_data *mii; int s; - DPRINTFN(15,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__)); + DPRINTFN(15,("%s: %s: enter\n", sc->aue_dev.dv_xname,__func__)); if (sc->aue_dying) return; @@ -1229,7 +1229,7 @@ aue_tick_task(void *xsc) if (!sc->aue_link && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { DPRINTFN(2,("%s: %s: got link\n", - USBDEVNAME(sc->aue_dev),__func__)); + sc->aue_dev.dv_xname,__func__)); sc->aue_link++; if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) aue_start(ifp); @@ -1249,7 +1249,7 @@ aue_send(struct aue_softc *sc, struct mbuf *m, int idx) struct aue_chain *c; usbd_status err; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->aue_dev.dv_xname,__func__)); c = &sc->aue_cdata.aue_tx_chain[idx]; @@ -1277,13 +1277,13 @@ aue_send(struct aue_softc *sc, struct mbuf *m, int idx) /* Transmit */ err = usbd_transfer(c->aue_xfer); if (err != USBD_IN_PROGRESS) { - printf("%s: aue_send error=%s\n", USBDEVNAME(sc->aue_dev), + printf("%s: aue_send error=%s\n", sc->aue_dev.dv_xname, usbd_errstr(err)); /* Stop the interface from process context. */ usb_add_task(sc->aue_udev, &sc->aue_stop_task); return (EIO); } - DPRINTFN(5,("%s: %s: send %d bytes\n", USBDEVNAME(sc->aue_dev), + DPRINTFN(5,("%s: %s: send %d bytes\n", sc->aue_dev.dv_xname, __func__, total_len)); sc->aue_cdata.aue_tx_cnt++; @@ -1297,7 +1297,7 @@ aue_start(struct ifnet *ifp) struct aue_softc *sc = ifp->if_softc; struct mbuf *m_head = NULL; - DPRINTFN(5,("%s: %s: enter, link=%d\n", USBDEVNAME(sc->aue_dev), + DPRINTFN(5,("%s: %s: enter, link=%d\n", sc->aue_dev.dv_xname, __func__, sc->aue_link)); if (sc->aue_dying) @@ -1346,7 +1346,7 @@ aue_init(void *xsc) int i, s; u_char *eaddr; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); if (sc->aue_dying) return; @@ -1373,14 +1373,14 @@ aue_init(void *xsc) /* Init TX ring. */ if (aue_tx_list_init(sc) == ENOBUFS) { - printf("%s: tx list init failed\n", USBDEVNAME(sc->aue_dev)); + printf("%s: tx list init failed\n", sc->aue_dev.dv_xname); splx(s); return; } /* Init RX ring. */ if (aue_rx_list_init(sc) == ENOBUFS) { - printf("%s: rx list init failed\n", USBDEVNAME(sc->aue_dev)); + printf("%s: rx list init failed\n", sc->aue_dev.dv_xname); splx(s); return; } @@ -1424,14 +1424,14 @@ aue_openpipes(struct aue_softc *sc) USBD_EXCLUSIVE_USE, &sc->aue_ep[AUE_ENDPT_RX]); if (err) { printf("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); return (EIO); } err = usbd_open_pipe(sc->aue_iface, sc->aue_ed[AUE_ENDPT_TX], USBD_EXCLUSIVE_USE, &sc->aue_ep[AUE_ENDPT_TX]); if (err) { printf("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); return (EIO); } err = usbd_open_pipe_intr(sc->aue_iface, sc->aue_ed[AUE_ENDPT_INTR], @@ -1440,7 +1440,7 @@ aue_openpipes(struct aue_softc *sc) AUE_INTR_INTERVAL); if (err) { printf("%s: open intr pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); return (EIO); } @@ -1452,7 +1452,7 @@ aue_openpipes(struct aue_softc *sc) USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT, aue_rxeof); (void)usbd_transfer(c->aue_xfer); /* XXX */ - DPRINTFN(5,("%s: %s: start read\n", USBDEVNAME(sc->aue_dev), + DPRINTFN(5,("%s: %s: start read\n", sc->aue_dev.dv_xname, __func__)); } @@ -1468,7 +1468,7 @@ aue_ifmedia_upd(struct ifnet *ifp) struct aue_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); if (sc->aue_dying) return (0); @@ -1494,7 +1494,7 @@ aue_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) struct aue_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; @@ -1590,10 +1590,10 @@ aue_watchdog(struct ifnet *ifp) usbd_status stat; int s; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); ifp->if_oerrors++; - printf("%s: watchdog timeout\n", USBDEVNAME(sc->aue_dev)); + printf("%s: watchdog timeout\n", sc->aue_dev.dv_xname); s = splusb(); c = &sc->aue_cdata.aue_tx_chain[0]; @@ -1629,7 +1629,7 @@ aue_stop(struct aue_softc *sc) struct ifnet *ifp; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->aue_dev.dv_xname, __func__)); ifp = GET_IFP(sc); ifp->if_timer = 0; @@ -1645,12 +1645,12 @@ aue_stop(struct aue_softc *sc) err = usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_RX]); if (err) { printf("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->aue_ep[AUE_ENDPT_RX]); if (err) { printf("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); } sc->aue_ep[AUE_ENDPT_RX] = NULL; } @@ -1659,12 +1659,12 @@ aue_stop(struct aue_softc *sc) err = usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_TX]); if (err) { printf("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->aue_ep[AUE_ENDPT_TX]); if (err) { printf("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); } sc->aue_ep[AUE_ENDPT_TX] = NULL; } @@ -1673,12 +1673,12 @@ aue_stop(struct aue_softc *sc) err = usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_INTR]); if (err) { printf("%s: abort intr pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->aue_ep[AUE_ENDPT_INTR]); if (err) { printf("%s: close intr pipe failed: %s\n", - USBDEVNAME(sc->aue_dev), usbd_errstr(err)); + sc->aue_dev.dv_xname, usbd_errstr(err)); } sc->aue_ep[AUE_ENDPT_INTR] = NULL; } diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index bd5754c561d..e87c2ecef6b 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axe.c,v 1.73 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_axe.c,v 1.74 2007/06/10 14:49:00 mbalmer Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org> @@ -348,7 +348,7 @@ axe_miibus_statchg(device_ptr_t dev) DPRINTF(("axe_miibus_statchg: val=0x%x\n", val)); err = axe_cmd(sc, AXE_CMD_WRITE_MEDIA, 0, val, NULL); if (err) { - printf("%s: media change failed\n", USBDEVNAME(sc->axe_dev)); + printf("%s: media change failed\n", sc->axe_dev.dv_xname); return; } } @@ -569,7 +569,7 @@ axe_attach(struct device *parent, struct device *self, void *aux) struct mii_data *mii; u_char eaddr[ETHER_ADDR_LEN]; char *devinfop; - char *devname = USBDEVNAME(sc->axe_dev); + char *devname = sc->axe_dev.dv_xname; struct ifnet *ifp; int i, s; @@ -606,7 +606,7 @@ axe_attach(struct device *parent, struct device *self, void *aux) id = usbd_get_interface_descriptor(sc->axe_iface); - printf("%s: %s", USBDEVNAME(sc->axe_dev), devinfop); + printf("%s: %s", sc->axe_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); /* decide on what our bufsize will be */ @@ -730,7 +730,7 @@ axe_detach(struct device *self, int flags) int s; struct ifnet *ifp = GET_IFP(sc); - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->axe_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->axe_dev.dv_xname, __func__)); /* Detached before attached finished, so just bail out. */ if (!sc->axe_attached) @@ -776,7 +776,7 @@ axe_detach(struct device *self, int flags) sc->axe_ep[AXE_ENDPT_RX] != NULL || sc->axe_ep[AXE_ENDPT_INTR] != NULL) printf("%s: detach has active endpoints\n", - USBDEVNAME(sc->axe_dev)); + sc->axe_dev.dv_xname); #endif sc->axe_attached = 0; @@ -798,7 +798,7 @@ axe_activate(device_ptr_t self, enum devact act) { struct axe_softc *sc = (struct axe_softc *)self; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->axe_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->axe_dev.dv_xname, __func__)); switch (act) { case DVACT_ACTIVATE: @@ -839,7 +839,7 @@ axe_rx_list_init(struct axe_softc *sc) struct axe_chain *c; int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->axe_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->axe_dev.dv_xname, __func__)); cd = &sc->axe_cdata; for (i = 0; i < AXE_RX_LIST_CNT; i++) { @@ -870,7 +870,7 @@ axe_tx_list_init(struct axe_softc *sc) struct axe_chain *c; int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->axe_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->axe_dev.dv_xname, __func__)); cd = &sc->axe_cdata; for (i = 0; i < AXE_TX_LIST_CNT; i++) { @@ -911,7 +911,7 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) struct axe_sframe_hdr hdr; int s; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->axe_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->axe_dev.dv_xname,__func__)); if (sc->axe_dying) return; @@ -924,7 +924,7 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; if (usbd_ratecheck(&sc->axe_rx_notice)) { printf("%s: usb errors on rx: %s\n", - USBDEVNAME(sc->axe_dev), usbd_errstr(status)); + sc->axe_dev.dv_xname, usbd_errstr(status)); } if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->axe_ep[AXE_ENDPT_RX]); @@ -1004,7 +1004,7 @@ done: USBD_NO_TIMEOUT, axe_rxeof); usbd_transfer(xfer); - DPRINTFN(10,("%s: %s: start rx\n", USBDEVNAME(sc->axe_dev), __func__)); + DPRINTFN(10,("%s: %s: start rx\n", sc->axe_dev.dv_xname, __func__)); return; } @@ -1067,7 +1067,7 @@ axe_tick(void *xsc) if (sc == NULL) return; - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->axe_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->axe_dev.dv_xname, __func__)); if (sc->axe_dying) @@ -1105,7 +1105,7 @@ axe_tick_task(void *xsc) if (!sc->axe_link && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { DPRINTF(("%s: %s: got link\n", - USBDEVNAME(sc->axe_dev), __func__)); + sc->axe_dev.dv_xname, __func__)); sc->axe_link++; if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) axe_start(ifp); diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index 047c75fc455..f620294363f 100644 --- a/sys/dev/usb/if_cdce.c +++ b/sys/dev/usb/if_cdce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cdce.c,v 1.29 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_cdce.c,v 1.30 2007/06/10 14:49:00 mbalmer Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> @@ -149,7 +149,7 @@ cdce_attach(struct device *parent, struct device *self, void *aux) int i, j, numalts; devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->cdce_dev), devinfop); + printf("\n%s: %s\n", sc->cdce_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); sc->cdce_udev = uaa->device; @@ -166,7 +166,7 @@ cdce_attach(struct device *parent, struct device *self, void *aux) UDESCSUB_CDC_UNION); if (ud == NULL) { printf("%s: no union descriptor\n", - USBDEVNAME(sc->cdce_dev)); + sc->cdce_dev.dv_xname); return; } data_ifcno = ud->bSlaveInterface[0]; @@ -185,7 +185,7 @@ cdce_attach(struct device *parent, struct device *self, void *aux) } if (sc->cdce_data_iface == NULL) { - printf("%s: no data interface\n", USBDEVNAME(sc->cdce_dev)); + printf("%s: no data interface\n", sc->cdce_dev.dv_xname); return; } @@ -197,7 +197,7 @@ cdce_attach(struct device *parent, struct device *self, void *aux) for (j = 0; j < numalts; j++) { if (usbd_set_interface(sc->cdce_data_iface, j)) { printf("%s: setting alternate interface failed\n", - USBDEVNAME(sc->cdce_dev)); + sc->cdce_dev.dv_xname); return; } id = usbd_get_interface_descriptor(sc->cdce_data_iface); @@ -206,7 +206,7 @@ cdce_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->cdce_data_iface, i); if (!ed) { printf("%s: could not read endpoint descriptor\n", - USBDEVNAME(sc->cdce_dev)); + sc->cdce_dev.dv_xname); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -221,7 +221,7 @@ cdce_attach(struct device *parent, struct device *self, void *aux) * needed for simple host-to-host applications. */ } else { printf("%s: unexpected endpoint\n", - USBDEVNAME(sc->cdce_dev)); + sc->cdce_dev.dv_xname); } } @@ -229,12 +229,12 @@ cdce_attach(struct device *parent, struct device *self, void *aux) if (sc->cdce_bulkin_no == -1) { printf("%s: could not find data bulk in\n", - USBDEVNAME(sc->cdce_dev)); + sc->cdce_dev.dv_xname); return; } if (sc->cdce_bulkout_no == -1 ) { printf("%s: could not find data bulk out\n", - USBDEVNAME(sc->cdce_dev)); + sc->cdce_dev.dv_xname); return; } @@ -245,7 +245,7 @@ cdce_attach(struct device *parent, struct device *self, void *aux) bcopy(&ticks, &sc->cdce_arpcom.ac_enaddr[2], sizeof(u_int32_t)); sc->cdce_arpcom.ac_enaddr[5] = (u_int8_t)(sc->cdce_unit); - printf("%s: address %s\n", USBDEVNAME(sc->cdce_dev), + printf("%s: address %s\n", sc->cdce_dev.dv_xname, ether_sprintf(sc->cdce_arpcom.ac_enaddr)); ifp = GET_IFP(sc); @@ -254,7 +254,7 @@ cdce_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = cdce_ioctl; ifp->if_start = cdce_start; ifp->if_watchdog = cdce_watchdog; - strlcpy(ifp->if_xname, USBDEVNAME(sc->cdce_dev), IFNAMSIZ); + strlcpy(ifp->if_xname, sc->cdce_dev.dv_xname, IFNAMSIZ); IFQ_SET_READY(&ifp->if_snd); @@ -373,11 +373,11 @@ cdce_stop(struct cdce_softc *sc) err = usbd_abort_pipe(sc->cdce_bulkin_pipe); if (err) printf("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->cdce_dev), usbd_errstr(err)); + sc->cdce_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->cdce_bulkin_pipe); if (err) printf("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->cdce_dev), usbd_errstr(err)); + sc->cdce_dev.dv_xname, usbd_errstr(err)); sc->cdce_bulkin_pipe = NULL; } @@ -385,11 +385,11 @@ cdce_stop(struct cdce_softc *sc) err = usbd_abort_pipe(sc->cdce_bulkout_pipe); if (err) printf("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->cdce_dev), usbd_errstr(err)); + sc->cdce_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->cdce_bulkout_pipe); if (err) printf("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->cdce_dev), usbd_errstr(err)); + sc->cdce_dev.dv_xname, usbd_errstr(err)); sc->cdce_bulkout_pipe = NULL; } @@ -487,7 +487,7 @@ cdce_watchdog(struct ifnet *ifp) return; ifp->if_oerrors++; - printf("%s: watchdog timeout\n", USBDEVNAME(sc->cdce_dev)); + printf("%s: watchdog timeout\n", sc->cdce_dev.dv_xname); } void @@ -505,13 +505,13 @@ cdce_init(void *xsc) s = splnet(); if (cdce_tx_list_init(sc) == ENOBUFS) { - printf("%s: tx list init failed\n", USBDEVNAME(sc->cdce_dev)); + printf("%s: tx list init failed\n", sc->cdce_dev.dv_xname); splx(s); return; } if (cdce_rx_list_init(sc) == ENOBUFS) { - printf("%s: rx list init failed\n", USBDEVNAME(sc->cdce_dev)); + printf("%s: rx list init failed\n", sc->cdce_dev.dv_xname); splx(s); return; } @@ -521,7 +521,7 @@ cdce_init(void *xsc) err = usbd_open_pipe(sc->cdce_data_iface, sc->cdce_bulkin_no, USBD_EXCLUSIVE_USE, &sc->cdce_bulkin_pipe); if (err) { - printf("%s: open rx pipe failed: %s\n", USBDEVNAME(sc->cdce_dev), + printf("%s: open rx pipe failed: %s\n", sc->cdce_dev.dv_xname, usbd_errstr(err)); splx(s); return; @@ -530,7 +530,7 @@ cdce_init(void *xsc) err = usbd_open_pipe(sc->cdce_data_iface, sc->cdce_bulkout_no, USBD_EXCLUSIVE_USE, &sc->cdce_bulkout_pipe); if (err) { - printf("%s: open tx pipe failed: %s\n", USBDEVNAME(sc->cdce_dev), + printf("%s: open tx pipe failed: %s\n", sc->cdce_dev.dv_xname, usbd_errstr(err)); splx(s); return; @@ -559,13 +559,13 @@ cdce_newbuf(struct cdce_softc *sc, struct cdce_chain *c, struct mbuf *m) MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->cdce_dev)); + "-- packet dropped!\n", sc->cdce_dev.dv_xname); return (ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->cdce_dev)); + "-- packet dropped!\n", sc->cdce_dev.dv_xname); m_freem(m_new); return (ENOBUFS); } @@ -652,13 +652,13 @@ cdce_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; if (sc->cdce_rxeof_errors == 0) printf("%s: usb error on rx: %s\n", - USBDEVNAME(sc->cdce_dev), usbd_errstr(status)); + sc->cdce_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->cdce_bulkin_pipe); DELAY(sc->cdce_rxeof_errors * 10000); if (sc->cdce_rxeof_errors++ > 10) { printf("%s: too many errors, disabling\n", - USBDEVNAME(sc->cdce_dev)); + sc->cdce_dev.dv_xname); sc->cdce_dying = 1; return; } @@ -734,7 +734,7 @@ cdce_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; } ifp->if_oerrors++; - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->cdce_dev), + printf("%s: usb error on tx: %s\n", sc->cdce_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->cdce_bulkout_pipe); diff --git a/sys/dev/usb/if_cdcef.c b/sys/dev/usb/if_cdcef.c index 5eea6ae4091..4d3a50421e9 100644 --- a/sys/dev/usb/if_cdcef.c +++ b/sys/dev/usb/if_cdcef.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cdcef.c,v 1.14 2007/05/27 10:24:51 jsg Exp $ */ +/* $OpenBSD: if_cdcef.c,v 1.15 2007/06/10 14:49:00 mbalmer Exp $ */ /* * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org> @@ -123,7 +123,7 @@ struct usbf_function_methods cdcef_methods = { #define DPRINTF(x) printf x #endif -#define DEVNAME(sc) USBDEVNAME((sc)->sc_dev.bdev) +#define DEVNAME(sc) ((sc)->sc_dev.bdev.dv_xname) /* * USB function match/attach/detach diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 2d3fa098922..5bce284aff4 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cue.c,v 1.40 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_cue.c,v 1.41 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -165,12 +165,12 @@ cue_csr_read_1(struct cue_softc *sc, int reg) if (err) { DPRINTF(("%s: cue_csr_read_1: reg=0x%x err=%s\n", - USBDEVNAME(sc->cue_dev), reg, usbd_errstr(err))); + sc->cue_dev.dv_xname, reg, usbd_errstr(err))); return (0); } DPRINTFN(10,("%s: cue_csr_read_1 reg=0x%x val=0x%x\n", - USBDEVNAME(sc->cue_dev), reg, val)); + sc->cue_dev.dv_xname, reg, val)); return (val); } @@ -194,11 +194,11 @@ cue_csr_read_2(struct cue_softc *sc, int reg) err = usbd_do_request(sc->cue_udev, &req, &val); DPRINTFN(10,("%s: cue_csr_read_2 reg=0x%x val=0x%x\n", - USBDEVNAME(sc->cue_dev), reg, UGETW(val))); + sc->cue_dev.dv_xname, reg, UGETW(val))); if (err) { DPRINTF(("%s: cue_csr_read_2: reg=0x%x err=%s\n", - USBDEVNAME(sc->cue_dev), reg, usbd_errstr(err))); + sc->cue_dev.dv_xname, reg, usbd_errstr(err))); return (0); } @@ -215,7 +215,7 @@ cue_csr_write_1(struct cue_softc *sc, int reg, int val) return (0); DPRINTFN(10,("%s: cue_csr_write_1 reg=0x%x val=0x%x\n", - USBDEVNAME(sc->cue_dev), reg, val)); + sc->cue_dev.dv_xname, reg, val)); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = CUE_CMD_WRITEREG; @@ -227,12 +227,12 @@ cue_csr_write_1(struct cue_softc *sc, int reg, int val) if (err) { DPRINTF(("%s: cue_csr_write_1: reg=0x%x err=%s\n", - USBDEVNAME(sc->cue_dev), reg, usbd_errstr(err))); + sc->cue_dev.dv_xname, reg, usbd_errstr(err))); return (-1); } DPRINTFN(20,("%s: cue_csr_write_1, after reg=0x%x val=0x%x\n", - USBDEVNAME(sc->cue_dev), reg, cue_csr_read_1(sc, reg))); + sc->cue_dev.dv_xname, reg, cue_csr_read_1(sc, reg))); return (0); } @@ -250,7 +250,7 @@ cue_csr_write_2(struct cue_softc *sc, int reg, int aval) return (0); DPRINTFN(10,("%s: cue_csr_write_2 reg=0x%x val=0x%x\n", - USBDEVNAME(sc->cue_dev), reg, aval)); + sc->cue_dev.dv_xname, reg, aval)); USETW(val, aval); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -263,7 +263,7 @@ cue_csr_write_2(struct cue_softc *sc, int reg, int aval) if (err) { DPRINTF(("%s: cue_csr_write_2: reg=0x%x err=%s\n", - USBDEVNAME(sc->cue_dev), reg, usbd_errstr(err))); + sc->cue_dev.dv_xname, reg, usbd_errstr(err))); return (-1); } @@ -278,7 +278,7 @@ cue_mem(struct cue_softc *sc, int cmd, int addr, void *buf, int len) usbd_status err; DPRINTFN(10,("%s: cue_mem cmd=0x%x addr=0x%x len=%d\n", - USBDEVNAME(sc->cue_dev), cmd, addr, len)); + sc->cue_dev.dv_xname, cmd, addr, len)); if (cmd == CUE_CMD_READSRAM) req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -293,7 +293,7 @@ cue_mem(struct cue_softc *sc, int cmd, int addr, void *buf, int len) if (err) { DPRINTF(("%s: cue_csr_mem: addr=0x%x err=%s\n", - USBDEVNAME(sc->cue_dev), addr, usbd_errstr(err))); + sc->cue_dev.dv_xname, addr, usbd_errstr(err))); return (-1); } @@ -306,7 +306,7 @@ cue_getmac(struct cue_softc *sc, void *buf) usb_device_request_t req; usbd_status err; - DPRINTFN(10,("%s: cue_getmac\n", USBDEVNAME(sc->cue_dev))); + DPRINTFN(10,("%s: cue_getmac\n", sc->cue_dev.dv_xname)); req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = CUE_CMD_GET_MACADDR; @@ -318,7 +318,7 @@ cue_getmac(struct cue_softc *sc, void *buf) if (err) { printf("%s: read MAC address failed\n", - USBDEVNAME(sc->cue_dev)); + sc->cue_dev.dv_xname); return (-1); } @@ -338,7 +338,7 @@ cue_setmulti(struct cue_softc *sc) ifp = GET_IFP(sc); DPRINTFN(2,("%s: cue_setmulti if_flags=0x%x\n", - USBDEVNAME(sc->cue_dev), ifp->if_flags)); + sc->cue_dev.dv_xname, ifp->if_flags)); if (ifp->if_flags & IFF_PROMISC) { allmulti: @@ -389,7 +389,7 @@ cue_reset(struct cue_softc *sc) usb_device_request_t req; usbd_status err; - DPRINTFN(2,("%s: cue_reset\n", USBDEVNAME(sc->cue_dev))); + DPRINTFN(2,("%s: cue_reset\n", sc->cue_dev.dv_xname)); if (sc->cue_dying) return; @@ -403,7 +403,7 @@ cue_reset(struct cue_softc *sc) err = usbd_do_request(sc->cue_udev, &req, NULL); if (err) - printf("%s: reset failed\n", USBDEVNAME(sc->cue_dev)); + printf("%s: reset failed\n", sc->cue_dev.dv_xname); /* Wait a little while for the chip to get its brains in order. */ usbd_delay_ms(sc->cue_udev, 1); @@ -447,13 +447,13 @@ cue_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(5,(" : cue_attach: sc=%p, dev=%p", sc, dev)); devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->cue_dev), devinfop); + printf("\n%s: %s\n", sc->cue_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, CUE_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->cue_dev)); + sc->cue_dev.dv_xname); return; } @@ -467,7 +467,7 @@ cue_attach(struct device *parent, struct device *self, void *aux) err = usbd_device2interface_handle(dev, CUE_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->cue_dev)); + sc->cue_dev.dv_xname); return; } @@ -479,7 +479,7 @@ cue_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: couldn't get ep %d\n", - USBDEVNAME(sc->cue_dev), i); + sc->cue_dev.dv_xname, i); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -508,7 +508,7 @@ cue_attach(struct device *parent, struct device *self, void *aux) /* * A CATC chip was detected. Inform the world. */ - printf("%s: address %s\n", USBDEVNAME(sc->cue_dev), + printf("%s: address %s\n", sc->cue_dev.dv_xname, ether_sprintf(eaddr)); bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); @@ -520,7 +520,7 @@ cue_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = cue_ioctl; ifp->if_start = cue_start; ifp->if_watchdog = cue_watchdog; - strlcpy(ifp->if_xname, USBDEVNAME(sc->cue_dev), IFNAMSIZ); + strlcpy(ifp->if_xname, sc->cue_dev.dv_xname, IFNAMSIZ); IFQ_SET_READY(&ifp->if_snd); @@ -544,7 +544,7 @@ cue_detach(struct device *self, int flags) struct ifnet *ifp = GET_IFP(sc); int s; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->cue_dev.dv_xname, __func__)); timeout_del(&sc->cue_stat_ch); /* @@ -573,7 +573,7 @@ cue_detach(struct device *self, int flags) sc->cue_ep[CUE_ENDPT_RX] != NULL || sc->cue_ep[CUE_ENDPT_INTR] != NULL) printf("%s: detach has active endpoints\n", - USBDEVNAME(sc->cue_dev)); + sc->cue_dev.dv_xname); #endif sc->cue_attached = 0; @@ -590,7 +590,7 @@ cue_activate(device_ptr_t self, enum devact act) { struct cue_softc *sc = (struct cue_softc *)self; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->cue_dev.dv_xname, __func__)); switch (act) { case DVACT_ACTIVATE: @@ -615,14 +615,14 @@ cue_newbuf(struct cue_softc *sc, struct cue_chain *c, struct mbuf *m) MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->cue_dev)); + "-- packet dropped!\n", sc->cue_dev.dv_xname); return (ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->cue_dev)); + "-- packet dropped!\n", sc->cue_dev.dv_xname); m_freem(m_new); return (ENOBUFS); } @@ -711,7 +711,7 @@ cue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) u_int16_t len; int s; - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->cue_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->cue_dev.dv_xname, __func__, status)); if (sc->cue_dying) @@ -726,7 +726,7 @@ cue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->cue_rx_errs++; if (usbd_ratecheck(&sc->cue_rx_notice)) { printf("%s: %u usb errors on rx: %s\n", - USBDEVNAME(sc->cue_dev), sc->cue_rx_errs, + sc->cue_dev.dv_xname, sc->cue_rx_errs, usbd_errstr(status)); sc->cue_rx_errs = 0; } @@ -775,7 +775,7 @@ cue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif - DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->cue_dev), + DPRINTFN(10,("%s: %s: deliver %d\n", sc->cue_dev.dv_xname, __func__, m->m_len)); IF_INPUT(ifp, m); done1: @@ -788,7 +788,7 @@ done: USBD_NO_TIMEOUT, cue_rxeof); usbd_transfer(c->cue_xfer); - DPRINTFN(10,("%s: %s: start rx\n", USBDEVNAME(sc->cue_dev), + DPRINTFN(10,("%s: %s: start rx\n", sc->cue_dev.dv_xname, __func__)); } @@ -809,7 +809,7 @@ cue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) s = splnet(); - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->cue_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->cue_dev.dv_xname, __func__, status)); ifp->if_timer = 0; @@ -821,7 +821,7 @@ cue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; } ifp->if_oerrors++; - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->cue_dev), + printf("%s: usb error on tx: %s\n", sc->cue_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->cue_ep[CUE_ENDPT_TX]); @@ -851,7 +851,7 @@ cue_tick(void *xsc) if (sc->cue_dying) return; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->cue_dev.dv_xname, __func__)); /* Perform statistics update in process context. */ usb_add_task(sc->cue_udev, &sc->cue_tick_task); @@ -866,7 +866,7 @@ cue_tick_task(void *xsc) if (sc->cue_dying) return; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->cue_dev.dv_xname, __func__)); ifp = GET_IFP(sc); @@ -897,7 +897,7 @@ cue_send(struct cue_softc *sc, struct mbuf *m, int idx) total_len = m->m_pkthdr.len + 2; DPRINTFN(10,("%s: %s: total_len=%d\n", - USBDEVNAME(sc->cue_dev), __func__, total_len)); + sc->cue_dev.dv_xname, __func__, total_len)); /* The first two bytes are the frame length */ c->cue_buf[0] = (u_int8_t)m->m_pkthdr.len; @@ -910,7 +910,7 @@ cue_send(struct cue_softc *sc, struct mbuf *m, int idx) /* Transmit */ err = usbd_transfer(c->cue_xfer); if (err != USBD_IN_PROGRESS) { - printf("%s: cue_send error=%s\n", USBDEVNAME(sc->cue_dev), + printf("%s: cue_send error=%s\n", sc->cue_dev.dv_xname, usbd_errstr(err)); /* Stop the interface from process context. */ usb_add_task(sc->cue_udev, &sc->cue_stop_task); @@ -931,7 +931,7 @@ cue_start(struct ifnet *ifp) if (sc->cue_dying) return; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->cue_dev.dv_xname,__func__)); if (ifp->if_flags & IFF_OACTIVE) return; @@ -975,7 +975,7 @@ cue_init(void *xsc) if (sc->cue_dying) return; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->cue_dev.dv_xname,__func__)); if (ifp->if_flags & IFF_RUNNING) return; @@ -1006,14 +1006,14 @@ cue_init(void *xsc) /* Init TX ring. */ if (cue_tx_list_init(sc) == ENOBUFS) { - printf("%s: tx list init failed\n", USBDEVNAME(sc->cue_dev)); + printf("%s: tx list init failed\n", sc->cue_dev.dv_xname); splx(s); return; } /* Init RX ring. */ if (cue_rx_list_init(sc) == ENOBUFS) { - printf("%s: rx list init failed\n", USBDEVNAME(sc->cue_dev)); + printf("%s: rx list init failed\n", sc->cue_dev.dv_xname); splx(s); return; } @@ -1064,14 +1064,14 @@ cue_open_pipes(struct cue_softc *sc) USBD_EXCLUSIVE_USE, &sc->cue_ep[CUE_ENDPT_RX]); if (err) { printf("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->cue_dev), usbd_errstr(err)); + sc->cue_dev.dv_xname, usbd_errstr(err)); return (EIO); } err = usbd_open_pipe(sc->cue_iface, sc->cue_ed[CUE_ENDPT_TX], USBD_EXCLUSIVE_USE, &sc->cue_ep[CUE_ENDPT_TX]); if (err) { printf("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->cue_dev), usbd_errstr(err)); + sc->cue_dev.dv_xname, usbd_errstr(err)); return (EIO); } @@ -1177,13 +1177,13 @@ cue_watchdog(struct ifnet *ifp) usbd_status stat; int s; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev),__func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->cue_dev.dv_xname,__func__)); if (sc->cue_dying) return; ifp->if_oerrors++; - printf("%s: watchdog timeout\n", USBDEVNAME(sc->cue_dev)); + printf("%s: watchdog timeout\n", sc->cue_dev.dv_xname); s = splusb(); c = &sc->cue_cdata.cue_tx_chain[0]; @@ -1206,7 +1206,7 @@ cue_stop(struct cue_softc *sc) struct ifnet *ifp; int i; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->cue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->cue_dev.dv_xname,__func__)); ifp = GET_IFP(sc); ifp->if_timer = 0; @@ -1221,12 +1221,12 @@ cue_stop(struct cue_softc *sc) err = usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_RX]); if (err) { printf("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->cue_dev), usbd_errstr(err)); + sc->cue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->cue_ep[CUE_ENDPT_RX]); if (err) { printf("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->cue_dev), usbd_errstr(err)); + sc->cue_dev.dv_xname, usbd_errstr(err)); } sc->cue_ep[CUE_ENDPT_RX] = NULL; } @@ -1235,12 +1235,12 @@ cue_stop(struct cue_softc *sc) err = usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_TX]); if (err) { printf("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->cue_dev), usbd_errstr(err)); + sc->cue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->cue_ep[CUE_ENDPT_TX]); if (err) { printf("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->cue_dev), usbd_errstr(err)); + sc->cue_dev.dv_xname, usbd_errstr(err)); } sc->cue_ep[CUE_ENDPT_TX] = NULL; } @@ -1249,12 +1249,12 @@ cue_stop(struct cue_softc *sc) err = usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_INTR]); if (err) { printf("%s: abort intr pipe failed: %s\n", - USBDEVNAME(sc->cue_dev), usbd_errstr(err)); + sc->cue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->cue_ep[CUE_ENDPT_INTR]); if (err) { printf("%s: close intr pipe failed: %s\n", - USBDEVNAME(sc->cue_dev), usbd_errstr(err)); + sc->cue_dev.dv_xname, usbd_errstr(err)); } sc->cue_ep[CUE_ENDPT_INTR] = NULL; } diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index bcfc72a52d1..45321dfa60e 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_kue.c,v 1.51 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_kue.c,v 1.52 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -183,7 +183,7 @@ kue_setword(struct kue_softc *sc, u_int8_t breq, u_int16_t word) { usb_device_request_t req; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = breq; @@ -200,7 +200,7 @@ kue_ctl(struct kue_softc *sc, int rw, u_int8_t breq, u_int16_t val, { usb_device_request_t req; - DPRINTFN(10,("%s: %s: enter, len=%d\n", USBDEVNAME(sc->kue_dev), + DPRINTFN(10,("%s: %s: enter, len=%d\n", sc->kue_dev.dv_xname, __func__, len)); if (rw == KUE_CTL_WRITE) @@ -225,7 +225,7 @@ kue_load_fw(struct kue_softc *sc) u_char *buf; size_t buflen; - DPRINTFN(1,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev), __func__)); + DPRINTFN(1,("%s: %s: enter\n", sc->kue_dev.dv_xname, __func__)); /* * First, check if we even need to load the firmware. @@ -245,54 +245,54 @@ kue_load_fw(struct kue_softc *sc) return (EIO); if (UGETW(dd.bcdDevice) >= KUE_WARM_REV) { printf("%s: warm boot, no firmware download\n", - USBDEVNAME(sc->kue_dev)); + sc->kue_dev.dv_xname); return (0); } err = loadfirmware("kue", &buf, &buflen); if (err) { printf("%s: failed loadfirmware of file %s: errno %d\n", - USBDEVNAME(sc->kue_dev), "kue", err); + sc->kue_dev.dv_xname, "kue", err); return (err); } fw = (struct kue_firmware *)buf; printf("%s: cold boot, downloading firmware\n", - USBDEVNAME(sc->kue_dev)); + sc->kue_dev.dv_xname); /* Load code segment */ DPRINTFN(1,("%s: kue_load_fw: download code_seg\n", - USBDEVNAME(sc->kue_dev))); + sc->kue_dev.dv_xname)); err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN, 0, (void *)&fw->data[0], ntohl(fw->codeseglen)); if (err) { printf("%s: failed to load code segment: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); free(buf, M_DEVBUF); return (EIO); } /* Load fixup segment */ DPRINTFN(1,("%s: kue_load_fw: download fix_seg\n", - USBDEVNAME(sc->kue_dev))); + sc->kue_dev.dv_xname)); err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN, 0, (void *)&fw->data[ntohl(fw->codeseglen)], ntohl(fw->fixseglen)); if (err) { printf("%s: failed to load fixup segment: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); free(buf, M_DEVBUF); return (EIO); } /* Send trigger command. */ DPRINTFN(1,("%s: kue_load_fw: download trig_seg\n", - USBDEVNAME(sc->kue_dev))); + sc->kue_dev.dv_xname)); err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN, 0, (void *)&fw->data[ntohl(fw->codeseglen) + ntohl(fw->fixseglen)], ntohl(fw->trigseglen)); if (err) { printf("%s: failed to load trigger segment: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); free(buf, M_DEVBUF); return (EIO); } @@ -310,7 +310,7 @@ kue_load_fw(struct kue_softc *sc) */ (void)usbd_reload_device_desc(sc->kue_udev); - DPRINTFN(1,("%s: %s: done\n", USBDEVNAME(sc->kue_dev), __func__)); + DPRINTFN(1,("%s: %s: done\n", sc->kue_dev.dv_xname, __func__)); /* Reset the adapter. */ kue_reset(sc); @@ -326,7 +326,7 @@ kue_setmulti(struct kue_softc *sc) struct ether_multistep step; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname, __func__)); if (ifp->if_flags & IFF_PROMISC) { allmulti: @@ -369,12 +369,12 @@ allmulti: void kue_reset(struct kue_softc *sc) { - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname, __func__)); if (usbd_set_config_no(sc->kue_udev, KUE_CONFIG_NO, 1) || usbd_device2interface_handle(sc->kue_udev, KUE_IFACE_IDX, &sc->kue_iface)) - printf("%s: reset failed\n", USBDEVNAME(sc->kue_dev)); + printf("%s: reset failed\n", sc->kue_dev.dv_xname); /* Wait a little while for the chip to get its brains in order. */ usbd_delay_ms(sc->kue_udev, 10); @@ -413,14 +413,14 @@ kue_attachhook(void *xsc) /* Load the firmware into the NIC. */ if (kue_load_fw(sc)) { printf("%s: loading firmware failed\n", - USBDEVNAME(sc->kue_dev)); + sc->kue_dev.dv_xname); return; } err = usbd_device2interface_handle(dev, KUE_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->kue_dev)); + sc->kue_dev.dv_xname); return; } @@ -432,7 +432,7 @@ kue_attachhook(void *xsc) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: couldn't get ep %d\n", - USBDEVNAME(sc->kue_dev), i); + sc->kue_dev.dv_xname, i); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -448,7 +448,7 @@ kue_attachhook(void *xsc) } if (sc->kue_ed[KUE_ENDPT_RX] == 0 || sc->kue_ed[KUE_ENDPT_TX] == 0) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->kue_dev)); + printf("%s: missing endpoint\n", sc->kue_dev.dv_xname); return; } @@ -457,7 +457,7 @@ kue_attachhook(void *xsc) 0, &sc->kue_desc, sizeof(sc->kue_desc)); if (err) { printf("%s: could not read Ethernet descriptor\n", - USBDEVNAME(sc->kue_dev)); + sc->kue_dev.dv_xname); return; } @@ -465,7 +465,7 @@ kue_attachhook(void *xsc) M_USBDEV, M_NOWAIT); if (sc->kue_mcfilters == NULL) { printf("%s: no memory for multicast filter buffer\n", - USBDEVNAME(sc->kue_dev)); + sc->kue_dev.dv_xname); return; } @@ -474,7 +474,7 @@ kue_attachhook(void *xsc) /* * A KLSI chip was detected. Inform the world. */ - printf("%s: address %s\n", USBDEVNAME(sc->kue_dev), + printf("%s: address %s\n", sc->kue_dev.dv_xname, ether_sprintf(sc->kue_desc.kue_macaddr)); bcopy(sc->kue_desc.kue_macaddr, @@ -487,7 +487,7 @@ kue_attachhook(void *xsc) ifp->if_ioctl = kue_ioctl; ifp->if_start = kue_start; ifp->if_watchdog = kue_watchdog; - strlcpy(ifp->if_xname, USBDEVNAME(sc->kue_dev), IFNAMSIZ); + strlcpy(ifp->if_xname, sc->kue_dev.dv_xname, IFNAMSIZ); IFQ_SET_READY(&ifp->if_snd); @@ -516,13 +516,13 @@ kue_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(5,(" : kue_attach: sc=%p, dev=%p", sc, dev)); devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->kue_dev), devinfop); + printf("\n%s: %s\n", sc->kue_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, KUE_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->kue_dev)); + sc->kue_dev.dv_xname); return; } @@ -571,7 +571,7 @@ kue_detach(struct device *self, int flags) sc->kue_ep[KUE_ENDPT_RX] != NULL || sc->kue_ep[KUE_ENDPT_INTR] != NULL) printf("%s: detach has active endpoints\n", - USBDEVNAME(sc->kue_dev)); + sc->kue_dev.dv_xname); #endif sc->kue_attached = 0; @@ -585,7 +585,7 @@ kue_activate(device_ptr_t self, enum devact act) { struct kue_softc *sc = (struct kue_softc *)self; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->kue_dev.dv_xname, __func__)); switch (act) { case DVACT_ACTIVATE: @@ -606,20 +606,20 @@ kue_newbuf(struct kue_softc *sc, struct kue_chain *c, struct mbuf *m) { struct mbuf *m_new = NULL; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->kue_dev)); + "-- packet dropped!\n", sc->kue_dev.dv_xname); return (ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->kue_dev)); + "-- packet dropped!\n", sc->kue_dev.dv_xname); m_freem(m_new); return (ENOBUFS); } @@ -642,7 +642,7 @@ kue_rx_list_init(struct kue_softc *sc) struct kue_chain *c; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname, __func__)); cd = &sc->kue_cdata; for (i = 0; i < KUE_RX_LIST_CNT; i++) { @@ -671,7 +671,7 @@ kue_tx_list_init(struct kue_softc *sc) struct kue_chain *c; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname, __func__)); cd = &sc->kue_cdata; for (i = 0; i < KUE_TX_LIST_CNT; i++) { @@ -706,7 +706,7 @@ kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) int total_len = 0; int s; - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->kue_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->kue_dev.dv_xname, __func__, status)); if (sc->kue_dying) @@ -721,7 +721,7 @@ kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->kue_rx_errs++; if (usbd_ratecheck(&sc->kue_rx_notice)) { printf("%s: %u usb errors on rx: %s\n", - USBDEVNAME(sc->kue_dev), sc->kue_rx_errs, + sc->kue_dev.dv_xname, sc->kue_rx_errs, usbd_errstr(status)); sc->kue_rx_errs = 0; } @@ -732,7 +732,7 @@ kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL); - DPRINTFN(10,("%s: %s: total_len=%d len=%d\n", USBDEVNAME(sc->kue_dev), + DPRINTFN(10,("%s: %s: total_len=%d len=%d\n", sc->kue_dev.dv_xname, __func__, total_len, UGETW(mtod(c->kue_mbuf, u_int8_t *)))); @@ -776,7 +776,7 @@ kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif - DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->kue_dev), + DPRINTFN(10,("%s: %s: deliver %d\n", sc->kue_dev.dv_xname, __func__, m->m_len)); IF_INPUT(ifp, m); done1: @@ -790,7 +790,7 @@ kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) USBD_NO_TIMEOUT, kue_rxeof); usbd_transfer(c->kue_xfer); - DPRINTFN(10,("%s: %s: start rx\n", USBDEVNAME(sc->kue_dev), + DPRINTFN(10,("%s: %s: start rx\n", sc->kue_dev.dv_xname, __func__)); } @@ -812,7 +812,7 @@ kue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) s = splnet(); - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->kue_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->kue_dev.dv_xname, __func__, status)); ifp->if_timer = 0; @@ -824,7 +824,7 @@ kue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; } ifp->if_oerrors++; - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->kue_dev), + printf("%s: usb error on tx: %s\n", sc->kue_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->kue_ep[KUE_ENDPT_TX]); @@ -850,7 +850,7 @@ kue_send(struct kue_softc *sc, struct mbuf *m, int idx) struct kue_chain *c; usbd_status err; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); c = &sc->kue_cdata.kue_tx_chain[idx]; @@ -876,7 +876,7 @@ kue_send(struct kue_softc *sc, struct mbuf *m, int idx) /* Transmit */ err = usbd_transfer(c->kue_xfer); if (err != USBD_IN_PROGRESS) { - printf("%s: kue_send error=%s\n", USBDEVNAME(sc->kue_dev), + printf("%s: kue_send error=%s\n", sc->kue_dev.dv_xname, usbd_errstr(err)); kue_stop(sc); return (EIO); @@ -893,7 +893,7 @@ kue_start(struct ifnet *ifp) struct kue_softc *sc = ifp->if_softc; struct mbuf *m_head = NULL; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); if (sc->kue_dying) return; @@ -937,7 +937,7 @@ kue_init(void *xsc) int s; u_char *eaddr; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); if (ifp->if_flags & IFF_RUNNING) return; @@ -968,14 +968,14 @@ kue_init(void *xsc) /* Init TX ring. */ if (kue_tx_list_init(sc) == ENOBUFS) { - printf("%s: tx list init failed\n", USBDEVNAME(sc->kue_dev)); + printf("%s: tx list init failed\n", sc->kue_dev.dv_xname); splx(s); return; } /* Init RX ring. */ if (kue_rx_list_init(sc) == ENOBUFS) { - printf("%s: rx list init failed\n", USBDEVNAME(sc->kue_dev)); + printf("%s: rx list init failed\n", sc->kue_dev.dv_xname); splx(s); return; } @@ -1003,14 +1003,14 @@ kue_open_pipes(struct kue_softc *sc) struct kue_chain *c; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); /* Open RX and TX pipes. */ err = usbd_open_pipe(sc->kue_iface, sc->kue_ed[KUE_ENDPT_RX], USBD_EXCLUSIVE_USE, &sc->kue_ep[KUE_ENDPT_RX]); if (err) { printf("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); return (EIO); } @@ -1018,7 +1018,7 @@ kue_open_pipes(struct kue_softc *sc) USBD_EXCLUSIVE_USE, &sc->kue_ep[KUE_ENDPT_TX]); if (err) { printf("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); return (EIO); } @@ -1029,7 +1029,7 @@ kue_open_pipes(struct kue_softc *sc) c, c->kue_buf, KUE_BUFSZ, USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT, kue_rxeof); - DPRINTFN(5,("%s: %s: start read\n", USBDEVNAME(sc->kue_dev), + DPRINTFN(5,("%s: %s: start read\n", sc->kue_dev.dv_xname, __func__)); usbd_transfer(c->kue_xfer); } @@ -1045,14 +1045,14 @@ kue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); if (sc->kue_dying) return (EIO); #ifdef DIAGNOSTIC if (!curproc) { - printf("%s: no proc!!\n", USBDEVNAME(sc->kue_dev)); + printf("%s: no proc!!\n", sc->kue_dev.dv_xname); return EIO; } #endif @@ -1137,13 +1137,13 @@ kue_watchdog(struct ifnet *ifp) usbd_status stat; int s; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); if (sc->kue_dying) return; ifp->if_oerrors++; - printf("%s: watchdog timeout\n", USBDEVNAME(sc->kue_dev)); + printf("%s: watchdog timeout\n", sc->kue_dev.dv_xname); s = splusb(); c = &sc->kue_cdata.kue_tx_chain[0]; @@ -1166,7 +1166,7 @@ kue_stop(struct kue_softc *sc) struct ifnet *ifp; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->kue_dev),__func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname,__func__)); ifp = GET_IFP(sc); ifp->if_timer = 0; @@ -1177,12 +1177,12 @@ kue_stop(struct kue_softc *sc) err = usbd_abort_pipe(sc->kue_ep[KUE_ENDPT_RX]); if (err) { printf("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->kue_ep[KUE_ENDPT_RX]); if (err) { printf("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); } sc->kue_ep[KUE_ENDPT_RX] = NULL; } @@ -1191,12 +1191,12 @@ kue_stop(struct kue_softc *sc) err = usbd_abort_pipe(sc->kue_ep[KUE_ENDPT_TX]); if (err) { printf("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->kue_ep[KUE_ENDPT_TX]); if (err) { printf("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); } sc->kue_ep[KUE_ENDPT_TX] = NULL; } @@ -1205,12 +1205,12 @@ kue_stop(struct kue_softc *sc) err = usbd_abort_pipe(sc->kue_ep[KUE_ENDPT_INTR]); if (err) { printf("%s: abort intr pipe failed: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->kue_ep[KUE_ENDPT_INTR]); if (err) { printf("%s: close intr pipe failed: %s\n", - USBDEVNAME(sc->kue_dev), usbd_errstr(err)); + sc->kue_dev.dv_xname, usbd_errstr(err)); } sc->kue_ep[KUE_ENDPT_INTR] = NULL; } diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index febbaabab03..f75a39586c9 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.96 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_ral.c,v 1.97 2007/06/10 14:49:00 mbalmer Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -219,12 +219,12 @@ ural_attach(struct device *parent, struct device *self, void *aux) sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); if (usbd_set_config_no(sc->sc_udev, RAL_CONFIG_NO, 0) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -233,7 +233,7 @@ ural_attach(struct device *parent, struct device *self, void *aux) &sc->sc_iface); if (error != 0) { printf("%s: could not get interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -247,7 +247,7 @@ ural_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for iface %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return; } @@ -259,7 +259,7 @@ ural_attach(struct device *parent, struct device *self, void *aux) sc->sc_tx_no = ed->bEndpointAddress; } if (sc->sc_rx_no == -1 || sc->sc_tx_no == -1) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); return; } @@ -277,7 +277,7 @@ ural_attach(struct device *parent, struct device *self, void *aux) ural_read_eeprom(sc); printf("%s: MAC/BBP RT%04x (rev 0x%02x), RF %s, address %s\n", - USBDEVNAME(sc->sc_dev), sc->macbbp_rev, sc->asic_rev, + sc->sc_dev.dv_xname, sc->macbbp_rev, sc->asic_rev, ural_get_rf(sc->rf_rev), ether_sprintf(ic->ic_myaddr)); ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ @@ -314,7 +314,7 @@ ural_attach(struct device *parent, struct device *self, void *aux) ifp->if_start = ural_start; ifp->if_watchdog = ural_watchdog; IFQ_SET_READY(&ifp->if_snd); - memcpy(ifp->if_xname, USBDEVNAME(sc->sc_dev), IFNAMSIZ); + memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); if_attach(ifp); ieee80211_ifattach(ifp); @@ -399,7 +399,7 @@ ural_alloc_tx_list(struct ural_softc *sc) data->xfer = usbd_alloc_xfer(sc->sc_udev); if (data->xfer == NULL) { printf("%s: could not allocate tx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -407,7 +407,7 @@ ural_alloc_tx_list(struct ural_softc *sc) RAL_TX_DESC_SIZE + IEEE80211_MAX_LEN); if (data->buf == NULL) { printf("%s: could not allocate tx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -452,13 +452,13 @@ ural_alloc_rx_list(struct ural_softc *sc) data->xfer = usbd_alloc_xfer(sc->sc_udev); if (data->xfer == NULL) { printf("%s: could not allocate rx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } if (usbd_alloc_buffer(data->xfer, MCLBYTES) == NULL) { printf("%s: could not allocate rx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -466,14 +466,14 @@ ural_alloc_rx_list(struct ural_softc *sc) MGETHDR(data->m, M_DONTWAIT, MT_DATA); if (data->m == NULL) { printf("%s: could not allocate rx mbuf\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } MCLGET(data->m, M_DONTWAIT); if (!(data->m->m_flags & M_EXT)) { printf("%s: could not allocate rx mbuf cluster\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -587,14 +587,14 @@ ural_task(void *arg) m = ieee80211_beacon_alloc(ic, ni); if (m == NULL) { printf("%s: could not allocate beacon\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } if (ural_tx_bcn(sc, m, ni) != 0) { m_freem(m); printf("%s: could not transmit beacon\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -663,7 +663,7 @@ ural_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; printf("%s: could not transmit buffer: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(status)); + sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_tx_pipeh); @@ -714,7 +714,7 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL); if (len < RAL_RX_DESC_SIZE + IEEE80211_MIN_LEN) { - DPRINTF(("%s: xfer too short %d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: xfer too short %d\n", sc->sc_dev.dv_xname, len)); ifp->if_ierrors++; goto skip; @@ -736,14 +736,14 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) MGETHDR(mnew, M_DONTWAIT, MT_DATA); if (mnew == NULL) { printf("%s: could not allocate rx mbuf\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); ifp->if_ierrors++; goto skip; } MCLGET(mnew, M_DONTWAIT); if (!(mnew->m_flags & M_EXT)) { printf("%s: could not allocate rx mbuf cluster\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); m_freem(mnew); ifp->if_ierrors++; goto skip; @@ -1285,7 +1285,7 @@ ural_watchdog(struct ifnet *ifp) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { - printf("%s: device timeout\n", USBDEVNAME(sc->sc_dev)); + printf("%s: device timeout\n", sc->sc_dev.dv_xname); /*ural_init(ifp); XXX needs a process context! */ ifp->if_oerrors++; return; @@ -1386,7 +1386,7 @@ ural_eeprom_read(struct ural_softc *sc, uint16_t addr, void *buf, int len) error = usbd_do_request(sc->sc_udev, &req, buf); if (error != 0) { printf("%s: could not read EEPROM: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } } @@ -1406,7 +1406,7 @@ ural_read(struct ural_softc *sc, uint16_t reg) error = usbd_do_request(sc->sc_udev, &req, &val); if (error != 0) { printf("%s: could not read MAC register: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); return 0; } return letoh16(val); @@ -1427,7 +1427,7 @@ ural_read_multi(struct ural_softc *sc, uint16_t reg, void *buf, int len) error = usbd_do_request(sc->sc_udev, &req, buf); if (error != 0) { printf("%s: could not read MAC register: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } } @@ -1446,7 +1446,7 @@ ural_write(struct ural_softc *sc, uint16_t reg, uint16_t val) error = usbd_do_request(sc->sc_udev, &req, NULL); if (error != 0) { printf("%s: could not write MAC register: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } } @@ -1465,7 +1465,7 @@ ural_write_multi(struct ural_softc *sc, uint16_t reg, void *buf, int len) error = usbd_do_request(sc->sc_udev, &req, buf); if (error != 0) { printf("%s: could not write MAC register: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } } @@ -1480,7 +1480,7 @@ ural_bbp_write(struct ural_softc *sc, uint8_t reg, uint8_t val) break; } if (ntries == 5) { - printf("%s: could not write to BBP\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not write to BBP\n", sc->sc_dev.dv_xname); return; } @@ -1502,7 +1502,7 @@ ural_bbp_read(struct ural_softc *sc, uint8_t reg) break; } if (ntries == 5) { - printf("%s: could not read BBP\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not read BBP\n", sc->sc_dev.dv_xname); return 0; } return ural_read(sc, RAL_PHY_CSR7) & 0xff; @@ -1519,7 +1519,7 @@ ural_rf_write(struct ural_softc *sc, uint8_t reg, uint32_t val) break; } if (ntries == 5) { - printf("%s: could not write to RF\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not write to RF\n", sc->sc_dev.dv_xname); return; } @@ -1833,7 +1833,7 @@ ural_bbp_init(struct ural_softc *sc) DELAY(1000); } if (ntries == 100) { - printf("%s: timeout waiting for BBP\n", USBDEVNAME(sc->sc_dev)); + printf("%s: timeout waiting for BBP\n", sc->sc_dev.dv_xname); return EIO; } @@ -1929,7 +1929,7 @@ ural_init(struct ifnet *ifp) } if (ntries == 100) { printf("%s: timeout waiting for BBP/RF to wakeup\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = EIO; goto fail; } @@ -1975,7 +1975,7 @@ ural_init(struct ifnet *ifp) sc->amrr_xfer = usbd_alloc_xfer(sc->sc_udev); if (sc->amrr_xfer == NULL) { printf("%s: could not allocate AMRR xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -1986,14 +1986,14 @@ ural_init(struct ifnet *ifp) &sc->sc_tx_pipeh); if (error != 0) { printf("%s: could not open Tx pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } error = usbd_open_pipe(sc->sc_iface, sc->sc_rx_no, USBD_EXCLUSIVE_USE, &sc->sc_rx_pipeh); if (error != 0) { printf("%s: could not open Rx pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -2003,13 +2003,13 @@ ural_init(struct ifnet *ifp) error = ural_alloc_tx_list(sc); if (error != 0) { printf("%s: could not allocate Tx list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } error = ural_alloc_rx_list(sc); if (error != 0) { printf("%s: could not allocate Rx list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -2024,7 +2024,7 @@ ural_init(struct ifnet *ifp) error = usbd_transfer(data->xfer); if (error != 0 && error != USBD_IN_PROGRESS) { printf("%s: could not queue Rx transfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } } @@ -2154,7 +2154,7 @@ ural_amrr_update(usbd_xfer_handle xfer, usbd_private_handle priv, if (status != USBD_NORMAL_COMPLETION) { printf("%s: could not retrieve Tx statistics - cancelling " - "automatic rate control\n", USBDEVNAME(sc->sc_dev)); + "automatic rate control\n", sc->sc_dev.dv_xname); return; } diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 04bcf57fba6..d3aa9b5c747 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.61 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_rum.c,v 1.62 2007/06/10 14:49:00 mbalmer Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr> @@ -232,13 +232,13 @@ rum_attachhook(void *xsc) if ((error = loadfirmware(name, &ucode, &size)) != 0) { printf("%s: failed loadfirmware of file %s (error %d)\n", - USBDEVNAME(sc->sc_dev), name, error); + sc->sc_dev.dv_xname, name, error); return; } if (rum_load_microcode(sc, ucode, size) != 0) { printf("%s: could not load 8051 microcode\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); } free(ucode, M_DEVBUF); @@ -261,12 +261,12 @@ rum_attach(struct device *parent, struct device *self, void *aux) sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); if (usbd_set_config_no(sc->sc_udev, RT2573_CONFIG_NO, 0) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -275,7 +275,7 @@ rum_attach(struct device *parent, struct device *self, void *aux) &sc->sc_iface); if (error != 0) { printf("%s: could not get interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -289,7 +289,7 @@ rum_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for iface %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return; } @@ -301,7 +301,7 @@ rum_attach(struct device *parent, struct device *self, void *aux) sc->sc_tx_no = ed->bEndpointAddress; } if (sc->sc_rx_no == -1 || sc->sc_tx_no == -1) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); return; } @@ -320,7 +320,7 @@ rum_attach(struct device *parent, struct device *self, void *aux) } if (ntries == 1000) { printf("%s: timeout waiting for chip to settle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -328,7 +328,7 @@ rum_attach(struct device *parent, struct device *self, void *aux) rum_read_eeprom(sc); printf("%s: MAC/BBP RT%04x (rev 0x%05x), RF %s, address %s\n", - USBDEVNAME(sc->sc_dev), sc->macbbp_rev, tmp, + sc->sc_dev.dv_xname, sc->macbbp_rev, tmp, rum_get_rf(sc->rf_rev), ether_sprintf(ic->ic_myaddr)); if (rootvp == NULL) @@ -398,7 +398,7 @@ rum_attach(struct device *parent, struct device *self, void *aux) ifp->if_start = rum_start; ifp->if_watchdog = rum_watchdog; IFQ_SET_READY(&ifp->if_snd); - memcpy(ifp->if_xname, USBDEVNAME(sc->sc_dev), IFNAMSIZ); + memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); if_attach(ifp); ieee80211_ifattach(ifp); @@ -481,7 +481,7 @@ rum_alloc_tx_list(struct rum_softc *sc) data->xfer = usbd_alloc_xfer(sc->sc_udev); if (data->xfer == NULL) { printf("%s: could not allocate tx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -489,7 +489,7 @@ rum_alloc_tx_list(struct rum_softc *sc) RT2573_TX_DESC_SIZE + IEEE80211_MAX_LEN); if (data->buf == NULL) { printf("%s: could not allocate tx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -536,13 +536,13 @@ rum_alloc_rx_list(struct rum_softc *sc) data->xfer = usbd_alloc_xfer(sc->sc_udev); if (data->xfer == NULL) { printf("%s: could not allocate rx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } if (usbd_alloc_buffer(data->xfer, MCLBYTES) == NULL) { printf("%s: could not allocate rx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -550,14 +550,14 @@ rum_alloc_rx_list(struct rum_softc *sc) MGETHDR(data->m, M_DONTWAIT, MT_DATA); if (data->m == NULL) { printf("%s: could not allocate rx mbuf\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } MCLGET(data->m, M_DONTWAIT); if (!(data->m->m_flags & M_EXT)) { printf("%s: could not allocate rx mbuf cluster\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -722,7 +722,7 @@ rum_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; printf("%s: could not transmit buffer: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(status)); + sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_tx_pipeh); @@ -773,7 +773,7 @@ rum_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL); if (len < RT2573_RX_DESC_SIZE + sizeof (struct ieee80211_frame_min)) { - DPRINTF(("%s: xfer too short %d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: xfer too short %d\n", sc->sc_dev.dv_xname, len)); ifp->if_ierrors++; goto skip; @@ -794,14 +794,14 @@ rum_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) MGETHDR(mnew, M_DONTWAIT, MT_DATA); if (mnew == NULL) { printf("%s: could not allocate rx mbuf\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); ifp->if_ierrors++; goto skip; } MCLGET(mnew, M_DONTWAIT); if (!(mnew->m_flags & M_EXT)) { printf("%s: could not allocate rx mbuf cluster\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); m_freem(mnew); ifp->if_ierrors++; goto skip; @@ -1293,7 +1293,7 @@ rum_watchdog(struct ifnet *ifp) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { - printf("%s: device timeout\n", USBDEVNAME(sc->sc_dev)); + printf("%s: device timeout\n", sc->sc_dev.dv_xname); /*rum_init(ifp); XXX needs a process context! */ ifp->if_oerrors++; return; @@ -1394,7 +1394,7 @@ rum_eeprom_read(struct rum_softc *sc, uint16_t addr, void *buf, int len) error = usbd_do_request(sc->sc_udev, &req, buf); if (error != 0) { printf("%s: could not read EEPROM: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } } @@ -1423,7 +1423,7 @@ rum_read_multi(struct rum_softc *sc, uint16_t reg, void *buf, int len) error = usbd_do_request(sc->sc_udev, &req, buf); if (error != 0) { printf("%s: could not multi read MAC register: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } } @@ -1450,7 +1450,7 @@ rum_write_multi(struct rum_softc *sc, uint16_t reg, void *buf, size_t len) error = usbd_do_request(sc->sc_udev, &req, buf); if (error != 0) { printf("%s: could not multi write MAC register: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } } @@ -1465,7 +1465,7 @@ rum_bbp_write(struct rum_softc *sc, uint8_t reg, uint8_t val) break; } if (ntries == 5) { - printf("%s: could not write to BBP\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not write to BBP\n", sc->sc_dev.dv_xname); return; } @@ -1484,7 +1484,7 @@ rum_bbp_read(struct rum_softc *sc, uint8_t reg) break; } if (ntries == 5) { - printf("%s: could not read BBP\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not read BBP\n", sc->sc_dev.dv_xname); return 0; } @@ -1498,7 +1498,7 @@ rum_bbp_read(struct rum_softc *sc, uint8_t reg) DELAY(1); } - printf("%s: could not read BBP\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not read BBP\n", sc->sc_dev.dv_xname); return 0; } @@ -1513,7 +1513,7 @@ rum_rf_write(struct rum_softc *sc, uint8_t reg, uint32_t val) break; } if (ntries == 5) { - printf("%s: could not write to RF\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not write to RF\n", sc->sc_dev.dv_xname); return; } @@ -1911,7 +1911,7 @@ rum_bbp_init(struct rum_softc *sc) } if (ntries == 100) { printf("%s: timeout waiting for BBP\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return EIO; } @@ -1959,7 +1959,7 @@ rum_init(struct ifnet *ifp) } if (ntries == 1000) { printf("%s: timeout waiting for BBP/RF to wakeup\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -1987,7 +1987,7 @@ rum_init(struct ifnet *ifp) sc->amrr_xfer = usbd_alloc_xfer(sc->sc_udev); if (sc->amrr_xfer == NULL) { printf("%s: could not allocate AMRR xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -1998,14 +1998,14 @@ rum_init(struct ifnet *ifp) &sc->sc_tx_pipeh); if (error != 0) { printf("%s: could not open Tx pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } error = usbd_open_pipe(sc->sc_iface, sc->sc_rx_no, USBD_EXCLUSIVE_USE, &sc->sc_rx_pipeh); if (error != 0) { printf("%s: could not open Rx pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -2015,13 +2015,13 @@ rum_init(struct ifnet *ifp) error = rum_alloc_tx_list(sc); if (error != 0) { printf("%s: could not allocate Tx list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } error = rum_alloc_rx_list(sc); if (error != 0) { printf("%s: could not allocate Rx list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -2036,7 +2036,7 @@ rum_init(struct ifnet *ifp) error = usbd_transfer(data->xfer); if (error != 0 && error != USBD_IN_PROGRESS) { printf("%s: could not queue Rx transfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } } @@ -2126,7 +2126,7 @@ rum_load_microcode(struct rum_softc *sc, const u_char *ucode, size_t size) error = usbd_do_request(sc->sc_udev, &req, NULL); if (error != 0) { printf("%s: could not run firmware: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } return error; } @@ -2220,7 +2220,7 @@ rum_amrr_update(usbd_xfer_handle xfer, usbd_private_handle priv, if (status != USBD_NORMAL_COMPLETION) { printf("%s: could not retrieve Tx statistics - cancelling " - "automatic rate control\n", USBDEVNAME(sc->sc_dev)); + "automatic rate control\n", sc->sc_dev.dv_xname); return; } diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index e97e5010467..aaa6ad808c6 100644 --- a/sys/dev/usb/if_uath.c +++ b/sys/dev/usb/if_uath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uath.c,v 1.23 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_uath.c,v 1.24 2007/06/10 14:49:00 mbalmer Exp $ */ /*- * Copyright (c) 2006 @@ -210,7 +210,7 @@ uath_attachhook(void *xsc) if ((error = loadfirmware("uath-ar5523", &fw, &size)) != 0) { printf("%s: could not read firmware (error=%d)\n", - USBDEVNAME(sc->sc_dev), error); + sc->sc_dev.dv_xname, error); return; } @@ -229,7 +229,7 @@ uath_attachhook(void *xsc) usb_needs_reattach(sc->sc_udev); } else { printf("%s: could not load firmware (error=%s)\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); } } @@ -249,14 +249,14 @@ uath_attach(struct device *parent, struct device *self, void *aux) sc->sc_port = uaa->port; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); sc->sc_flags = uath_lookup(uaa->vendor, uaa->product)->flags; if (usbd_set_config_no(sc->sc_udev, UATH_CONFIG_NO, 0) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -265,7 +265,7 @@ uath_attach(struct device *parent, struct device *self, void *aux) &sc->sc_iface); if (error != 0) { printf("%s: could not get interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -274,7 +274,7 @@ uath_attach(struct device *parent, struct device *self, void *aux) * firmware (pre-firmware devices) or to send firmware commands. */ if (uath_open_pipes(sc) != 0) { - printf("%s: could not open pipes\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not open pipes\n", sc->sc_dev.dv_xname); return; } @@ -298,12 +298,12 @@ uath_attach(struct device *parent, struct device *self, void *aux) */ if (uath_alloc_tx_cmd_list(sc) != 0) { printf("%s: could not allocate Tx command list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail1; } if (uath_alloc_rx_cmd_list(sc) != 0) { printf("%s: could not allocate Rx command list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail2; } @@ -319,7 +319,7 @@ uath_attach(struct device *parent, struct device *self, void *aux) error = usbd_transfer(cmd->xfer); if (error != USBD_IN_PROGRESS && error != 0) { printf("%s: could not queue Rx command xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail3; } } @@ -329,16 +329,16 @@ uath_attach(struct device *parent, struct device *self, void *aux) */ if (uath_reset(sc) != 0) { printf("%s: could not initialize adapter\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail3; } if (uath_query_eeprom(sc) != 0) { - printf("%s: could not read EEPROM\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not read EEPROM\n", sc->sc_dev.dv_xname); goto fail3; } printf("%s: MAC/BBP AR5523, RF AR%c112, address %s\n", - USBDEVNAME(sc->sc_dev), (sc->sc_flags & UATH_FLAG_ABG) ? '5': '2', + sc->sc_dev.dv_xname, (sc->sc_flags & UATH_FLAG_ABG) ? '5': '2', ether_sprintf(ic->ic_myaddr)); /* @@ -346,12 +346,12 @@ uath_attach(struct device *parent, struct device *self, void *aux) */ if (uath_alloc_tx_data_list(sc) != 0) { printf("%s: could not allocate Tx data list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail3; } if (uath_alloc_rx_data_list(sc) != 0) { printf("%s: could not allocate Rx data list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail4; } @@ -386,7 +386,7 @@ uath_attach(struct device *parent, struct device *self, void *aux) ifp->if_start = uath_start; ifp->if_watchdog = uath_watchdog; IFQ_SET_READY(&ifp->if_snd); - memcpy(ifp->if_xname, USBDEVNAME(sc->sc_dev), IFNAMSIZ); + memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); if_attach(ifp); ieee80211_ifattach(ifp); @@ -481,7 +481,7 @@ uath_open_pipes(struct uath_softc *sc) &sc->cmd_tx_pipe); if (error != 0) { printf("%s: could not open Tx command pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -489,7 +489,7 @@ uath_open_pipes(struct uath_softc *sc) &sc->data_tx_pipe); if (error != 0) { printf("%s: could not open Tx data pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -497,7 +497,7 @@ uath_open_pipes(struct uath_softc *sc) &sc->cmd_rx_pipe); if (error != 0) { printf("%s: could not open Rx command pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -505,7 +505,7 @@ uath_open_pipes(struct uath_softc *sc) &sc->data_rx_pipe); if (error != 0) { printf("%s: could not open Rx data pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -546,14 +546,14 @@ uath_alloc_tx_data_list(struct uath_softc *sc) data->xfer = usbd_alloc_xfer(sc->sc_udev); if (data->xfer == NULL) { printf("%s: could not allocate xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } data->buf = usbd_alloc_buffer(data->xfer, UATH_MAX_TXBUFSZ); if (data->buf == NULL) { printf("%s: could not allocate xfer buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -591,14 +591,14 @@ uath_alloc_rx_data_list(struct uath_softc *sc) data->xfer = usbd_alloc_xfer(sc->sc_udev); if (data->xfer == NULL) { printf("%s: could not allocate xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } data->buf = usbd_alloc_buffer(data->xfer, sc->rxbufsz); if (data->buf == NULL) { printf("%s: could not allocate xfer buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -650,14 +650,14 @@ uath_alloc_tx_cmd_list(struct uath_softc *sc) cmd->xfer = usbd_alloc_xfer(sc->sc_udev); if (cmd->xfer == NULL) { printf("%s: could not allocate xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } cmd->buf = usbd_alloc_buffer(cmd->xfer, UATH_MAX_TXCMDSZ); if (cmd->buf == NULL) { printf("%s: could not allocate xfer buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -694,14 +694,14 @@ uath_alloc_rx_cmd_list(struct uath_softc *sc) cmd->xfer = usbd_alloc_xfer(sc->sc_udev); if (cmd->xfer == NULL) { printf("%s: could not allocate xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } cmd->buf = usbd_alloc_buffer(cmd->xfer, UATH_MAX_RXCMDSZ); if (cmd->buf == NULL) { printf("%s: could not allocate xfer buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -758,7 +758,7 @@ uath_stat(void *arg) UATH_CMD_FLAG_ASYNC); if (error != 0) { printf("%s: could not query statistics (error=%d)\n", - USBDEVNAME(sc->sc_dev), error); + sc->sc_dev.dv_xname, error); } } @@ -798,7 +798,7 @@ uath_task(void *arg) case IEEE80211_S_SCAN: if (uath_switch_channel(sc, ic->ic_bss->ni_chan) != 0) { printf("%s: could not switch channel\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); break; } timeout_add(&sc->scan_to, hz / 4); @@ -813,7 +813,7 @@ uath_task(void *arg) if (uath_switch_channel(sc, ni->ni_chan) != 0) { printf("%s: could not switch channel\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); break; } @@ -838,7 +838,7 @@ uath_task(void *arg) if (uath_set_rates(sc, &ni->ni_rates) != 0) { printf("%s: could not set negotiated rate set\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); break; } break; @@ -988,7 +988,7 @@ uath_cmd(struct uath_softc *sc, uint32_t code, const void *idata, int ilen, if (flags & UATH_CMD_FLAG_READ) splx(s); printf("%s: could not send command 0x%x (error=%s)\n", - USBDEVNAME(sc->sc_dev), code, usbd_errstr(error)); + sc->sc_dev.dv_xname, code, usbd_errstr(error)); return error; } sc->cmd_idx = (sc->cmd_idx + 1) % UATH_TX_CMD_LIST_COUNT; @@ -1002,7 +1002,7 @@ uath_cmd(struct uath_softc *sc, uint32_t code, const void *idata, int ilen, splx(s); if (error != 0) { printf("%s: timeout waiting for command reply\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); } return error; } @@ -1037,7 +1037,7 @@ uath_write_reg(struct uath_softc *sc, uint32_t reg, uint32_t val) 3 * sizeof (uint32_t), 0); if (error != 0) { printf("%s: could not write register 0x%02x\n", - USBDEVNAME(sc->sc_dev), reg); + sc->sc_dev.dv_xname, reg); } return error; } @@ -1058,7 +1058,7 @@ uath_write_multi(struct uath_softc *sc, uint32_t reg, const void *data, (len == 0) ? sizeof (uint32_t) : 2 * sizeof (uint32_t) + len, 0); if (error != 0) { printf("%s: could not write %d bytes to register 0x%02x\n", - USBDEVNAME(sc->sc_dev), len, reg); + sc->sc_dev.dv_xname, len, reg); } return error; } @@ -1074,7 +1074,7 @@ uath_read_reg(struct uath_softc *sc, uint32_t reg, uint32_t *val) 0); if (error != 0) { printf("%s: could not read register 0x%02x\n", - USBDEVNAME(sc->sc_dev), betoh32(reg)); + sc->sc_dev.dv_xname, betoh32(reg)); return error; } *val = betoh32(*(uint32_t *)read.data); @@ -1092,7 +1092,7 @@ uath_read_eeprom(struct uath_softc *sc, uint32_t reg, void *odata) &read, 0); if (error != 0) { printf("%s: could not read EEPROM offset 0x%02x\n", - USBDEVNAME(sc->sc_dev), betoh32(reg)); + sc->sc_dev.dv_xname, betoh32(reg)); return error; } len = betoh32(read.len); @@ -1220,7 +1220,7 @@ uath_data_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, ndata = SLIST_FIRST(&sc->rx_freelist); if (ndata == NULL) { printf("%s: could not allocate Rx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); m_freem(m); ifp->if_ierrors++; goto skip; @@ -1333,7 +1333,7 @@ uath_data_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, return; printf("%s: could not transmit buffer: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(status)); + sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->data_tx_pipe); @@ -1539,7 +1539,7 @@ uath_watchdog(struct ifnet *ifp) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { - printf("%s: device timeout\n", USBDEVNAME(sc->sc_dev)); + printf("%s: device timeout\n", sc->sc_dev.dv_xname); /*uath_init(ifp); XXX needs a process context! */ ifp->if_oerrors++; return; @@ -1616,7 +1616,7 @@ uath_query_eeprom(struct uath_softc *sc) error = uath_read_eeprom(sc, UATH_EEPROM_MACADDR, sc->sc_ic.ic_myaddr); if (error != 0) { printf("%s: could not read MAC address\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return error; } @@ -1624,7 +1624,7 @@ uath_query_eeprom(struct uath_softc *sc) error = uath_read_eeprom(sc, UATH_EEPROM_RXBUFSZ, &tmp); if (error != 0) { printf("%s: could not read maximum Rx buffer size\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return error; } sc->rxbufsz = betoh32(tmp) & 0xfff; @@ -1830,28 +1830,28 @@ uath_switch_channel(struct uath_softc *sc, struct ieee80211_channel *c) /* set radio frequency */ if ((error = uath_set_chan(sc, c)) != 0) { - printf("%s: could not set channel\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not set channel\n", sc->sc_dev.dv_xname); return error; } /* reset Tx rings */ if ((error = uath_reset_tx_queues(sc)) != 0) { printf("%s: could not reset Tx queues\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return error; } /* set Tx rings WME properties */ if ((error = uath_wme_init(sc)) != 0) { printf("%s: could not init Tx queues\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return error; } val = htobe32(0); error = uath_cmd_write(sc, UATH_CMD_SET_STATE, &val, sizeof val, 0); if (error != 0) { - printf("%s: could not set state\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not set state\n", sc->sc_dev.dv_xname); return error; } @@ -1894,7 +1894,7 @@ uath_init(struct ifnet *ifp) error = usbd_transfer(data->xfer); if (error != USBD_IN_PROGRESS && error != 0) { printf("%s: could not queue Rx transfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } SLIST_REMOVE_HEAD(&sc->rx_freelist, next); @@ -1904,7 +1904,7 @@ uath_init(struct ifnet *ifp) UATH_CMD_FLAG_MAGIC); if (error != 0) { printf("%s: could not send read command 07h\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } DPRINTF(("command 07h return code: %x\n", betoh32(val))); @@ -1912,13 +1912,13 @@ uath_init(struct ifnet *ifp) /* set default channel */ ic->ic_bss->ni_chan = ic->ic_ibss_chan; if ((error = uath_set_chan(sc, ic->ic_bss->ni_chan)) != 0) { - printf("%s: could not set channel\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not set channel\n", sc->sc_dev.dv_xname); goto fail; } if ((error = uath_wme_init(sc)) != 0) { printf("%s: could not setup WME parameters\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -1941,7 +1941,7 @@ uath_init(struct ifnet *ifp) if ((error = uath_set_keys(sc)) != 0) { printf("%s: could not set crypto keys\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -2019,42 +2019,42 @@ uath_loadfirmware(struct uath_softc *sc, const u_char *fw, int len) if ((ctlxfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) { printf("%s: could not allocate Tx control xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = USBD_NOMEM; goto fail1; } txblock = usbd_alloc_buffer(ctlxfer, sizeof (struct uath_fwblock)); if (txblock == NULL) { printf("%s: could not allocate Tx control block\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = USBD_NOMEM; goto fail2; } if ((txxfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) { printf("%s: could not allocate Tx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = USBD_NOMEM; goto fail2; } txdata = usbd_alloc_buffer(txxfer, UATH_MAX_FWBLOCK_SIZE); if (txdata == NULL) { printf("%s: could not allocate Tx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = USBD_NOMEM; goto fail3; } if ((rxxfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) { printf("%s: could not allocate Rx control xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = USBD_NOMEM; goto fail3; } rxblock = usbd_alloc_buffer(rxxfer, sizeof (struct uath_fwblock)); if (rxblock == NULL) { printf("%s: could not allocate Rx control block\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = USBD_NOMEM; goto fail4; } @@ -2078,7 +2078,7 @@ uath_loadfirmware(struct uath_softc *sc, const u_char *fw, int len) UATH_CMD_TIMEOUT, NULL); if ((error = usbd_sync_transfer(ctlxfer)) != 0) { printf("%s: could not send firmware block info\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); break; } @@ -2088,7 +2088,7 @@ uath_loadfirmware(struct uath_softc *sc, const u_char *fw, int len) USBD_NO_COPY, UATH_DATA_TIMEOUT, NULL); if ((error = usbd_sync_transfer(txxfer)) != 0) { printf("%s: could not send firmware block data\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); break; } @@ -2098,7 +2098,7 @@ uath_loadfirmware(struct uath_softc *sc, const u_char *fw, int len) USBD_NO_COPY, UATH_CMD_TIMEOUT, NULL); if ((error = usbd_sync_transfer(rxxfer)) != 0) { printf("%s: could not read firmware answer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); break; } diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index d1d3c382af6..1d9e91ab40d 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_udav.c,v 1.29 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_udav.c,v 1.30 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: if_udav.c,v 1.3 2004/04/23 17:25:25 itojun Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* @@ -180,7 +180,7 @@ udav_attach(struct device *parent, struct device *self, void *aux) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfop; - char *devname = USBDEVNAME(sc->sc_dev); + char *devname = sc->sc_dev.dv_xname; struct ifnet *ifp; struct mii_data *mii; u_char eaddr[ETHER_ADDR_LEN]; @@ -311,7 +311,7 @@ udav_detach(struct device *self, int flags) struct ifnet *ifp = GET_IFP(sc); int s; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); /* Detached before attached finished */ if (!sc->sc_attached) @@ -340,13 +340,13 @@ udav_detach(struct device *self, int flags) #ifdef DIAGNOSTIC if (sc->sc_pipe_tx != NULL) printf("%s: detach has active tx endpoint.\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); if (sc->sc_pipe_rx != NULL) printf("%s: detach has active rx endpoint.\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); if (sc->sc_pipe_intr != NULL) printf("%s: detach has active intr endpoint.\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); #endif sc->sc_attached = 0; @@ -370,7 +370,7 @@ udav_mem_read(struct udav_softc *sc, int offset, void *buf, int len) return (0); DPRINTFN(0x200, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -390,7 +390,7 @@ udav_mem_read(struct udav_softc *sc, int offset, void *buf, int len) usb_detach_wakeup(&sc->sc_dev); if (err) { DPRINTF(("%s: %s: read failed. off=%04x, err=%d\n", - USBDEVNAME(sc->sc_dev), __func__, offset, err)); + sc->sc_dev.dv_xname, __func__, offset, err)); } return (err); @@ -407,7 +407,7 @@ udav_mem_write(struct udav_softc *sc, int offset, void *buf, int len) return (0); DPRINTFN(0x200, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -427,7 +427,7 @@ udav_mem_write(struct udav_softc *sc, int offset, void *buf, int len) usb_detach_wakeup(&sc->sc_dev); if (err) { DPRINTF(("%s: %s: write failed. off=%04x, err=%d\n", - USBDEVNAME(sc->sc_dev), __func__, offset, err)); + sc->sc_dev.dv_xname, __func__, offset, err)); } return (err); @@ -444,7 +444,7 @@ udav_mem_write1(struct udav_softc *sc, int offset, unsigned char ch) return (0); DPRINTFN(0x200, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -463,7 +463,7 @@ udav_mem_write1(struct udav_softc *sc, int offset, unsigned char ch) usb_detach_wakeup(&sc->sc_dev); if (err) { DPRINTF(("%s: %s: write failed. off=%04x, err=%d\n", - USBDEVNAME(sc->sc_dev), __func__, offset, err)); + sc->sc_dev.dv_xname, __func__, offset, err)); } return (err); @@ -481,7 +481,7 @@ udav_csr_read(struct udav_softc *sc, int offset, void *buf, int len) return (0); DPRINTFN(0x200, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -501,7 +501,7 @@ udav_csr_read(struct udav_softc *sc, int offset, void *buf, int len) usb_detach_wakeup(&sc->sc_dev); if (err) { DPRINTF(("%s: %s: read failed. off=%04x, err=%d\n", - USBDEVNAME(sc->sc_dev), __func__, offset, err)); + sc->sc_dev.dv_xname, __func__, offset, err)); } return (err); @@ -518,7 +518,7 @@ udav_csr_write(struct udav_softc *sc, int offset, void *buf, int len) return (0); DPRINTFN(0x200, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -538,7 +538,7 @@ udav_csr_write(struct udav_softc *sc, int offset, void *buf, int len) usb_detach_wakeup(&sc->sc_dev); if (err) { DPRINTF(("%s: %s: write failed. off=%04x, err=%d\n", - USBDEVNAME(sc->sc_dev), __func__, offset, err)); + sc->sc_dev.dv_xname, __func__, offset, err)); } return (err); @@ -553,7 +553,7 @@ udav_csr_read1(struct udav_softc *sc, int offset) return (0); DPRINTFN(0x200, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -572,7 +572,7 @@ udav_csr_write1(struct udav_softc *sc, int offset, unsigned char ch) return (0); DPRINTFN(0x200, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -591,7 +591,7 @@ udav_csr_write1(struct udav_softc *sc, int offset, unsigned char ch) usb_detach_wakeup(&sc->sc_dev); if (err) { DPRINTF(("%s: %s: write failed. off=%04x, err=%d\n", - USBDEVNAME(sc->sc_dev), __func__, offset, err)); + sc->sc_dev.dv_xname, __func__, offset, err)); } return (err); @@ -605,7 +605,7 @@ udav_init(struct ifnet *ifp) u_char *eaddr; int s; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (EIO); @@ -633,14 +633,14 @@ udav_init(struct ifnet *ifp) /* Initialize transmit ring */ if (udav_tx_list_init(sc) == ENOBUFS) { - printf("%s: tx list init failed\n", USBDEVNAME(sc->sc_dev)); + printf("%s: tx list init failed\n", sc->sc_dev.dv_xname); splx(s); return (EIO); } /* Initialize receive ring */ if (udav_rx_list_init(sc) == ENOBUFS) { - printf("%s: rx list init failed\n", USBDEVNAME(sc->sc_dev)); + printf("%s: rx list init failed\n", sc->sc_dev.dv_xname); splx(s); return (EIO); } @@ -681,7 +681,7 @@ udav_reset(struct udav_softc *sc) { int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return; @@ -716,7 +716,7 @@ udav_activate(device_ptr_t self, enum devact act) { struct udav_softc *sc = (struct udav_softc *)self; - DPRINTF(("%s: %s: enter, act=%d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: enter, act=%d\n", sc->sc_dev.dv_xname, __func__, act)); switch (act) { case DVACT_ACTIVATE: @@ -743,7 +743,7 @@ udav_setmulti(struct udav_softc *sc) u_int8_t hashes[8]; int h = 0; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return; @@ -804,7 +804,7 @@ udav_openpipes(struct udav_softc *sc) USBD_EXCLUSIVE_USE, &sc->sc_pipe_rx); if (err) { printf("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -814,7 +814,7 @@ udav_openpipes(struct udav_softc *sc) USBD_EXCLUSIVE_USE, &sc->sc_pipe_tx); if (err) { printf("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -828,7 +828,7 @@ udav_openpipes(struct udav_softc *sc) udav_intr, UDAV_INTR_INTERVAL); if (err) { printf("%s: open intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -843,7 +843,7 @@ udav_openpipes(struct udav_softc *sc) USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT, udav_rxeof); (void)usbd_transfer(c->udav_xfer); - DPRINTF(("%s: %s: start read\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: start read\n", sc->sc_dev.dv_xname, __func__)); } @@ -859,19 +859,19 @@ udav_newbuf(struct udav_softc *sc, struct udav_chain *c, struct mbuf *m) { struct mbuf *m_new = NULL; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->sc_dev)); + "-- packet dropped!\n", sc->sc_dev.dv_xname); return (ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->sc_dev)); + "-- packet dropped!\n", sc->sc_dev.dv_xname); m_freem(m_new); return (ENOBUFS); } @@ -896,7 +896,7 @@ udav_rx_list_init(struct udav_softc *sc) struct udav_chain *c; int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); cd = &sc->sc_cdata; for (i = 0; i < UDAV_RX_LIST_CNT; i++) { @@ -927,7 +927,7 @@ udav_tx_list_init(struct udav_softc *sc) struct udav_chain *c; int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); cd = &sc->sc_cdata; for (i = 0; i < UDAV_TX_LIST_CNT; i++) { @@ -956,7 +956,7 @@ udav_start(struct ifnet *ifp) struct udav_softc *sc = ifp->if_softc; struct mbuf *m_head = NULL; - DPRINTF(("%s: %s: enter, link=%d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: enter, link=%d\n", sc->sc_dev.dv_xname, __func__, sc->sc_link)); if (sc->sc_dying) @@ -997,7 +997,7 @@ udav_send(struct udav_softc *sc, struct mbuf *m, int idx) struct udav_chain *c; usbd_status err; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); c = &sc->sc_cdata.udav_tx_chain[idx]; @@ -1027,14 +1027,14 @@ udav_send(struct udav_softc *sc, struct mbuf *m, int idx) if (--sc->sc_refcnt < 0) usb_detach_wakeup(&sc->sc_dev); if (err != USBD_IN_PROGRESS) { - printf("%s: udav_send error=%s\n", USBDEVNAME(sc->sc_dev), + printf("%s: udav_send error=%s\n", sc->sc_dev.dv_xname, usbd_errstr(err)); /* Stop the interface */ usb_add_task(sc->sc_udev, &sc->sc_stop_task); return (EIO); } - DPRINTF(("%s: %s: send %d bytes\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: send %d bytes\n", sc->sc_dev.dv_xname, __func__, total_len)); sc->sc_cdata.udav_tx_cnt++; @@ -1055,7 +1055,7 @@ udav_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) s = splnet(); - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_timer = 0; ifp->if_flags &= ~IFF_OACTIVE; @@ -1066,7 +1066,7 @@ udav_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; } ifp->if_oerrors++; - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->sc_dev), + printf("%s: usb error on tx: %s\n", sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) { sc->sc_refcnt++; @@ -1100,7 +1100,7 @@ udav_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) u_int32_t total_len; int s; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); if (sc->sc_dying) return; @@ -1111,7 +1111,7 @@ udav_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->sc_rx_errs++; if (usbd_ratecheck(&sc->sc_rx_notice)) { printf("%s: %u usb errors on rx: %s\n", - USBDEVNAME(sc->sc_dev), sc->sc_rx_errs, + sc->sc_dev.dv_xname, sc->sc_rx_errs, usbd_errstr(status)); sc->sc_rx_errs = 0; } @@ -1163,7 +1163,7 @@ udav_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif - DPRINTF(("%s: %s: deliver %d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: deliver %d\n", sc->sc_dev.dv_xname, __func__, m->m_len)); IF_INPUT(ifp, m); @@ -1180,7 +1180,7 @@ udav_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (--sc->sc_refcnt < 0) usb_detach_wakeup(&sc->sc_dev); - DPRINTF(("%s: %s: start rx\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: start rx\n", sc->sc_dev.dv_xname, __func__)); } #if 0 @@ -1198,7 +1198,7 @@ udav_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct mii_data *mii; int s, error = 0; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (EIO); @@ -1278,10 +1278,10 @@ udav_watchdog(struct ifnet *ifp) usbd_status stat; int s; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_oerrors++; - printf("%s: watchdog timeout\n", USBDEVNAME(sc->sc_dev)); + printf("%s: watchdog timeout\n", sc->sc_dev.dv_xname); s = splusb(); c = &sc->sc_cdata.udav_tx_chain[0]; @@ -1307,7 +1307,7 @@ udav_stop(struct ifnet *ifp, int disable) usbd_status err; int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_timer = 0; ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); @@ -1322,11 +1322,11 @@ udav_stop(struct ifnet *ifp, int disable) err = usbd_abort_pipe(sc->sc_pipe_rx); if (err) printf("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_pipe_rx); if (err) printf("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_pipe_rx = NULL; } @@ -1335,11 +1335,11 @@ udav_stop(struct ifnet *ifp, int disable) err = usbd_abort_pipe(sc->sc_pipe_tx); if (err) printf("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_pipe_tx); if (err) printf("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_pipe_tx = NULL; } @@ -1350,11 +1350,11 @@ udav_stop(struct ifnet *ifp, int disable) err = usbd_abort_pipe(sc->sc_pipe_intr); if (err) printf("%s: abort intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_pipe_intr); if (err) printf("%s: close intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_pipe_intr = NULL; } #endif @@ -1393,7 +1393,7 @@ udav_ifmedia_change(struct ifnet *ifp) struct udav_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -1416,7 +1416,7 @@ udav_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr) struct udav_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return; @@ -1440,7 +1440,7 @@ udav_tick(void *xsc) if (sc == NULL) return; - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) @@ -1461,7 +1461,7 @@ udav_tick_task(void *xsc) if (sc == NULL) return; - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) @@ -1479,7 +1479,7 @@ udav_tick_task(void *xsc) if (!sc->sc_link && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { DPRINTF(("%s: %s: got link\n", - USBDEVNAME(sc->sc_dev), __func__)); + sc->sc_dev.dv_xname, __func__)); sc->sc_link++; if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) udav_start(ifp); @@ -1496,7 +1496,7 @@ udav_tick_task(void *xsc) void udav_lock_mii(struct udav_softc *sc) { - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); sc->sc_refcnt++; @@ -1506,7 +1506,7 @@ udav_lock_mii(struct udav_softc *sc) void udav_unlock_mii(struct udav_softc *sc) { - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); rw_exit_write(&sc->sc_mii_lock); @@ -1527,11 +1527,11 @@ udav_miibus_readreg(device_ptr_t dev, int phy, int reg) sc = USBGETSOFTC(dev); DPRINTFN(0xff, ("%s: %s: enter, phy=%d reg=0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg)); + sc->sc_dev.dv_xname, __func__, phy, reg)); if (sc->sc_dying) { #ifdef DIAGNOSTIC - printf("%s: %s: dying\n", USBDEVNAME(sc->sc_dev), + printf("%s: %s: dying\n", sc->sc_dev.dv_xname, __func__); #endif return (0); @@ -1540,7 +1540,7 @@ udav_miibus_readreg(device_ptr_t dev, int phy, int reg) /* XXX: one PHY only for the internal PHY */ if (phy != 0) { DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", - USBDEVNAME(sc->sc_dev), __func__, phy)); + sc->sc_dev.dv_xname, __func__, phy)); return (0); } @@ -1566,7 +1566,7 @@ udav_miibus_readreg(device_ptr_t dev, int phy, int reg) data16 = val[0] | (val[1] << 8); DPRINTFN(0xff, ("%s: %s: phy=%d reg=0x%04x => 0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg, data16)); + sc->sc_dev.dv_xname, __func__, phy, reg, data16)); return (data16); } @@ -1583,11 +1583,11 @@ udav_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) sc = USBGETSOFTC(dev); DPRINTFN(0xff, ("%s: %s: enter, phy=%d reg=0x%04x data=0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg, data)); + sc->sc_dev.dv_xname, __func__, phy, reg, data)); if (sc->sc_dying) { #ifdef DIAGNOSTIC - printf("%s: %s: dying\n", USBDEVNAME(sc->sc_dev), + printf("%s: %s: dying\n", sc->sc_dev.dv_xname, __func__); #endif return; @@ -1596,7 +1596,7 @@ udav_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) /* XXX: one PHY only for the internal PHY */ if (phy != 0) { DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", - USBDEVNAME(sc->sc_dev), __func__, phy)); + sc->sc_dev.dv_xname, __func__, phy)); return; } @@ -1634,7 +1634,7 @@ udav_miibus_statchg(device_ptr_t dev) return; sc = USBGETSOFTC(dev); - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); #endif /* Nothing to do */ } diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c index 494fd3456a1..702a036aba5 100644 --- a/sys/dev/usb/if_upl.c +++ b/sys/dev/usb/if_upl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upl.c,v 1.34 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_upl.c,v 1.35 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -234,13 +234,13 @@ upl_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(5,(" : upl_attach: sc=%p, dev=%p", sc, dev)); devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, UPL_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -251,7 +251,7 @@ upl_attach(struct device *parent, struct device *self, void *aux) err = usbd_device2interface_handle(dev, UPL_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -263,7 +263,7 @@ upl_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: couldn't get ep %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -280,7 +280,7 @@ upl_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_ed[UPL_ENDPT_RX] == 0 || sc->sc_ed[UPL_ENDPT_TX] == 0 || sc->sc_ed[UPL_ENDPT_INTR] == 0) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); return; } @@ -294,7 +294,7 @@ upl_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = upl_ioctl; ifp->if_start = upl_start; ifp->if_watchdog = upl_watchdog; - strlcpy(ifp->if_xname, USBDEVNAME(sc->sc_dev), IFNAMSIZ); + strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); ifp->if_type = IFT_OTHER; ifp->if_addrlen = 0; @@ -321,7 +321,7 @@ upl_detach(struct device *self, int flags) struct ifnet *ifp = &sc->sc_if; int s; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); s = splusb(); @@ -341,7 +341,7 @@ upl_detach(struct device *self, int flags) sc->sc_ep[UPL_ENDPT_RX] != NULL || sc->sc_ep[UPL_ENDPT_INTR] != NULL) printf("%s: detach has active endpoints\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); #endif sc->sc_attached = 0; @@ -358,7 +358,7 @@ upl_activate(device_ptr_t self, enum devact act) { struct upl_softc *sc = (struct upl_softc *)self; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); switch (act) { case DVACT_ACTIVATE: @@ -379,20 +379,20 @@ upl_newbuf(struct upl_softc *sc, struct upl_chain *c, struct mbuf *m) { struct mbuf *m_new = NULL; - DPRINTFN(8,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTFN(8,("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->sc_dev)); + "-- packet dropped!\n", sc->sc_dev.dv_xname); return (ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->sc_dev)); + "-- packet dropped!\n", sc->sc_dev.dv_xname); m_freem(m_new); return (ENOBUFS); } @@ -415,7 +415,7 @@ upl_rx_list_init(struct upl_softc *sc) struct upl_chain *c; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); cd = &sc->sc_cdata; for (i = 0; i < UPL_RX_LIST_CNT; i++) { @@ -446,7 +446,7 @@ upl_tx_list_init(struct upl_softc *sc) struct upl_chain *c; int i; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); cd = &sc->sc_cdata; for (i = 0; i < UPL_TX_LIST_CNT; i++) { @@ -495,7 +495,7 @@ upl_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->sc_rx_errs++; if (usbd_ratecheck(&sc->sc_rx_notice)) { printf("%s: %u usb errors on rx: %s\n", - USBDEVNAME(sc->sc_dev), sc->sc_rx_errs, + sc->sc_dev.dv_xname, sc->sc_rx_errs, usbd_errstr(status)); sc->sc_rx_errs = 0; } @@ -507,7 +507,7 @@ upl_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL); DPRINTFN(9,("%s: %s: enter status=%d length=%d\n", - USBDEVNAME(sc->sc_dev), __func__, status, total_len)); + sc->sc_dev.dv_xname, __func__, status, total_len)); m = c->upl_mbuf; memcpy(mtod(c->upl_mbuf, char *), c->upl_buf, total_len); @@ -537,7 +537,7 @@ upl_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) } #endif - DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(10,("%s: %s: deliver %d\n", sc->sc_dev.dv_xname, __func__, m->m_len)); IF_INPUT(ifp, m); @@ -553,7 +553,7 @@ upl_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) USBD_NO_TIMEOUT, upl_rxeof); usbd_transfer(c->upl_xfer); - DPRINTFN(10,("%s: %s: start rx\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(10,("%s: %s: start rx\n", sc->sc_dev.dv_xname, __func__)); #endif } @@ -575,7 +575,7 @@ upl_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) s = splnet(); - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->sc_dev.dv_xname, __func__, status)); ifp->if_timer = 0; @@ -587,7 +587,7 @@ upl_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; } ifp->if_oerrors++; - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->sc_dev), + printf("%s: usb error on tx: %s\n", sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_ep[UPL_ENDPT_TX]); @@ -625,7 +625,7 @@ upl_send(struct upl_softc *sc, struct mbuf *m, int idx) total_len = m->m_pkthdr.len; DPRINTFN(10,("%s: %s: total_len=%d\n", - USBDEVNAME(sc->sc_dev), __func__, total_len)); + sc->sc_dev.dv_xname, __func__, total_len)); usbd_setup_xfer(c->upl_xfer, sc->sc_ep[UPL_ENDPT_TX], c, c->upl_buf, total_len, USBD_NO_COPY, USBD_DEFAULT_TIMEOUT, @@ -634,7 +634,7 @@ upl_send(struct upl_softc *sc, struct mbuf *m, int idx) /* Transmit */ err = usbd_transfer(c->upl_xfer); if (err != USBD_IN_PROGRESS) { - printf("%s: upl_send error=%s\n", USBDEVNAME(sc->sc_dev), + printf("%s: upl_send error=%s\n", sc->sc_dev.dv_xname, usbd_errstr(err)); upl_stop(sc); return (EIO); @@ -654,7 +654,7 @@ upl_start(struct ifnet *ifp) if (sc->sc_dying) return; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); if (ifp->if_flags & IFF_OACTIVE) return; @@ -697,7 +697,7 @@ upl_init(void *xsc) if (sc->sc_dying) return; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); if (ifp->if_flags & IFF_RUNNING) return; @@ -706,14 +706,14 @@ upl_init(void *xsc) /* Init TX ring. */ if (upl_tx_list_init(sc) == ENOBUFS) { - printf("%s: tx list init failed\n", USBDEVNAME(sc->sc_dev)); + printf("%s: tx list init failed\n", sc->sc_dev.dv_xname); splx(s); return; } /* Init RX ring. */ if (upl_rx_list_init(sc) == ENOBUFS) { - printf("%s: rx list init failed\n", USBDEVNAME(sc->sc_dev)); + printf("%s: rx list init failed\n", sc->sc_dev.dv_xname); splx(s); return; } @@ -743,14 +743,14 @@ upl_openpipes(struct upl_softc *sc) USBD_EXCLUSIVE_USE, &sc->sc_ep[UPL_ENDPT_RX]); if (err) { printf("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (EIO); } err = usbd_open_pipe(sc->sc_iface, sc->sc_ed[UPL_ENDPT_TX], USBD_EXCLUSIVE_USE, &sc->sc_ep[UPL_ENDPT_TX]); if (err) { printf("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (EIO); } err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ed[UPL_ENDPT_INTR], @@ -759,7 +759,7 @@ upl_openpipes(struct upl_softc *sc) UPL_INTR_INTERVAL); if (err) { printf("%s: open intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (EIO); } @@ -786,7 +786,7 @@ upl_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) struct ifnet *ifp = &sc->sc_if; uByte stat; - DPRINTFN(15,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTFN(15,("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); if (sc->sc_dying) return; @@ -801,7 +801,7 @@ upl_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->sc_intr_errs++; if (usbd_ratecheck(&sc->sc_rx_notice)) { printf("%s: %u usb errors on intr: %s\n", - USBDEVNAME(sc->sc_dev), sc->sc_rx_errs, + sc->sc_dev.dv_xname, sc->sc_rx_errs, usbd_errstr(status)); sc->sc_intr_errs = 0; } @@ -815,7 +815,7 @@ upl_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (stat == 0) return; - DPRINTFN(10,("%s: %s: stat=0x%02x\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(10,("%s: %s: stat=0x%02x\n", sc->sc_dev.dv_xname, __func__, stat)); } @@ -832,7 +832,7 @@ upl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) return (EIO); DPRINTFN(5,("%s: %s: cmd=0x%08lx\n", - USBDEVNAME(sc->sc_dev), __func__, command)); + sc->sc_dev.dv_xname, __func__, command)); s = splnet(); @@ -881,13 +881,13 @@ upl_watchdog(struct ifnet *ifp) { struct upl_softc *sc = ifp->if_softc; - DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTFN(5,("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); if (sc->sc_dying) return; ifp->if_oerrors++; - printf("%s: watchdog timeout\n", USBDEVNAME(sc->sc_dev)); + printf("%s: watchdog timeout\n", sc->sc_dev.dv_xname); upl_stop(sc); upl_init(sc); @@ -907,7 +907,7 @@ upl_stop(struct upl_softc *sc) struct ifnet *ifp; int i; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); ifp = &sc->sc_if; ifp->if_timer = 0; @@ -918,12 +918,12 @@ upl_stop(struct upl_softc *sc) err = usbd_abort_pipe(sc->sc_ep[UPL_ENDPT_RX]); if (err) { printf("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->sc_ep[UPL_ENDPT_RX]); if (err) { printf("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); } sc->sc_ep[UPL_ENDPT_RX] = NULL; } @@ -932,12 +932,12 @@ upl_stop(struct upl_softc *sc) err = usbd_abort_pipe(sc->sc_ep[UPL_ENDPT_TX]); if (err) { printf("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->sc_ep[UPL_ENDPT_TX]); if (err) { printf("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); } sc->sc_ep[UPL_ENDPT_TX] = NULL; } @@ -946,12 +946,12 @@ upl_stop(struct upl_softc *sc) err = usbd_abort_pipe(sc->sc_ep[UPL_ENDPT_INTR]); if (err) { printf("%s: abort intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->sc_ep[UPL_ENDPT_INTR]); if (err) { printf("%s: close intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); } sc->sc_ep[UPL_ENDPT_INTR] = NULL; } @@ -988,7 +988,7 @@ upl_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, int s, len, error; DPRINTFN(10,("%s: %s: enter\n", - USBDEVNAME(((struct upl_softc *)ifp->if_softc)->sc_dev), + ((struct upl_softc *)ifp->if_softc)->sc_dev.dv_xname, __func__)); len = m->m_pkthdr.len; diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index 7ffb711690d..dcacb0d147a 100644 --- a/sys/dev/usb/if_url.c +++ b/sys/dev/usb/if_url.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_url.c,v 1.43 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_url.c,v 1.44 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */ /* * Copyright (c) 2001, 2002 @@ -182,7 +182,7 @@ url_attach(struct device *parent, struct device *self, void *aux) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfop; - char *devname = USBDEVNAME(sc->sc_dev); + char *devname = sc->sc_dev.dv_xname; struct ifnet *ifp; struct mii_data *mii; u_char eaddr[ETHER_ADDR_LEN]; @@ -320,7 +320,7 @@ url_detach(struct device *self, int flags) struct ifnet *ifp = GET_IFP(sc); int s; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); /* Detached before attached finished */ if (!sc->sc_attached) @@ -350,13 +350,13 @@ url_detach(struct device *self, int flags) #ifdef DIAGNOSTIC if (sc->sc_pipe_tx != NULL) printf("%s: detach has active tx endpoint.\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); if (sc->sc_pipe_rx != NULL) printf("%s: detach has active rx endpoint.\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); if (sc->sc_pipe_intr != NULL) printf("%s: detach has active intr endpoint.\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); #endif sc->sc_attached = 0; @@ -380,7 +380,7 @@ url_mem(struct url_softc *sc, int cmd, int offset, void *buf, int len) return (0); DPRINTFN(0x200, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -400,7 +400,7 @@ url_mem(struct url_softc *sc, int cmd, int offset, void *buf, int len) usb_detach_wakeup(&sc->sc_dev); if (err) { DPRINTF(("%s: url_mem(): %s failed. off=%04x, err=%d\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, cmd == URL_CMD_READMEM ? "read" : "write", offset, err)); } @@ -415,7 +415,7 @@ url_csr_read_1(struct url_softc *sc, int reg) u_int8_t val = 0; DPRINTFN(0x100, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -430,7 +430,7 @@ url_csr_read_2(struct url_softc *sc, int reg) uWord val; DPRINTFN(0x100, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -446,7 +446,7 @@ url_csr_write_1(struct url_softc *sc, int reg, int aval) u_int8_t val = aval; DPRINTFN(0x100, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -461,7 +461,7 @@ url_csr_write_2(struct url_softc *sc, int reg, int aval) uWord val; DPRINTFN(0x100, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); USETW(val, aval); @@ -478,7 +478,7 @@ url_csr_write_4(struct url_softc *sc, int reg, int aval) uDWord val; DPRINTFN(0x100, - ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); USETDW(val, aval); @@ -496,7 +496,7 @@ url_init(struct ifnet *ifp) u_char *eaddr; int i, s; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (EIO); @@ -532,14 +532,14 @@ url_init(struct ifnet *ifp) /* Initialize transmit ring */ if (url_tx_list_init(sc) == ENOBUFS) { - printf("%s: tx list init failed\n", USBDEVNAME(sc->sc_dev)); + printf("%s: tx list init failed\n", sc->sc_dev.dv_xname); splx(s); return (EIO); } /* Initialize receive ring */ if (url_rx_list_init(sc) == ENOBUFS) { - printf("%s: rx list init failed\n", USBDEVNAME(sc->sc_dev)); + printf("%s: rx list init failed\n", sc->sc_dev.dv_xname); splx(s); return (EIO); } @@ -576,7 +576,7 @@ url_reset(struct url_softc *sc) { int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return; @@ -597,7 +597,7 @@ url_activate(device_ptr_t self, enum devact act) { struct url_softc *sc = (struct url_softc *)self; - DPRINTF(("%s: %s: enter, act=%d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: enter, act=%d\n", sc->sc_dev.dv_xname, __func__, act)); switch (act) { @@ -625,7 +625,7 @@ url_setmulti(struct url_softc *sc) int h = 0; int mcnt = 0; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return; @@ -694,7 +694,7 @@ url_openpipes(struct url_softc *sc) USBD_EXCLUSIVE_USE, &sc->sc_pipe_rx); if (err) { printf("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -704,7 +704,7 @@ url_openpipes(struct url_softc *sc) USBD_EXCLUSIVE_USE, &sc->sc_pipe_tx); if (err) { printf("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -718,7 +718,7 @@ url_openpipes(struct url_softc *sc) url_intr, URL_INTR_INTERVAL); if (err) { printf("%s: open intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -733,7 +733,7 @@ url_openpipes(struct url_softc *sc) USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT, url_rxeof); (void)usbd_transfer(c->url_xfer); - DPRINTF(("%s: %s: start read\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: start read\n", sc->sc_dev.dv_xname, __func__)); } @@ -749,19 +749,19 @@ url_newbuf(struct url_softc *sc, struct url_chain *c, struct mbuf *m) { struct mbuf *m_new = NULL; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->sc_dev)); + "-- packet dropped!\n", sc->sc_dev.dv_xname); return (ENOBUFS); } MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("%s: no memory for rx list " - "-- packet dropped!\n", USBDEVNAME(sc->sc_dev)); + "-- packet dropped!\n", sc->sc_dev.dv_xname); m_freem(m_new); return (ENOBUFS); } @@ -786,7 +786,7 @@ url_rx_list_init(struct url_softc *sc) struct url_chain *c; int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); cd = &sc->sc_cdata; for (i = 0; i < URL_RX_LIST_CNT; i++) { @@ -817,7 +817,7 @@ url_tx_list_init(struct url_softc *sc) struct url_chain *c; int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); cd = &sc->sc_cdata; for (i = 0; i < URL_TX_LIST_CNT; i++) { @@ -846,7 +846,7 @@ url_start(struct ifnet *ifp) struct url_softc *sc = ifp->if_softc; struct mbuf *m_head = NULL; - DPRINTF(("%s: %s: enter, link=%d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: enter, link=%d\n", sc->sc_dev.dv_xname, __func__, sc->sc_link)); if (sc->sc_dying) @@ -887,7 +887,7 @@ url_send(struct url_softc *sc, struct mbuf *m, int idx) struct url_chain *c; usbd_status err; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); c = &sc->sc_cdata.url_tx_chain[idx]; @@ -910,14 +910,14 @@ url_send(struct url_softc *sc, struct mbuf *m, int idx) if (--sc->sc_refcnt < 0) usb_detach_wakeup(&sc->sc_dev); if (err != USBD_IN_PROGRESS) { - printf("%s: url_send error=%s\n", USBDEVNAME(sc->sc_dev), + printf("%s: url_send error=%s\n", sc->sc_dev.dv_xname, usbd_errstr(err)); /* Stop the interface */ usb_add_task(sc->sc_udev, &sc->sc_stop_task); return (EIO); } - DPRINTF(("%s: %s: send %d bytes\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: send %d bytes\n", sc->sc_dev.dv_xname, __func__, total_len)); sc->sc_cdata.url_tx_cnt++; @@ -938,7 +938,7 @@ url_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) s = splnet(); - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_timer = 0; ifp->if_flags &= ~IFF_OACTIVE; @@ -949,7 +949,7 @@ url_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; } ifp->if_oerrors++; - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->sc_dev), + printf("%s: usb error on tx: %s\n", sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) { sc->sc_refcnt++; @@ -983,7 +983,7 @@ url_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) url_rxhdr_t rxhdr; int s; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev),__func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); if (sc->sc_dying) return; @@ -994,7 +994,7 @@ url_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->sc_rx_errs++; if (usbd_ratecheck(&sc->sc_rx_notice)) { printf("%s: %u usb errors on rx: %s\n", - USBDEVNAME(sc->sc_dev), sc->sc_rx_errs, + sc->sc_dev.dv_xname, sc->sc_rx_errs, usbd_errstr(status)); sc->sc_rx_errs = 0; } @@ -1019,7 +1019,7 @@ url_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) memcpy(&rxhdr, c->url_buf + total_len - ETHER_CRC_LEN, sizeof(rxhdr)); DPRINTF(("%s: RX Status: %dbytes%s%s%s%s packets\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, UGETW(rxhdr) & URL_RXHDR_BYTEC_MASK, UGETW(rxhdr) & URL_RXHDR_VALID_MASK ? ", Valid" : "", UGETW(rxhdr) & URL_RXHDR_RUNTPKT_MASK ? ", Runt" : "", @@ -1050,7 +1050,7 @@ url_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif - DPRINTF(("%s: %s: deliver %d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: %s: deliver %d\n", sc->sc_dev.dv_xname, __func__, m->m_len)); IF_INPUT(ifp, m); @@ -1067,7 +1067,7 @@ url_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (--sc->sc_refcnt < 0) usb_detach_wakeup(&sc->sc_dev); - DPRINTF(("%s: %s: start rx\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: start rx\n", sc->sc_dev.dv_xname, __func__)); } #if 0 @@ -1085,7 +1085,7 @@ url_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct mii_data *mii; int s, error = 0; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (EIO); @@ -1166,10 +1166,10 @@ url_watchdog(struct ifnet *ifp) usbd_status stat; int s; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_oerrors++; - printf("%s: watchdog timeout\n", USBDEVNAME(sc->sc_dev)); + printf("%s: watchdog timeout\n", sc->sc_dev.dv_xname); s = splusb(); c = &sc->sc_cdata.url_tx_chain[0]; @@ -1195,7 +1195,7 @@ url_stop(struct ifnet *ifp, int disable) usbd_status err; int i; - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_timer = 0; ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); @@ -1210,11 +1210,11 @@ url_stop(struct ifnet *ifp, int disable) err = usbd_abort_pipe(sc->sc_pipe_rx); if (err) printf("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_pipe_rx); if (err) printf("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_pipe_rx = NULL; } @@ -1223,11 +1223,11 @@ url_stop(struct ifnet *ifp, int disable) err = usbd_abort_pipe(sc->sc_pipe_tx); if (err) printf("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_pipe_tx); if (err) printf("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_pipe_tx = NULL; } @@ -1238,11 +1238,11 @@ url_stop(struct ifnet *ifp, int disable) err = usbd_abort_pipe(sc->sc_pipe_intr); if (err) printf("%s: abort intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_pipe_intr); if (err) printf("%s: close intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_pipe_intr = NULL; } #endif @@ -1281,7 +1281,7 @@ url_ifmedia_change(struct ifnet *ifp) struct url_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return (0); @@ -1304,7 +1304,7 @@ url_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr) struct url_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) return; @@ -1328,7 +1328,7 @@ url_tick(void *xsc) if (sc == NULL) return; - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) @@ -1349,7 +1349,7 @@ url_tick_task(void *xsc) if (sc == NULL) return; - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); if (sc->sc_dying) @@ -1367,7 +1367,7 @@ url_tick_task(void *xsc) if (!sc->sc_link && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { DPRINTF(("%s: %s: got link\n", - USBDEVNAME(sc->sc_dev), __func__)); + sc->sc_dev.dv_xname, __func__)); sc->sc_link++; if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) url_start(ifp); @@ -1384,7 +1384,7 @@ url_tick_task(void *xsc) void url_lock_mii(struct url_softc *sc) { - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); sc->sc_refcnt++; @@ -1394,7 +1394,7 @@ url_lock_mii(struct url_softc *sc) void url_unlock_mii(struct url_softc *sc) { - DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), + DPRINTFN(0xff, ("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); rw_exit_write(&sc->sc_mii_lock); @@ -1414,11 +1414,11 @@ url_int_miibus_readreg(device_ptr_t dev, int phy, int reg) sc = USBGETSOFTC(dev); DPRINTFN(0xff, ("%s: %s: enter, phy=%d reg=0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg)); + sc->sc_dev.dv_xname, __func__, phy, reg)); if (sc->sc_dying) { #ifdef DIAGNOSTIC - printf("%s: %s: dying\n", USBDEVNAME(sc->sc_dev), + printf("%s: %s: dying\n", sc->sc_dev.dv_xname, __func__); #endif return (0); @@ -1427,7 +1427,7 @@ url_int_miibus_readreg(device_ptr_t dev, int phy, int reg) /* XXX: one PHY only for the RTL8150 internal PHY */ if (phy != 0) { DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", - USBDEVNAME(sc->sc_dev), __func__, phy)); + sc->sc_dev.dv_xname, __func__, phy)); return (0); } @@ -1456,7 +1456,7 @@ url_int_miibus_readreg(device_ptr_t dev, int phy, int reg) break; default: printf("%s: %s: bad register %04x\n", - USBDEVNAME(sc->sc_dev), __func__, reg); + sc->sc_dev.dv_xname, __func__, reg); val = 0; goto R_DONE; break; @@ -1469,7 +1469,7 @@ url_int_miibus_readreg(device_ptr_t dev, int phy, int reg) R_DONE: DPRINTFN(0xff, ("%s: %s: phy=%d reg=0x%04x => 0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg, val)); + sc->sc_dev.dv_xname, __func__, phy, reg, val)); url_unlock_mii(sc); return (val); @@ -1486,11 +1486,11 @@ url_int_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) sc = USBGETSOFTC(dev); DPRINTFN(0xff, ("%s: %s: enter, phy=%d reg=0x%04x data=0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg, data)); + sc->sc_dev.dv_xname, __func__, phy, reg, data)); if (sc->sc_dying) { #ifdef DIAGNOSTIC - printf("%s: %s: dying\n", USBDEVNAME(sc->sc_dev), + printf("%s: %s: dying\n", sc->sc_dev.dv_xname, __func__); #endif return; @@ -1499,7 +1499,7 @@ url_int_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) /* XXX: one PHY only for the RTL8150 internal PHY */ if (phy != 0) { DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", - USBDEVNAME(sc->sc_dev), __func__, phy)); + sc->sc_dev.dv_xname, __func__, phy)); return; } @@ -1527,7 +1527,7 @@ url_int_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) break; default: printf("%s: %s: bad register %04x\n", - USBDEVNAME(sc->sc_dev), __func__, reg); + sc->sc_dev.dv_xname, __func__, reg); goto W_DONE; break; } @@ -1552,7 +1552,7 @@ url_miibus_statchg(device_ptr_t dev) return; sc = USBGETSOFTC(dev); - DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); + DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); #endif /* Nothing to do */ } @@ -1568,11 +1568,11 @@ url_ext_miibus_redreg(device_ptr_t dev, int phy, int reg) u_int16_t val; DPRINTF(("%s: %s: enter, phy=%d reg=0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg)); + sc->sc_dev.dv_xname, __func__, phy, reg)); if (sc->sc_dying) { #ifdef DIAGNOSTIC - printf("%s: %s: dying\n", USBDEVNAME(sc->sc_dev), + printf("%s: %s: dying\n", sc->sc_dev.dv_xname, __func__); #endif return (0); @@ -1593,13 +1593,13 @@ url_ext_miibus_redreg(device_ptr_t dev, int phy, int reg) break; } if (i == URL_TIMEOUT) { - printf("%s: MII read timed out\n", USBDEVNAME(sc->sc_dev)); + printf("%s: MII read timed out\n", sc->sc_dev.dv_xname); } val = url_csr_read_2(sc, URL_PHYDAT); DPRINTF(("%s: %s: phy=%d reg=0x%04x => 0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg, val)); + sc->sc_dev.dv_xname, __func__, phy, reg, val)); url_unlock_mii(sc); return (val); @@ -1611,11 +1611,11 @@ url_ext_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) struct url_softc *sc = USBGETSOFTC(dev); DPRINTF(("%s: %s: enter, phy=%d reg=0x%04x data=0x%04x\n", - USBDEVNAME(sc->sc_dev), __func__, phy, reg, data)); + sc->sc_dev.dv_xname, __func__, phy, reg, data)); if (sc->sc_dying) { #ifdef DIAGNOSTIC - printf("%s: %s: dying\n", USBDEVNAME(sc->sc_dev), + printf("%s: %s: dying\n", sc->sc_dev.dv_xname, __func__); #endif return; @@ -1634,7 +1634,7 @@ url_ext_miibus_writereg(device_ptr_t dev, int phy, int reg, int data) if (i == URL_TIMEOUT) { printf("%s: MII write timed out\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); } url_unlock_mii(sc); diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c index 04dcdaef226..3c1ebc94b72 100644 --- a/sys/dev/usb/if_wi_usb.c +++ b/sys/dev/usb/if_wi_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_usb.c,v 1.39 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_wi_usb.c,v 1.40 2007/06/10 14:49:00 mbalmer Exp $ */ /* * Copyright (c) 2003 Dale Rahn. All rights reserved. @@ -300,12 +300,12 @@ wi_usb_attach(struct device *parent, struct device *self, void *aux) err = usbd_set_config_no(dev, WI_USB_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->wi_usb_dev)); + sc->wi_usb_dev.dv_xname); return; } devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->wi_usb_dev), devinfop); + printf("\n%s: %s\n", sc->wi_usb_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); /* XXX - any tasks? */ @@ -313,7 +313,7 @@ wi_usb_attach(struct device *parent, struct device *self, void *aux) err = usbd_device2interface_handle(dev, WI_USB_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->wi_usb_dev)); + sc->wi_usb_dev.dv_xname); return; } @@ -338,7 +338,7 @@ wi_usb_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: couldn't get endpoint descriptor %d\n", - USBDEVNAME(sc->wi_usb_dev), i); + sc->wi_usb_dev.dv_xname, i); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -359,18 +359,18 @@ wi_usb_attach(struct device *parent, struct device *self, void *aux) if (wi_usb_rx_list_init(sc)) { printf("%s: rx list init failed\n", - USBDEVNAME(sc->wi_usb_dev)); + sc->wi_usb_dev.dv_xname); return; } if (wi_usb_tx_list_init(sc)) { printf("%s: tx list init failed\n", - USBDEVNAME(sc->wi_usb_dev)); + sc->wi_usb_dev.dv_xname); return; } if (wi_usb_open_pipes(sc)){ printf("%s: open pipes failed\n", - USBDEVNAME(sc->wi_usb_dev)); + sc->wi_usb_dev.dv_xname); return; } @@ -410,7 +410,7 @@ wi_usb_detach(struct device *self, int flags) /* detatch wi */ if (!(wsc->wi_flags & WI_FLAGS_ATTACHED)) { - printf("%s: already detached\n", USBDEVNAME(sc->wi_usb_dev)); + printf("%s: already detached\n", sc->wi_usb_dev.dv_xname); splx(s); return (0); } @@ -440,12 +440,12 @@ wi_usb_detach(struct device *self, int flags) err = usbd_abort_pipe(sc->wi_usb_ep[WI_USB_ENDPT_INTR]); if (err) { printf("%s: abort intr pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->wi_usb_ep[WI_USB_ENDPT_INTR]); if (err) { printf("%s: close intr pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); } sc->wi_usb_ep[WI_USB_ENDPT_INTR] = NULL; } @@ -453,12 +453,12 @@ wi_usb_detach(struct device *self, int flags) usbd_abort_pipe(sc->wi_usb_ep[WI_USB_ENDPT_TX]); if (err) { printf("%s: abort tx pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->wi_usb_ep[WI_USB_ENDPT_TX]); if (err) { printf("%s: close tx pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); } sc->wi_usb_ep[WI_USB_ENDPT_TX] = NULL; } @@ -466,12 +466,12 @@ wi_usb_detach(struct device *self, int flags) usbd_abort_pipe(sc->wi_usb_ep[WI_USB_ENDPT_RX]); if (err) { printf("%s: abort rx pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); } err = usbd_close_pipe(sc->wi_usb_ep[WI_USB_ENDPT_RX]); if (err) { printf("%s: close rx pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); } sc->wi_usb_ep[WI_USB_ENDPT_RX] = NULL; } @@ -494,7 +494,7 @@ wi_send_packet(struct wi_usb_softc *sc, int id) c = &sc->wi_usb_tx_chain[0]; DPRINTFN(10,("%s: %s: id=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, id)); + sc->wi_usb_dev.dv_xname, __func__, id)); /* assemble packet from write_data buffer */ if (id == 0 || id == 1) { @@ -528,7 +528,7 @@ wi_send_packet(struct wi_usb_softc *sc, int id) total_len = rnd_len; DPRINTFN(5,("%s: %s: id=%x len=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, id, total_len)); + sc->wi_usb_dev.dv_xname, __func__, id, total_len)); usbd_setup_xfer(c->wi_usb_xfer, sc->wi_usb_ep[WI_USB_ENDPT_TX], c, c->wi_usb_buf, rnd_len, @@ -538,7 +538,7 @@ wi_send_packet(struct wi_usb_softc *sc, int id) err = usbd_transfer(c->wi_usb_xfer); if (err != USBD_IN_PROGRESS && err != USBD_NORMAL_COMPLETION) { printf("%s: %s: error=%s\n", - USBDEVNAME(sc->wi_usb_dev), __func__, + sc->wi_usb_dev.dv_xname, __func__, usbd_errstr(err)); /* Stop the interface from process context. */ wi_usb_stop(sc); @@ -548,12 +548,12 @@ wi_send_packet(struct wi_usb_softc *sc, int id) } DPRINTFN(5,("%s: %s: exit err=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, err)); + sc->wi_usb_dev.dv_xname, __func__, err)); err_ret: return err; } printf("%s:%s: invalid packet id sent %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, id); + sc->wi_usb_dev.dv_xname, __func__, id); return 0; } @@ -567,7 +567,7 @@ wi_cmd_usb(struct wi_softc *wsc, int cmd, int val0, int val1, int val2) int err; DPRINTFN(5,("%s: %s: enter cmd=%x %x %x %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, cmd, val0, val1, val2)); + sc->wi_usb_dev.dv_xname, __func__, cmd, val0, val1, val2)); if ((cmd & WI_CMD_CODE_MASK) == WI_CMD_TX) { return wi_send_packet(sc, val0); @@ -638,7 +638,7 @@ err_ret: wi_usb_ctl_unlock(sc); DPRINTFN(5,("%s: %s: exit err=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, err)); + sc->wi_usb_dev.dv_xname, __func__, err)); return err; } @@ -654,7 +654,7 @@ wi_read_record_usb(struct wi_softc *wsc, struct wi_ltv_gen *ltv) struct wi_ltv_gen *oltv, p2ltv; DPRINTFN(5,("%s: %s: enter rid=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, ltv->wi_type)); + sc->wi_usb_dev.dv_xname, __func__, ltv->wi_type)); /* Do we need to deal with these here, as in _io version? * WI_RID_ENCRYPTION -> WI_RID_P2_ENCRYPTION @@ -707,7 +707,7 @@ wi_read_record_usb(struct wi_softc *wsc, struct wi_ltv_gen *ltv) WI_USB_TX_TIMEOUT, wi_usb_txeof); DPRINTFN(10,("%s: %s: total_len=%x, wilen %d\n", - USBDEVNAME(sc->wi_usb_dev), __func__, total_len, ltv->wi_len)); + sc->wi_usb_dev.dv_xname, __func__, total_len, ltv->wi_len)); err = wi_usb_do_transmit_sync(sc, c, &sc->ridresperr); @@ -768,7 +768,7 @@ wi_read_record_usb(struct wi_softc *wsc, struct wi_ltv_gen *ltv) wi_usb_tx_unlock(sc); DPRINTFN(5,("%s: %s: exit err=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, err)); + sc->wi_usb_dev.dv_xname, __func__, err)); return err; } @@ -785,7 +785,7 @@ wi_write_record_usb(struct wi_softc *wsc, struct wi_ltv_gen *ltv) int i; DPRINTFN(5,("%s: %s: enter rid=%x wi_len %d copying %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, ltv->wi_type, ltv->wi_len, + sc->wi_usb_dev.dv_xname, __func__, ltv->wi_type, ltv->wi_len, (ltv->wi_len-1)*2 )); /* Do we need to deal with these here, as in _io version? @@ -930,7 +930,7 @@ wi_write_record_usb(struct wi_softc *wsc, struct wi_ltv_gen *ltv) wi_usb_tx_unlock(sc); DPRINTFN(5,("%s: %s: exit err=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, err)); + sc->wi_usb_dev.dv_xname, __func__, err)); return err; } @@ -948,7 +948,7 @@ wi_alloc_nicmem_usb(struct wi_softc *wsc, int len, int *id) struct wi_usb_softc *sc = wsc->wi_usb_cdata; DPRINTFN(10,("%s: %s: enter len=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, len)); + sc->wi_usb_dev.dv_xname, __func__, len)); /* * NOTE THIS IS A USB DEVICE WHICH WILL LIKELY HAVE MANY @@ -985,7 +985,7 @@ wi_write_data_usb(struct wi_softc *wsc, int id, int off, caddr_t buf, int len) struct wi_usb_softc *sc = wsc->wi_usb_cdata; DPRINTFN(10,("%s: %s: id %x off %x len %d\n", - USBDEVNAME(sc->wi_usb_dev), __func__, id, off, len)); + sc->wi_usb_dev.dv_xname, __func__, id, off, len)); if (id < 0 && id >= sc->wi_usb_nummem) return EIO; @@ -995,7 +995,7 @@ wi_write_data_usb(struct wi_softc *wsc, int id, int off, caddr_t buf, int len) if (len + off > sc->wi_usb_txmemsize[id]) return EIO; DPRINTFN(10,("%s: %s: completed \n", - USBDEVNAME(sc->wi_usb_dev), __func__)); + sc->wi_usb_dev.dv_xname, __func__)); bcopy(buf, ptr, len); return 0; @@ -1012,7 +1012,7 @@ wi_read_data_usb(struct wi_softc *wsc, int id, int off, caddr_t buf, int len) struct wi_usb_softc *sc = wsc->wi_usb_cdata; DPRINTFN(10,("%s: %s: id %x off %x len %d\n", - USBDEVNAME(sc->wi_usb_dev), __func__, id, off, len)); + sc->wi_usb_dev.dv_xname, __func__, id, off, len)); if (id == 0x1001 && sc->wi_info != NULL) ptr = (u_int8_t *)sc->wi_info + off; @@ -1043,7 +1043,7 @@ wi_read_data_usb(struct wi_softc *wsc, int id, int off, caddr_t buf, int len) void wi_usb_stop(struct wi_usb_softc *sc) { - DPRINTFN(1,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev),__func__)); + DPRINTFN(1,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname,__func__)); /* XXX */ /* Stop transfers */ @@ -1056,13 +1056,13 @@ wi_usb_do_transmit_sync(struct wi_usb_softc *sc, struct wi_usb_chain *c, usbd_status err; DPRINTFN(10,("%s: %s:\n", - USBDEVNAME(sc->wi_usb_dev), __func__)); + sc->wi_usb_dev.dv_xname, __func__)); sc->wi_usb_refcnt++; err = usbd_transfer(c->wi_usb_xfer); if (err != USBD_IN_PROGRESS && err != USBD_NORMAL_COMPLETION) { printf("%s: %s error=%s\n", - USBDEVNAME(sc->wi_usb_dev), __func__, + sc->wi_usb_dev.dv_xname, __func__, usbd_errstr(err)); /* Stop the interface from process context. */ wi_usb_stop(sc); @@ -1072,7 +1072,7 @@ wi_usb_do_transmit_sync(struct wi_usb_softc *sc, struct wi_usb_chain *c, err = tsleep(ident, PRIBIO, "wiTXsync", hz*1); if (err) { DPRINTFN(1,("%s: %s: err %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, err)); + sc->wi_usb_dev.dv_xname, __func__, err)); err = ETIMEDOUT; } done: @@ -1101,7 +1101,7 @@ wi_usb_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, s = splnet(); - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->wi_usb_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->wi_usb_dev.dv_xname, __func__, status)); if (status != USBD_NORMAL_COMPLETION) { @@ -1109,7 +1109,7 @@ wi_usb_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, splx(s); return; } - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->wi_usb_dev), + printf("%s: usb error on tx: %s\n", sc->wi_usb_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) { sc->wi_usb_refcnt++; @@ -1147,7 +1147,7 @@ wi_usb_txeof_frm(usbd_xfer_handle xfer, usbd_private_handle priv, s = splnet(); - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->wi_usb_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->wi_usb_dev.dv_xname, __func__, status)); if (status != USBD_NORMAL_COMPLETION) { @@ -1155,7 +1155,7 @@ wi_usb_txeof_frm(usbd_xfer_handle xfer, usbd_private_handle priv, splx(s); return; } - printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->wi_usb_dev), + printf("%s: usb error on tx: %s\n", sc->wi_usb_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) { sc->wi_usb_refcnt++; @@ -1187,7 +1187,7 @@ wi_usb_rx_list_init(struct wi_usb_softc *sc) struct wi_usb_chain *c; int i; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), __func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); for (i = 0; i < WI_USB_RX_LIST_CNT; i++) { c = &sc->wi_usb_rx_chain[i]; @@ -1216,7 +1216,7 @@ wi_usb_tx_list_init(struct wi_usb_softc *sc) struct wi_usb_chain *c; int i; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), __func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); for (i = 0; i < WI_USB_TX_LIST_CNT; i++) { c = &sc->wi_usb_tx_chain[i]; @@ -1248,7 +1248,7 @@ wi_usb_open_pipes(struct wi_usb_softc *sc) struct wi_usb_chain *c; int i; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev),__func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname,__func__)); sc->wi_usb_refcnt++; @@ -1257,7 +1257,7 @@ wi_usb_open_pipes(struct wi_usb_softc *sc) USBD_EXCLUSIVE_USE, &sc->wi_usb_ep[WI_USB_ENDPT_RX]); if (err) { printf("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -1266,7 +1266,7 @@ wi_usb_open_pipes(struct wi_usb_softc *sc) USBD_EXCLUSIVE_USE, &sc->wi_usb_ep[WI_USB_ENDPT_TX]); if (err) { printf("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -1278,7 +1278,7 @@ wi_usb_open_pipes(struct wi_usb_softc *sc) WI_USB_INTR_PKTLEN, wi_usb_intr, WI_USB_INTR_INTERVAL); if (err) { printf("%s: open intr pipe failed: %s\n", - USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err)); + sc->wi_usb_dev.dv_xname, usbd_errstr(err)); error = EIO; goto done; } @@ -1290,7 +1290,7 @@ wi_usb_open_pipes(struct wi_usb_softc *sc) c, c->wi_usb_buf, WI_USB_BUFSZ, USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT, wi_usb_rxeof); - DPRINTFN(10,("%s: %s: start read\n", USBDEVNAME(sc->wi_usb_dev), + DPRINTFN(10,("%s: %s: start read\n", sc->wi_usb_dev.dv_xname, __func__)); usbd_transfer(c->wi_usb_xfer); } @@ -1334,7 +1334,7 @@ wi_usb_activate(device_ptr_t self, enum devact act) { struct wi_usb_softc *sc = (struct wi_usb_softc *)self; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), __func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); switch (act) { case DVACT_ACTIVATE: @@ -1380,7 +1380,7 @@ wi_usb_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status if (sc->wi_usb_dying) return; - DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->wi_usb_dev), + DPRINTFN(10,("%s: %s: enter status=%d\n", sc->wi_usb_dev.dv_xname, __func__, status)); @@ -1388,7 +1388,7 @@ wi_usb_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status if (status == USBD_NOT_STARTED || status == USBD_IOERROR || status == USBD_CANCELLED) { printf("%s: %u usb errors on rx: %s\n", - USBDEVNAME(sc->wi_usb_dev), 1, + sc->wi_usb_dev.dv_xname, 1, /* sc->wi_usb_rx_errs, */ usbd_errstr(status)); return; @@ -1397,7 +1397,7 @@ wi_usb_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status sc->wi_usb_rx_errs++; if (usbd_ratecheck(&sc->wi_usb_rx_notice)) { printf("%s: %u usb errors on rx: %s\n", - USBDEVNAME(sc->wi_usb_dev), sc->wi_usb_rx_errs, + sc->wi_usb_dev.dv_xname, sc->wi_usb_rx_errs, usbd_errstr(status)); sc->wi_usb_rx_errs = 0; } @@ -1432,7 +1432,7 @@ wi_usb_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status } if (WI_USB_ISTXFRM(rtype)) { DPRINTFN(2,("%s: %s: txfrm type %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, rtype)); + sc->wi_usb_dev.dv_xname, __func__, rtype)); wi_usb_txfrm(sc, uin, total_len); goto done; } @@ -1441,7 +1441,7 @@ wi_usb_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status case WI_USB_INFOFRM: /* info packet, INFO_FID hmm */ DPRINTFN(10,("%s: %s: infofrm type %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, rtype)); + sc->wi_usb_dev.dv_xname, __func__, rtype)); wi_usb_infofrm(c, total_len); break; case WI_USB_CMDRESP: @@ -1456,12 +1456,12 @@ wi_usb_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status case WI_USB_WMEMRESP: /* Not currently used */ DPRINTFN(2,("%s: %s: wmemresp type %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, rtype)); + sc->wi_usb_dev.dv_xname, __func__, rtype)); break; case WI_USB_RMEMRESP: /* Not currently used */ DPRINTFN(2,("%s: %s: rmemresp type %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, rtype)); + sc->wi_usb_dev.dv_xname, __func__, rtype)); break; case WI_USB_BUFAVAIL: printf("wi_usb: received USB_BUFAVAIL packet\n"); /* XXX */ @@ -1487,7 +1487,7 @@ wi_usb_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status if (--sc->wi_usb_refcnt < 0) usb_detach_wakeup(&sc->wi_usb_dev); - DPRINTFN(10,("%s: %s: start rx\n", USBDEVNAME(sc->wi_usb_dev), + DPRINTFN(10,("%s: %s: start rx\n", sc->wi_usb_dev.dv_xname, __func__)); } @@ -1496,7 +1496,7 @@ wi_usb_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) { struct wi_usb_softc *sc = priv; - DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), __func__)); + DPRINTFN(2,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); if (sc->wi_usb_dying) return; @@ -1529,14 +1529,14 @@ wi_usb_cmdresp(struct wi_usb_chain *c) cmdresperr = letoh16(presp->resp0); DPRINTFN(10,("%s: %s: enter type=%x, status=%x, cmdresp=%x, " "resp=%x,%x,%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, type, status, sc->cmdresp, + sc->wi_usb_dev.dv_xname, __func__, type, status, sc->cmdresp, cmdresperr, letoh16(presp->resp1), letoh16(presp->resp2))); /* XXX */ if (sc->cmdresp != (status & WI_STAT_CMD_CODE)) { DPRINTFN(1,("%s: cmd ty %x st %x cmd %x failed %x\n", - USBDEVNAME(sc->wi_usb_dev), + sc->wi_usb_dev.dv_xname, type, status, sc->cmdresp, cmdresperr)); return; } @@ -1561,13 +1561,13 @@ wi_usb_rridresp(struct wi_usb_chain *c) if (ltv == 0) { DPRINTFN(5,("%s: %s: enter ltv = 0 rid=%x len %d\n", - USBDEVNAME(sc->wi_usb_dev), __func__, rid, + sc->wi_usb_dev.dv_xname, __func__, rid, frmlen)); return; } DPRINTFN(5,("%s: %s: enter rid=%x expecting %x len %d exptlen %d\n", - USBDEVNAME(sc->wi_usb_dev), __func__, rid, ltv->wi_type, + sc->wi_usb_dev.dv_xname, __func__, rid, ltv->wi_type, frmlen, ltv->wi_len)); rid = letoh16(presp->rid); @@ -1587,7 +1587,7 @@ wi_usb_rridresp(struct wi_usb_chain *c) ltv->wi_len = frmlen; DPRINTFN(10,("%s: %s: copying %d frmlen %d\n", - USBDEVNAME(sc->wi_usb_dev), __func__, (ltv->wi_len-1)*2, + sc->wi_usb_dev.dv_xname, __func__, (ltv->wi_len-1)*2, frmlen)); if (ltv->wi_len > 1) @@ -1610,7 +1610,7 @@ wi_usb_wridresp(struct wi_usb_chain *c) status = letoh16(presp->status); DPRINTFN(10,("%s: %s: enter status=%x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, status)); + sc->wi_usb_dev.dv_xname, __func__, status)); sc->ridresperr = (status & WI_STAT_CMD_RESULT) >> 8; sc->ridltv = 0; @@ -1623,7 +1623,7 @@ wi_usb_infofrm(struct wi_usb_chain *c, int len) struct wi_usb_softc *sc = c->wi_usb_sc; DPRINTFN(10,("%s: %s: enter\n", - USBDEVNAME(sc->wi_usb_dev), __func__)); + sc->wi_usb_dev.dv_xname, __func__)); sc->wi_info = ((char *)c->wi_usb_buf) + 2; wi_update_stats(&sc->sc_wi); @@ -1643,7 +1643,7 @@ wi_usb_txfrm(struct wi_usb_softc *sc, wi_usb_usbin *uin, int total_len) DPRINTFN(2,("%s: %s: enter status=%d\n", - USBDEVNAME(sc->wi_usb_dev), __func__, status)); + sc->wi_usb_dev.dv_xname, __func__, status)); if (sc->txresp == WI_CMD_TX) { sc->txresperr=status; @@ -1653,7 +1653,7 @@ wi_usb_txfrm(struct wi_usb_softc *sc, wi_usb_usbin *uin, int total_len) if (status != 0) /* XXX */ wi_watchdog_usb(ifp); DPRINTFN(1,("%s: %s: txresp not expected status=%d \n", - USBDEVNAME(sc->wi_usb_dev), __func__, status)); + sc->wi_usb_dev.dv_xname, __func__, status)); } splx(s); @@ -1664,7 +1664,7 @@ wi_usb_rxfrm(struct wi_usb_softc *sc, wi_usb_usbin *uin, int total_len) int s; DPRINTFN(5,("%s: %s: enter len=%d\n", - USBDEVNAME(sc->wi_usb_dev), __func__, total_len)); + sc->wi_usb_dev.dv_xname, __func__, total_len)); s = splnet(); @@ -1683,7 +1683,7 @@ void wi_usb_start_thread(void *arg) { struct wi_usb_softc *sc = arg; - kthread_create (wi_usb_thread, arg, NULL, USBDEVNAME(sc->wi_usb_dev)); + kthread_create (wi_usb_thread, arg, NULL, sc->wi_usb_dev.dv_xname); } void @@ -1699,7 +1699,7 @@ wi_start_usb(struct ifnet *ifp) s = splnet(); DPRINTFN(5,("%s: %s:\n", - USBDEVNAME(sc->wi_usb_dev), __func__)); + sc->wi_usb_dev.dv_xname, __func__)); if (wi_usb_tx_lock_try(sc)) { /* lock acquired do start now */ @@ -1745,7 +1745,7 @@ wi_inquire_usb(void *xsc) s = splnet(); DPRINTFN(2,("%s: %s:\n", - USBDEVNAME(sc->wi_usb_dev), __func__)); + sc->wi_usb_dev.dv_xname, __func__)); sc->wi_thread_info->status |= WI_INQUIRE; @@ -1772,7 +1772,7 @@ wi_watchdog_usb(struct ifnet *ifp) s = splnet(); DPRINTFN(5,("%s: %s: ifp %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, ifp)); + sc->wi_usb_dev.dv_xname, __func__, ifp)); sc->wi_thread_info->status |= WI_WATCHDOG; @@ -1834,13 +1834,13 @@ wi_usb_thread(void *arg) } DPRINTFN(5,("%s: %s: dying %x status %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, + sc->wi_usb_dev.dv_xname, __func__, wi_thread_info->dying, wi_thread_info->status)); wi_usb_ctl_lock(sc); DPRINTFN(5,("%s: %s: starting %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, + sc->wi_usb_dev.dv_xname, __func__, wi_thread_info->status)); s = splusb(); @@ -1862,7 +1862,7 @@ wi_usb_thread(void *arg) splx(s); DPRINTFN(5,("%s: %s: ending %x\n", - USBDEVNAME(sc->wi_usb_dev), __func__, + sc->wi_usb_dev.dv_xname, __func__, wi_thread_info->status)); wi_usb_ctl_unlock(sc); @@ -1883,7 +1883,7 @@ wi_usb_tx_lock_try(struct wi_usb_softc *sc) s = splnet(); - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), __func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); if (sc->wi_lock != 0) { return 0; /* failed to aquire lock */ @@ -1903,11 +1903,11 @@ wi_usb_tx_lock(struct wi_usb_softc *sc) s = splnet(); again: - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), __func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); if (sc->wi_lock != 0) { sc->wi_lockwait++; - DPRINTFN(10,("%s: %s: busy %d\n", USBDEVNAME(sc->wi_usb_dev), + DPRINTFN(10,("%s: %s: busy %d\n", sc->wi_usb_dev.dv_xname, __func__, sc->wi_lockwait )); tsleep(&sc->wi_lock, PRIBIO, "witxl", 0); } @@ -1930,11 +1930,11 @@ wi_usb_tx_unlock(struct wi_usb_softc *sc) sc->wi_lock = 0; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), __func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); if (sc->wi_lockwait) { DPRINTFN(10,("%s: %s: waking\n", - USBDEVNAME(sc->wi_usb_dev), __func__)); + sc->wi_usb_dev.dv_xname, __func__)); sc->wi_lockwait = 0; wakeup(&sc->wi_lock); } @@ -1950,7 +1950,7 @@ wi_usb_ctl_lock(struct wi_usb_softc *sc) s = splnet(); again: - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); if (sc->wi_ctllock != 0) { @@ -1961,7 +1961,7 @@ wi_usb_ctl_lock(struct wi_usb_softc *sc) return; } sc->wi_ctllockwait++; - DPRINTFN(10,("%s: %s: busy %d\n", USBDEVNAME(sc->wi_usb_dev), + DPRINTFN(10,("%s: %s: busy %d\n", sc->wi_usb_dev.dv_xname, __func__, sc->wi_ctllockwait )); tsleep(&sc->wi_ctllock, PRIBIO, "wiusbthr", 0); } @@ -1986,11 +1986,11 @@ wi_usb_ctl_unlock(struct wi_usb_softc *sc) sc->wi_ctllock--; - DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->wi_usb_dev), __func__)); + DPRINTFN(10,("%s: %s: enter\n", sc->wi_usb_dev.dv_xname, __func__)); if (sc->wi_ctllock == 0 && sc->wi_ctllockwait) { DPRINTFN(10,("%s: %s: waking\n", - USBDEVNAME(sc->wi_usb_dev), __func__)); + sc->wi_usb_dev.dv_xname, __func__)); sc->wi_ctllockwait = 0; sc->wi_curproc = 0; wakeup(&sc->wi_ctllock); diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 0105d81eab3..7f822b05b8f 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.55 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.56 2007/06/10 14:49:00 mbalmer Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -242,7 +242,7 @@ zyd_attachhook(void *xsc) fwname = (sc->mac_rev == ZYD_ZD1211) ? "zd1211" : "zd1211b"; if ((error = loadfirmware(fwname, &fw, &size)) != 0) { printf("%s: could not read firmware file %s (error=%d)\n", - USBDEVNAME(sc->sc_dev), fwname, error); + sc->sc_dev.dv_xname, fwname, error); return; } @@ -250,7 +250,7 @@ zyd_attachhook(void *xsc) free(fw, M_DEVBUF); if (error != 0) { printf("%s: could not load firmware (error=%d)\n", - USBDEVNAME(sc->sc_dev), error); + sc->sc_dev.dv_xname, error); return; } @@ -270,7 +270,7 @@ zyd_attach(struct device *parent, struct device *self, void *aux) sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); sc->mac_rev = zyd_lookup(uaa->vendor, uaa->product)->rev; @@ -278,7 +278,7 @@ zyd_attach(struct device *parent, struct device *self, void *aux) ddesc = usbd_get_device_descriptor(sc->sc_udev); if (UGETW(ddesc->bcdDevice) < 0x4330) { printf("%s: device version mismatch: 0x%x " - "(only >= 43.30 supported)\n", USBDEVNAME(sc->sc_dev), + "(only >= 43.30 supported)\n", sc->sc_dev.dv_xname, UGETW(ddesc->bcdDevice)); return; } @@ -307,7 +307,7 @@ zyd_complete_attach(struct zyd_softc *sc) error = usbd_set_config_no(sc->sc_udev, ZYD_CONFIG_NO, 1); if (error != 0) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -315,33 +315,33 @@ zyd_complete_attach(struct zyd_softc *sc) &sc->sc_iface); if (error != 0) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } if ((error = zyd_open_pipes(sc)) != 0) { - printf("%s: could not open pipes\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not open pipes\n", sc->sc_dev.dv_xname); goto fail; } if ((error = zyd_read_eeprom(sc)) != 0) { - printf("%s: could not read EEPROM\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not read EEPROM\n", sc->sc_dev.dv_xname); goto fail; } if ((error = zyd_rf_attach(sc, sc->rf_rev)) != 0) { - printf("%s: could not attach RF\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not attach RF\n", sc->sc_dev.dv_xname); goto fail; } if ((error = zyd_hw_init(sc)) != 0) { printf("%s: hardware initialization failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } printf("%s: HMAC ZD1211%s, FW %02x.%02x, RF %s, PA %x, address %s\n", - USBDEVNAME(sc->sc_dev), (sc->mac_rev == ZYD_ZD1211) ? "": "B", + sc->sc_dev.dv_xname, (sc->mac_rev == ZYD_ZD1211) ? "": "B", sc->fw_rev >> 8, sc->fw_rev & 0xff, zyd_rf_name(sc->rf_rev), sc->pa_rev, ether_sprintf(ic->ic_myaddr)); @@ -376,7 +376,7 @@ zyd_complete_attach(struct zyd_softc *sc) ifp->if_start = zyd_start; ifp->if_watchdog = zyd_watchdog; IFQ_SET_READY(&ifp->if_snd); - memcpy(ifp->if_xname, USBDEVNAME(sc->sc_dev), IFNAMSIZ); + memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); if_attach(ifp); ieee80211_ifattach(ifp); @@ -468,7 +468,7 @@ zyd_open_pipes(struct zyd_softc *sc) USBD_DEFAULT_INTERVAL); if (error != 0) { printf("%s: open rx intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -477,7 +477,7 @@ zyd_open_pipes(struct zyd_softc *sc) &sc->zyd_ep[ZYD_ENDPT_IOUT]); if (error != 0) { printf("%s: open tx intr pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -486,7 +486,7 @@ zyd_open_pipes(struct zyd_softc *sc) &sc->zyd_ep[ZYD_ENDPT_BIN]); if (error != 0) { printf("%s: open rx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -495,7 +495,7 @@ zyd_open_pipes(struct zyd_softc *sc) &sc->zyd_ep[ZYD_ENDPT_BOUT]); if (error != 0) { printf("%s: open tx pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -538,14 +538,14 @@ zyd_alloc_tx_list(struct zyd_softc *sc) data->xfer = usbd_alloc_xfer(sc->sc_udev); if (data->xfer == NULL) { printf("%s: could not allocate tx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } data->buf = usbd_alloc_buffer(data->xfer, ZYD_MAX_TXBUFSZ); if (data->buf == NULL) { printf("%s: could not allocate tx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -592,14 +592,14 @@ zyd_alloc_rx_list(struct zyd_softc *sc) data->xfer = usbd_alloc_xfer(sc->sc_udev); if (data->xfer == NULL) { printf("%s: could not allocate rx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } data->buf = usbd_alloc_buffer(data->xfer, ZYX_MAX_RXBUFSZ); if (data->buf == NULL) { printf("%s: could not allocate rx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -777,7 +777,7 @@ zyd_cmd(struct zyd_softc *sc, uint16_t code, const void *idata, int ilen, if (flags & ZYD_CMD_FLAG_READ) splx(s); printf("%s: could not send command (error=%s)\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); (void)usbd_free_xfer(xfer); return EIO; } @@ -1468,7 +1468,7 @@ zyd_rf_attach(struct zyd_softc *sc, uint8_t type) break; default: printf("%s: sorry, radio \"%s\" is not supported yet\n", - USBDEVNAME(sc->sc_dev), zyd_rf_name(type)); + sc->sc_dev.dv_xname, zyd_rf_name(type)); return EINVAL; } return 0; @@ -1558,7 +1558,7 @@ zyd_hw_init(struct zyd_softc *sc) zyd_unlock_phy(sc); if (error != 0) { printf("%s: radio initialization failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -1826,7 +1826,7 @@ zyd_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) wakeup(sc); /* wakeup caller */ } else { - printf("%s: unknown notification %x\n", USBDEVNAME(sc->sc_dev), + printf("%s: unknown notification %x\n", sc->sc_dev.dv_xname, letoh16(cmd->code)); } } @@ -1845,7 +1845,7 @@ zyd_rx_data(struct zyd_softc *sc, const uint8_t *buf, uint16_t len) if (len < ZYD_MIN_FRAGSZ) { printf("%s: frame too short (length=%d)\n", - USBDEVNAME(sc->sc_dev), len); + sc->sc_dev.dv_xname, len); ifp->if_ierrors++; return; } @@ -1856,7 +1856,7 @@ zyd_rx_data(struct zyd_softc *sc, const uint8_t *buf, uint16_t len) if (stat->flags & ZYD_RX_ERROR) { DPRINTF(("%s: RX status indicated error (%x)\n", - USBDEVNAME(sc->sc_dev), stat->flags)); + sc->sc_dev.dv_xname, stat->flags)); ifp->if_ierrors++; return; } @@ -1869,7 +1869,7 @@ zyd_rx_data(struct zyd_softc *sc, const uint8_t *buf, uint16_t len) MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { printf("%s: could not allocate rx mbuf\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); ifp->if_ierrors++; return; } @@ -1877,7 +1877,7 @@ zyd_rx_data(struct zyd_softc *sc, const uint8_t *buf, uint16_t len) MCLGET(m, M_DONTWAIT); if (!(m->m_flags & M_EXT)) { printf("%s: could not allocate rx mbuf cluster\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); m_freem(m); ifp->if_ierrors++; return; @@ -1947,7 +1947,7 @@ zyd_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (len < ZYD_MIN_RXBUFSZ) { printf("%s: xfer too short (length=%d)\n", - USBDEVNAME(sc->sc_dev), len); + sc->sc_dev.dv_xname, len); ifp->if_ierrors++; goto skip; } @@ -1998,7 +1998,7 @@ zyd_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; printf("%s: could not transmit buffer: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(status)); + sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) { usbd_clear_endpoint_stall_async( @@ -2141,7 +2141,7 @@ zyd_tx_data(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) data->buf + sizeof (struct zyd_tx_desc)); DPRINTFN(10, ("%s: sending data frame len=%u rate=%u xferlen=%u\n", - USBDEVNAME(sc->sc_dev), m0->m_pkthdr.len, rate, xferlen)); + sc->sc_dev.dv_xname, m0->m_pkthdr.len, rate, xferlen)); m_freem(m0); /* mbuf no longer needed */ @@ -2235,7 +2235,7 @@ zyd_watchdog(struct ifnet *ifp) if (sc->tx_timer > 0) { if (--sc->tx_timer == 0) { - printf("%s: device timeout\n", USBDEVNAME(sc->sc_dev)); + printf("%s: device timeout\n", sc->sc_dev.dv_xname); /* zyd_init(ifp); XXX needs a process context ? */ ifp->if_oerrors++; return; @@ -2374,12 +2374,12 @@ zyd_init(struct ifnet *ifp) */ if ((error = zyd_alloc_tx_list(sc)) != 0) { printf("%s: could not allocate Tx list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } if ((error = zyd_alloc_rx_list(sc)) != 0) { printf("%s: could not allocate Rx list\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -2395,7 +2395,7 @@ zyd_init(struct ifnet *ifp) error = usbd_transfer(data->xfer); if (error != USBD_IN_PROGRESS && error != 0) { printf("%s: could not queue Rx transfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } } diff --git a/sys/dev/usb/moscom.c b/sys/dev/usb/moscom.c index 0dce335ceb5..eb1e77790a6 100644 --- a/sys/dev/usb/moscom.c +++ b/sys/dev/usb/moscom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: moscom.c,v 1.6 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: moscom.c,v 1.7 2007/06/10 14:49:00 mbalmer Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -195,12 +195,12 @@ moscom_attach(struct device *parent, struct device *self, void *aux) bzero(&uca, sizeof(uca)); sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); if (usbd_set_config_index(sc->sc_udev, MOSCOM_CONFIG_NO, 1) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -210,7 +210,7 @@ moscom_attach(struct device *parent, struct device *self, void *aux) &sc->sc_iface); if (error != 0) { printf("%s: could not get interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -222,7 +222,7 @@ moscom_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor found for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -236,7 +236,7 @@ moscom_attach(struct device *parent, struct device *self, void *aux) } if (uca.bulkin == -1 || uca.bulkout == -1) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 0ea46a6a2a3..fcb1ef12ce8 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ohci.c,v 1.80 2007/06/10 10:15:35 mbalmer Exp $ */ +/* $OpenBSD: ohci.c,v 1.81 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ @@ -622,7 +622,7 @@ ohci_checkrev(ohci_softc_t *sc) if (OHCI_REV_HI(rev) != 1 || OHCI_REV_LO(rev) != 0) { printf("%s: unsupported OHCI revision\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); sc->sc_bus.usbrev = USBREV_UNKNOWN; return (USBD_INVAL); } @@ -653,7 +653,7 @@ ohci_handover(ohci_softc_t *sc) OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_MIE); if (ctl & OHCI_IR) { printf("%s: SMM does not respond, will reset\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); } } @@ -781,7 +781,7 @@ ohci_init(ohci_softc_t *sc) * This reset should not be necessary according to the OHCI spec, but * without it some controllers do not start. */ - DPRINTF(("%s: resetting\n", USBDEVNAME(sc->sc_bus.bdev))); + DPRINTF(("%s: resetting\n", sc->sc_bus.bdev.dv_xname)); OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET | rwc); usb_delay_ms(&sc->sc_bus, USB_BUS_RESET_DELAY); @@ -796,7 +796,7 @@ ohci_init(ohci_softc_t *sc) break; } if (hcr) { - printf("%s: reset timeout\n", USBDEVNAME(sc->sc_bus.bdev)); + printf("%s: reset timeout\n", sc->sc_bus.bdev.dv_xname); err = USBD_IOERROR; goto bad5; } @@ -1154,7 +1154,7 @@ ohci_intr1(ohci_softc_t *sc) sc->sc_overrun_cnt++; if (usbd_ratecheck(&sc->sc_overrun_ntc)) { printf("%s: %u scheduling overruns\n", - USBDEVNAME(sc->sc_bus.bdev), sc->sc_overrun_cnt); + sc->sc_bus.bdev.dv_xname, sc->sc_overrun_cnt); sc->sc_overrun_cnt = 0; } /* XXX do what */ @@ -1166,12 +1166,12 @@ ohci_intr1(ohci_softc_t *sc) eintrs &= ~OHCI_WDH; } if (eintrs & OHCI_RD) { - printf("%s: resume detect\n", USBDEVNAME(sc->sc_bus.bdev)); + printf("%s: resume detect\n", sc->sc_bus.bdev.dv_xname); /* XXX process resume detect */ } if (eintrs & OHCI_UE) { printf("%s: unrecoverable error, controller halted\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); /* XXX what else */ } @@ -1183,7 +1183,7 @@ ohci_intr1(ohci_softc_t *sc) */ ohci_rhsc_able(sc, 0); DPRINTFN(2, ("%s: rhsc interrupt disabled\n", - USBDEVNAME(sc->sc_bus.bdev))); + sc->sc_bus.bdev.dv_xname)); /* Do not allow RHSC interrupts > 1 per second */ timeout_del(&sc->sc_tmo_rhsc); @@ -1199,7 +1199,7 @@ ohci_intr1(ohci_softc_t *sc) OWRITE4(sc, OHCI_INTERRUPT_DISABLE, eintrs); sc->sc_eintrs &= ~eintrs; printf("%s: blocking intrs 0x%x\n", - USBDEVNAME(sc->sc_bus.bdev), eintrs); + sc->sc_bus.bdev.dv_xname, eintrs); } return (1); @@ -1227,7 +1227,7 @@ ohci_rhsc_enable(void *v_sc) s = splhardusb(); ohci_rhsc(sc, sc->sc_intrxfer); DPRINTFN(2, ("%s: rhsc interrupt enabled\n", - USBDEVNAME(sc->sc_bus.bdev))); + sc->sc_bus.bdev.dv_xname)); ohci_rhsc_able(sc, 1); splx(s); @@ -3248,7 +3248,7 @@ ohci_device_isoc_enter(usbd_xfer_handle xfer) if (nsitd == NULL) { /* XXX what now? */ printf("%s: isoc TD alloc failed\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); return; } @@ -3277,7 +3277,7 @@ ohci_device_isoc_enter(usbd_xfer_handle xfer) if (nsitd == NULL) { /* XXX what now? */ printf("%s: isoc TD alloc failed\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); return; } /* Fixup last used ITD */ diff --git a/sys/dev/usb/uark.c b/sys/dev/usb/uark.c index af1689a52c0..cde4c84d2f4 100644 --- a/sys/dev/usb/uark.c +++ b/sys/dev/usb/uark.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uark.c,v 1.6 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uark.c,v 1.7 2007/06/10 14:49:00 mbalmer Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -122,12 +122,12 @@ uark_attach(struct device *parent, struct device *self, void *aux) bzero(&uca, sizeof(uca)); sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); if (usbd_set_config_index(sc->sc_udev, UARK_CONFIG_NO, 1) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -137,7 +137,7 @@ uark_attach(struct device *parent, struct device *self, void *aux) &sc->sc_iface); if (error != 0) { printf("%s: could not get interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -149,7 +149,7 @@ uark_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor found for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -163,7 +163,7 @@ uark_attach(struct device *parent, struct device *self, void *aux) } if (uca.bulkin == -1 || uca.bulkout == -1) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -326,7 +326,7 @@ uark_break(void *vsc, int portno, int onoff) #ifdef UARK_DEBUG struct uark_softc *sc = vsc; - printf("%s: break %s!\n", USBDEVNAME(sc->sc_dev), + printf("%s: break %s!\n", sc->sc_dev.dv_xname, onoff ? "on" : "off"); if (onoff) diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index 48cd8c31f93..1b27098a9dd 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uaudio.c,v 1.43 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uaudio.c,v 1.44 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */ /* @@ -400,14 +400,14 @@ uaudio_attach(struct device *parent, struct device *self, void *aux) cdesc = usbd_get_config_descriptor(sc->sc_udev); if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } err = uaudio_identify(sc, cdesc); if (err) { printf("%s: audio descriptors make no sense, error=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); return; } @@ -434,12 +434,12 @@ uaudio_attach(struct device *parent, struct device *self, void *aux) for (j = 0; j < sc->sc_nalts; j++) { if (sc->sc_alts[j].ifaceh == NULL) { printf("%s: alt %d missing AS interface(s)\n", - USBDEVNAME(sc->sc_dev), j); + sc->sc_dev.dv_xname, j); return; } } - printf("%s: audio rev %d.%02x", USBDEVNAME(sc->sc_dev), + printf("%s: audio rev %d.%02x", sc->sc_dev.dv_xname, sc->sc_audio_rev >> 8, sc->sc_audio_rev & 0xff); sc->sc_playchan.sc = sc->sc_recchan.sc = sc; @@ -1534,7 +1534,7 @@ uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, if (asf1d->bFormatType != FORMAT_TYPE_I) { printf("%s: ignored setting with type %d format\n", - USBDEVNAME(sc->sc_dev), UGETW(asid->wFormatTag)); + sc->sc_dev.dv_xname, UGETW(asid->wFormatTag)); return (USBD_NORMAL_COMPLETION); } @@ -1565,7 +1565,7 @@ uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, sync = TRUE; #ifndef UAUDIO_MULTIPLE_ENDPOINTS printf("%s: ignored input endpoint of type adaptive\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return (USBD_NORMAL_COMPLETION); #endif } @@ -1573,7 +1573,7 @@ uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, sync = TRUE; #ifndef UAUDIO_MULTIPLE_ENDPOINTS printf("%s: ignored output endpoint of type async\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return (USBD_NORMAL_COMPLETION); #endif } @@ -1589,12 +1589,12 @@ uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, if (sync && id->bNumEndpoints <= 1) { printf("%s: a sync-pipe endpoint but no other endpoint\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return USBD_INVAL; } if (!sync && id->bNumEndpoints > 1) { printf("%s: non sync-pipe endpoint but multiple endpoints\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return USBD_INVAL; } epdesc1 = NULL; @@ -1615,19 +1615,19 @@ uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, return USBD_INVAL; if (epdesc1->bSynchAddress != 0) { printf("%s: invalid endpoint: bSynchAddress=0\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return USBD_INVAL; } if (UE_GET_XFERTYPE(epdesc1->bmAttributes) != UE_ISOCHRONOUS) { printf("%s: invalid endpoint: bmAttributes=0x%x\n", - USBDEVNAME(sc->sc_dev), epdesc1->bmAttributes); + sc->sc_dev.dv_xname, epdesc1->bmAttributes); return USBD_INVAL; } if (epdesc1->bEndpointAddress != ed->bSynchAddress) { printf("%s: invalid endpoint addresses: " "ep[0]->bSynchAddress=0x%x " "ep[1]->bEndpointAddress=0x%x\n", - USBDEVNAME(sc->sc_dev), ed->bSynchAddress, + sc->sc_dev.dv_xname, ed->bSynchAddress, epdesc1->bEndpointAddress); return USBD_INVAL; } @@ -1639,7 +1639,7 @@ uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, prec = asf1d->bBitResolution; if (prec != 8 && prec != 16 && prec != 24) { printf("%s: ignored setting with precision %d\n", - USBDEVNAME(sc->sc_dev), prec); + sc->sc_dev.dv_xname, prec); return (USBD_NORMAL_COMPLETION); } switch (format) { @@ -1672,11 +1672,11 @@ uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, case UA_FMT_IEEE_FLOAT: default: printf("%s: ignored setting with format %d\n", - USBDEVNAME(sc->sc_dev), format); + sc->sc_dev.dv_xname, format); return (USBD_NORMAL_COMPLETION); } #ifdef UAUDIO_DEBUG - printf("%s: %s: %dch, %d/%dbit, %s,", USBDEVNAME(sc->sc_dev), + printf("%s: %s: %dch, %d/%dbit, %s,", sc->sc_dev.dv_xname, dir == UE_DIR_IN ? "recording" : "playback", chan, prec, asf1d->bSubFrameSize * 8, format_str); if (asf1d->bSamFreqType == UA_SAMP_CONTNUOUS) { @@ -1746,7 +1746,7 @@ uaudio_identify_as(struct uaudio_softc *sc, default: printf("%s: ignored audio interface with %d " "endpoints\n", - USBDEVNAME(sc->sc_dev), id->bNumEndpoints); + sc->sc_dev.dv_xname, id->bNumEndpoints); break; } id = uaudio_find_iface(buf, size, &offs,UISUBCLASS_AUDIOSTREAM); @@ -1759,7 +1759,7 @@ uaudio_identify_as(struct uaudio_softc *sc, if (sc->sc_mode == 0) { printf("%s: no usable endpoint found\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return (USBD_INVAL); } diff --git a/sys/dev/usb/uberry.c b/sys/dev/usb/uberry.c index cfa1a1c71f7..568e32bd937 100644 --- a/sys/dev/usb/uberry.c +++ b/sys/dev/usb/uberry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uberry.c,v 1.7 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uberry.c,v 1.8 2007/06/10 14:49:00 mbalmer Exp $ */ /*- * Copyright (c) 2006 Theo de Raadt <deraadt@openbsd.org> @@ -73,16 +73,16 @@ uberry_attach(struct device *parent, struct device *self, void *aux) sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); /* Enable the device, then it cannot idle, and will charge */ if (usbd_set_config_no(sc->sc_udev, UBERRY_CONFIG_NO, 1) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } - printf("%s: Charging enabled\n", USBDEVNAME(sc->sc_dev)); + printf("%s: Charging enabled\n", sc->sc_dev.dv_xname); usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, &sc->sc_dev); diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index a09c44c42ef..9700272b983 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsa.c,v 1.26 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: ubsa.c,v 1.27 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: ubsa.c,v 1.5 2002/11/25 00:51:33 fvdl Exp $ */ /*- * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. @@ -261,7 +261,7 @@ ubsa_attach(struct device *parent, struct device *self, void *aux) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfop; - const char *devname = USBDEVNAME(sc->sc_dev); + const char *devname = sc->sc_dev.dv_xname; usbd_status err; struct ucom_attach_args uca; int i; @@ -324,7 +324,7 @@ ubsa_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; goto error; } @@ -446,7 +446,7 @@ ubsa_request(struct ubsa_softc *sc, u_int8_t request, u_int16_t value) err = usbd_do_request(sc->sc_udev, &req, 0); if (err && err != USBD_STALLED) printf("%s: ubsa_request: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (err); } @@ -532,7 +532,7 @@ ubsa_baudrate(struct ubsa_softc *sc, speed_t speed) default: DPRINTF(("%s: ubsa_param: unsupported baudrate, " "forcing default of 9600\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); value = B230400 / B9600; break; }; @@ -575,7 +575,7 @@ ubsa_databits(struct ubsa_softc *sc, tcflag_t cflag) default: DPRINTF(("%s: ubsa_param: unsupported databits requested, " "forcing default of 8\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); value = 3; } @@ -650,7 +650,7 @@ ubsa_open(void *addr, int portno) UBSA_INTR_INTERVAL); if (err) { printf("%s: cannot open interrupt pipe (addr %d)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sc_intr_number); return (EIO); } @@ -674,12 +674,12 @@ ubsa_close(void *addr, int portno) err = usbd_abort_pipe(sc->sc_intr_pipe); if (err) printf("%s: abort interrupt pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_intr_pipe); if (err) printf("%s: close interrupt pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, usbd_errstr(err)); free(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; @@ -701,7 +701,7 @@ ubsa_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; DPRINTF(("%s: ubsa_intr: abnormal status: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(status))); + sc->sc_dev.dv_xname, usbd_errstr(status))); usbd_clear_endpoint_stall_async(sc->sc_intr_pipe); return; } @@ -711,7 +711,7 @@ ubsa_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) sc->sc_msr = buf[3]; DPRINTF(("%s: ubsa lsr = 0x%02x, msr = 0x%02x\n", - USBDEVNAME(sc->sc_dev), sc->sc_lsr, sc->sc_msr)); + sc->sc_dev.dv_xname, sc->sc_lsr, sc->sc_msr)); ucom_status_change((struct ucom_softc *)sc->sc_subdev); } diff --git a/sys/dev/usb/ubt.c b/sys/dev/usb/ubt.c index c90a6814b15..2abf5e55846 100644 --- a/sys/dev/usb/ubt.c +++ b/sys/dev/usb/ubt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubt.c,v 1.5 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: ubt.c,v 1.6 2007/06/10 14:49:00 mbalmer Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -301,7 +301,7 @@ ubt_attach(struct device *parent, struct device *self, void *aux) sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); /* @@ -310,7 +310,7 @@ ubt_attach(struct device *parent, struct device *self, void *aux) err = usbd_set_config_index(sc->sc_udev, 0, 1); if (err) { printf("%s: failed to set configuration idx 0: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return; } @@ -324,7 +324,7 @@ ubt_attach(struct device *parent, struct device *self, void *aux) err = usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface0); if (err) { printf("%s: Could not get interface 0 handle %s (%d)\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err), err); + sc->sc_dev.dv_xname, usbd_errstr(err), err); return; } @@ -342,7 +342,7 @@ ubt_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface0, i); if (ed == NULL) { printf("%s: could not read endpoint descriptor %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return; } @@ -360,19 +360,19 @@ ubt_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_evt_addr == -1) { printf("%s: missing INTERRUPT endpoint on interface 0\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } if (sc->sc_aclrd_addr == -1) { printf("%s: missing BULK IN endpoint on interface 0\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } if (sc->sc_aclwr_addr == -1) { printf("%s: missing BULK OUT endpoint on interface 0\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -389,7 +389,7 @@ ubt_attach(struct device *parent, struct device *self, void *aux) err = usbd_device2interface_handle(sc->sc_udev, 1, &sc->sc_iface1); if (err) { printf("%s: Could not get interface 1 handle %s (%d)\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err), err); + sc->sc_dev.dv_xname, usbd_errstr(err), err); return; } @@ -397,7 +397,7 @@ ubt_attach(struct device *parent, struct device *self, void *aux) cd = usbd_get_config_descriptor(sc->sc_udev); if (cd == NULL) { printf("%s: could not get config descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -408,14 +408,14 @@ ubt_attach(struct device *parent, struct device *self, void *aux) err = ubt_set_isoc_config(sc); if (err) { printf("%s: ISOC config failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } /* Attach HCI */ sc->sc_unit.hci_softc = self; - sc->sc_unit.hci_devname = USBDEVNAME(sc->sc_dev); + sc->sc_unit.hci_devname = sc->sc_dev.dv_xname; sc->sc_unit.hci_enable = ubt_enable; sc->sc_unit.hci_disable = ubt_disable; sc->sc_unit.hci_start_cmd = ubt_xmit_cmd_start; @@ -505,7 +505,7 @@ ubt_set_isoc_config(struct ubt_softc *sc) if (err != USBD_NORMAL_COMPLETION) { printf( "%s: Could not set config %d on ISOC interface. %s (%d)\n", - USBDEVNAME(sc->sc_dev), sc->sc_config, usbd_errstr(err), err); + sc->sc_dev.dv_xname, sc->sc_config, usbd_errstr(err), err); return err == USBD_IN_USE ? EBUSY : EIO; } @@ -530,13 +530,13 @@ ubt_set_isoc_config(struct ubt_softc *sc) ed = usbd_interface2endpoint_descriptor(sc->sc_iface1, i); if (ed == NULL) { printf("%s: could not read endpoint descriptor %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return EIO; } DPRINTFN(5, "%s: endpoint type %02x (%02x) addr %02x (%s)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, UE_GET_XFERTYPE(ed->bmAttributes), UE_GET_ISO_TYPE(ed->bmAttributes), ed->bEndpointAddress, @@ -557,14 +557,14 @@ ubt_set_isoc_config(struct ubt_softc *sc) if (rd_addr == -1) { printf( "%s: missing ISOC IN endpoint on interface config %d\n", - USBDEVNAME(sc->sc_dev), sc->sc_config); + sc->sc_dev.dv_xname, sc->sc_config); return ENOENT; } if (wr_addr == -1) { printf( "%s: missing ISOC OUT endpoint on interface config %d\n", - USBDEVNAME(sc->sc_dev), sc->sc_config); + sc->sc_dev.dv_xname, sc->sc_config); return ENOENT; } @@ -572,14 +572,14 @@ ubt_set_isoc_config(struct ubt_softc *sc) #ifdef DIAGNOSTIC if (rd_size > MLEN) { printf("%s: rd_size=%d exceeds MLEN\n", - USBDEVNAME(sc->sc_dev), rd_size); + sc->sc_dev.dv_xname, rd_size); return EOVERFLOW; } if (wr_size > MLEN) { printf("%s: wr_size=%d exceeds MLEN\n", - USBDEVNAME(sc->sc_dev), wr_size); + sc->sc_dev.dv_xname, wr_size); return EOVERFLOW; } @@ -1454,7 +1454,7 @@ ubt_recv_sco_complete(usbd_xfer_handle xfer, MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { printf("%s: out of memory (xfer halted)\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_unit.hci_stats.err_rx++; return; /* lost sync */ diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index a02fe611570..9d26b07f768 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.37 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: ucom.c,v 1.38 2007/06/10 14:49:00 mbalmer Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -331,7 +331,7 @@ ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p) &sc->sc_bulkin_pipe); if (err) { DPRINTF(("%s: open bulk out error (addr %d), err=%s\n", - USBDEVNAME(sc->sc_dev), sc->sc_bulkin_no, + sc->sc_dev.dv_xname, sc->sc_bulkin_no, usbd_errstr(err))); error = EIO; goto fail_0; @@ -340,7 +340,7 @@ ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p) USBD_EXCLUSIVE_USE, &sc->sc_bulkout_pipe); if (err) { DPRINTF(("%s: open bulk in error (addr %d), err=%s\n", - USBDEVNAME(sc->sc_dev), sc->sc_bulkout_no, + sc->sc_dev.dv_xname, sc->sc_bulkout_no, usbd_errstr(err))); error = EIO; goto fail_1; @@ -1131,7 +1131,7 @@ ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) DPRINTFN(7,("ucomreadcb: char=0x%02x\n", *cp)); if ((*rint)(*cp++, tp) == -1) { /* XXX what should we do? */ - printf("%s: lost %d chars\n", USBDEVNAME(sc->sc_dev), + printf("%s: lost %d chars\n", sc->sc_dev.dv_xname, cc); break; } @@ -1140,7 +1140,7 @@ ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) err = ucomstartread(sc); if (err) { - printf("%s: read start failed\n", USBDEVNAME(sc->sc_dev)); + printf("%s: read start failed\n", sc->sc_dev.dv_xname); /* XXX what should we dow now? */ } } diff --git a/sys/dev/usb/udcf.c b/sys/dev/usb/udcf.c index 54c50582db3..7cccb53840d 100644 --- a/sys/dev/usb/udcf.c +++ b/sys/dev/usb/udcf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udcf.c,v 1.35 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: udcf.c,v 1.36 2007/06/10 14:49:00 mbalmer Exp $ */ /* * Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> @@ -165,18 +165,18 @@ udcf_attach(struct device *parent, struct device *self, void *aux) if ((err = usbd_set_config_index(dev, 0, 1))) { DPRINTF(("\n%s: failed to set configuration, err=%s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err))); + sc->sc_dev.dv_xname, usbd_errstr(err))); goto fishy; } if ((err = usbd_device2interface_handle(dev, 0, &iface))) { DPRINTF(("\n%s: failed to get interface, err=%s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err))); + sc->sc_dev.dv_xname, usbd_errstr(err))); goto fishy; } devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); id = usbd_get_interface_descriptor(iface); @@ -197,7 +197,7 @@ udcf_attach(struct device *parent, struct device *self, void *aux) sc->sc_last = 0L; sc->sc_last_tv.tv_sec = 0L; - strlcpy(sc->sc_sensordev.xname, USBDEVNAME(sc->sc_dev), + strlcpy(sc->sc_sensordev.xname, sc->sc_dev.dv_xname, sizeof(sc->sc_sensordev.xname)); sc->sc_sensor.type = SENSOR_TIMEDELTA; diff --git a/sys/dev/usb/udsbr.c b/sys/dev/usb/udsbr.c index b2bcc0185fd..9bf33edded4 100644 --- a/sys/dev/usb/udsbr.c +++ b/sys/dev/usb/udsbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udsbr.c,v 1.14 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: udsbr.c,v 1.15 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: udsbr.c,v 1.7 2002/07/11 21:14:27 augustss Exp $ */ /* @@ -131,13 +131,13 @@ udsbr_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(10,("udsbr_attach: sc=%p\n", sc)); devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, UDSBR_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -201,7 +201,7 @@ udsbr_req(struct udsbr_softc *sc, int ureq, int value, int index) USETW(req.wLength, 1); err = usbd_do_request(sc->sc_udev, &req, &data); if (err) { - printf("%s: request failed err=%d\n", USBDEVNAME(sc->sc_dev), + printf("%s: request failed err=%d\n", sc->sc_dev.dv_xname, err); } return !(data & 1); diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c index 452b22aec36..87c7857670c 100644 --- a/sys/dev/usb/ueagle.c +++ b/sys/dev/usb/ueagle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ueagle.c,v 1.18 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: ueagle.c,v 1.19 2007/06/10 14:49:01 mbalmer Exp $ */ /*- * Copyright (c) 2003-2006 @@ -150,7 +150,7 @@ ueagle_attachhook(void *xsc) if (ezload_downloads_and_reset(sc->sc_udev, firmwares) != 0) { printf("%s: could not download firmware\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } } @@ -184,23 +184,23 @@ ueagle_attach(struct device *parent, struct device *self, void *aux) } devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); if (usbd_set_config_no(sc->sc_udev, UEAGLE_CONFIG_NO, 0) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } if (ueagle_getesi(sc, addr) != 0) { printf("%s: could not read end system identifier\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } printf("%s: address: %02x:%02x:%02x:%02x:%02x:%02x\n", - USBDEVNAME(sc->sc_dev), addr[0], addr[1], addr[2], addr[3], + sc->sc_dev.dv_xname, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); usb_init_task(&sc->sc_swap_task, ueagle_loadpage, sc); @@ -211,7 +211,7 @@ ueagle_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = ueagle_ioctl; ifp->if_start = ueagle_start; IFQ_SET_READY(&ifp->if_snd); - memcpy(ifp->if_xname, USBDEVNAME(sc->sc_dev), IFNAMSIZ); + memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); if_attach(ifp); atm_ifattach(ifp); @@ -242,12 +242,12 @@ ueagle_detach(struct device *self, int flags) /* wait for stat thread to exit properly */ if (sc->stat_thread != NULL) { DPRINTFN(3, ("%s: waiting for stat thread to exit\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); tsleep(sc->stat_thread, PZERO, "ueaglestat", 0); DPRINTFN(3, ("%s: stat thread exited properly\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); } if_detach(ifp); @@ -317,7 +317,7 @@ ueagle_loadpage(void *xsc) if (pageno >= pagecount) { printf("%s: invalid page number %u requested\n", - USBDEVNAME(sc->sc_dev), pageno); + sc->sc_dev.dv_xname, pageno); return; } @@ -330,11 +330,11 @@ ueagle_loadpage(void *xsc) blockcount = *p++; DPRINTF(("%s: sending %u blocks for fw page %u\n", - USBDEVNAME(sc->sc_dev), blockcount, pageno)); + sc->sc_dev.dv_xname, blockcount, pageno)); if ((xfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) { printf("%s: could not allocate xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -355,7 +355,7 @@ ueagle_loadpage(void *xsc) UEAGLE_IDMA_TIMEOUT, NULL); if (usbd_sync_transfer(xfer) != 0) { printf("%s: could not transfer block info\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); break; } @@ -364,7 +364,7 @@ ueagle_loadpage(void *xsc) UEAGLE_IDMA_TIMEOUT, NULL); if (usbd_sync_transfer(xfer) != 0) { printf("%s: could not transfer block data\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); break; } @@ -389,7 +389,7 @@ ueagle_request(struct ueagle_softc *sc, uint16_t val, uint16_t index, error = usbd_do_request_async(sc->sc_udev, &req, data); if (error != USBD_NORMAL_COMPLETION && error != USBD_IN_PROGRESS) - printf("%s: could not send request\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not send request\n", sc->sc_dev.dv_xname); } #ifdef USB_DEBUG @@ -428,7 +428,7 @@ ueagle_cr(struct ueagle_softc *sc, uint32_t address, uint16_t offset, #ifdef USB_DEBUG if (ueagledebug >= 15) { - printf("%s: reading CMV\n", USBDEVNAME(sc->sc_dev)); + printf("%s: reading CMV\n", sc->sc_dev.dv_xname); ueagle_dump_cmv(sc, &cmv); } #endif @@ -441,7 +441,7 @@ ueagle_cr(struct ueagle_softc *sc, uint32_t address, uint16_t offset, error = tsleep(UEAGLE_COND_CMV(sc), PZERO, "cmv", 2 * hz); if (error != 0) { printf("%s: timeout waiting for CMV ack\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); splx(s); return error; } @@ -470,7 +470,7 @@ ueagle_cw(struct ueagle_softc *sc, uint32_t address, uint16_t offset, #ifdef USB_DEBUG if (ueagledebug >= 15) { - printf("%s: writing CMV\n", USBDEVNAME(sc->sc_dev)); + printf("%s: writing CMV\n", sc->sc_dev.dv_xname); ueagle_dump_cmv(sc, &cmv); } #endif @@ -483,7 +483,7 @@ ueagle_cw(struct ueagle_softc *sc, uint32_t address, uint16_t offset, error = tsleep(UEAGLE_COND_CMV(sc), PZERO, "cmv", 2 * hz); if (error != 0) { printf("%s: timeout waiting for CMV ack\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); splx(s); return error; } @@ -508,27 +508,27 @@ ueagle_stat(struct ueagle_softc *sc) switch ((sc->stats.phy.status >> 8) & 0xf) { case 0: /* idle */ DPRINTFN(3, ("%s: waiting for synchronization\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); return ueagle_cw(sc, UEAGLE_CMV_CNTL, 0, 2); case 1: /* initialization */ - DPRINTFN(3, ("%s: initializing\n", USBDEVNAME(sc->sc_dev))); + DPRINTFN(3, ("%s: initializing\n", sc->sc_dev.dv_xname)); return ueagle_cw(sc, UEAGLE_CMV_CNTL, 0, 2); case 2: /* operational */ - DPRINTFN(4, ("%s: operational\n", USBDEVNAME(sc->sc_dev))); + DPRINTFN(4, ("%s: operational\n", sc->sc_dev.dv_xname)); break; default: /* fail ... */ DPRINTFN(3, ("%s: synchronization failed\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); ueagle_init(ifp); return 1; } CR(sc, UEAGLE_CMV_DIAG, 1, &sc->stats.phy.flags); if (sc->stats.phy.flags & 0x10) { - DPRINTF(("%s: delineation LOSS\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(("%s: delineation LOSS\n", sc->sc_dev.dv_xname)); sc->stats.phy.status = 0; ueagle_init(ifp); return 1; @@ -607,7 +607,7 @@ ueagle_boot(struct ueagle_softc *sc) error = tsleep(UEAGLE_COND_READY(sc), PZERO | PCATCH, "boot", 10 * hz); if (error != 0) { printf("%s: timeout waiting for operationnal state\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return error; } @@ -622,7 +622,7 @@ ueagle_boot(struct ueagle_softc *sc) CW(sc, UEAGLE_CMV_CNTL, 0, 2); return kthread_create(ueagle_stat_thread, sc, &sc->stat_thread, - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); #undef CW } @@ -646,20 +646,20 @@ ueagle_cmv_intr(struct ueagle_softc *sc, struct ueagle_cmv *cmv) { #ifdef USB_DEBUG if (ueagledebug >= 15) { - printf("%s: receiving CMV\n", USBDEVNAME(sc->sc_dev)); + printf("%s: receiving CMV\n", sc->sc_dev.dv_xname); ueagle_dump_cmv(sc, cmv); } #endif if (UGETW(cmv->wPreamble) != UEAGLE_CMV_PREAMBLE) { printf("%s: received CMV with invalid preamble\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } if (cmv->bDst != UEAGLE_HOST) { printf("%s: received CMV with bad direction\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -691,7 +691,7 @@ ueagle_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; printf("%s: abnormal interrupt status: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(status)); + sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->pipeh_intr); @@ -711,7 +711,7 @@ ueagle_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) default: printf("%s: caught unknown interrupt\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); } } @@ -918,7 +918,7 @@ ueagle_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, #ifdef DIAGNOSTIC if (count > 0) { printf("%s: truncated cell (%u bytes)\n", - USBDEVNAME(sc->sc_dev), count); + sc->sc_dev.dv_xname, count); } #endif req->frlengths[i] = sc->isize; @@ -943,7 +943,7 @@ ueagle_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, return; printf("%s: could not transmit buffer: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(status)); + sc->sc_dev.dv_xname, usbd_errstr(status)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->pipeh_tx); @@ -1102,7 +1102,7 @@ ueagle_open_vcc(struct ueagle_softc *sc, struct atm_pseudoioctl *api) { struct ueagle_vcc *vcc = &sc->vcc; - DPRINTF(("%s: opening ATM VCC\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(("%s: opening ATM VCC\n", sc->sc_dev.dv_xname)); vcc->vpi = ATM_PH_VPI(&api->aph); vcc->vci = ATM_PH_VCI(&api->aph); @@ -1120,7 +1120,7 @@ ueagle_open_vcc(struct ueagle_softc *sc, struct atm_pseudoioctl *api) int ueagle_close_vcc(struct ueagle_softc *sc, struct atm_pseudoioctl *api) { - DPRINTF(("%s: closing ATM VCC\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(("%s: closing ATM VCC\n", sc->sc_dev.dv_xname)); sc->vcc.flags &= ~UEAGLE_VCC_ACTIVE; @@ -1202,14 +1202,14 @@ ueagle_open_pipes(struct ueagle_softc *sc) &iface); if (error != 0) { printf("%s: could not get tx interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } error = usbd_open_pipe(iface, UEAGLE_TX_PIPE, USBD_EXCLUSIVE_USE, &sc->pipeh_tx); if (error != 0) { - printf("%s: could not open tx pipe\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not open tx pipe\n", sc->sc_dev.dv_xname); goto fail; } @@ -1221,7 +1221,7 @@ ueagle_open_pipes(struct ueagle_softc *sc) txreq->xfer = usbd_alloc_xfer(sc->sc_udev); if (txreq->xfer == NULL) { printf("%s: could not allocate tx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -1229,7 +1229,7 @@ ueagle_open_pipes(struct ueagle_softc *sc) txreq->buf = usbd_alloc_buffer(txreq->xfer, UEAGLE_TXBUFLEN); if (txreq->buf == NULL) { printf("%s: could not allocate tx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -1239,7 +1239,7 @@ ueagle_open_pipes(struct ueagle_softc *sc) &iface); if (error != 0) { printf("%s: could not get rx interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -1247,14 +1247,14 @@ ueagle_open_pipes(struct ueagle_softc *sc) error = usbd_set_interface(iface, 8); if (error != 0) { printf("%s: could not set rx alternative interface\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } edesc = usbd_get_endpoint_descriptor(iface, UEAGLE_RX_PIPE); if (edesc == NULL) { printf("%s: could not get rx endpoint descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = EIO; goto fail; } @@ -1264,7 +1264,7 @@ ueagle_open_pipes(struct ueagle_softc *sc) error = usbd_open_pipe(iface, UEAGLE_RX_PIPE, USBD_EXCLUSIVE_USE, &sc->pipeh_rx); if (error != 0) { - printf("%s: could not open rx pipe\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not open rx pipe\n", sc->sc_dev.dv_xname); goto fail; } @@ -1276,7 +1276,7 @@ ueagle_open_pipes(struct ueagle_softc *sc) isoreq->xfer = usbd_alloc_xfer(sc->sc_udev); if (isoreq->xfer == NULL) { printf("%s: could not allocate rx xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -1285,7 +1285,7 @@ ueagle_open_pipes(struct ueagle_softc *sc) sc->isize * UEAGLE_NISOFRMS); if (buf == NULL) { printf("%s: could not allocate rx buffer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); error = ENOMEM; goto fail; } @@ -1359,7 +1359,7 @@ ueagle_init(struct ifnet *ifp) &iface); if (error != 0) { printf("%s: could not get idma interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -1367,7 +1367,7 @@ ueagle_init(struct ifnet *ifp) &sc->pipeh_idma); if (error != 0) { printf("%s: could not open idma pipe\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } @@ -1375,13 +1375,13 @@ ueagle_init(struct ifnet *ifp) &iface); if (error != 0) { printf("%s: could not get interrupt interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } error = loadfirmware("ueagle-dsp", &sc->dsp, &len); if (error != 0) { - printf("%s: could not load firmware\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not load firmware\n", sc->sc_dev.dv_xname); goto fail; } @@ -1390,13 +1390,13 @@ ueagle_init(struct ifnet *ifp) UEAGLE_INTR_INTERVAL); if (error != 0) { printf("%s: could not open interrupt pipe\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } error = ueagle_boot(sc); if (error != 0) { - printf("%s: could not boot modem\n", USBDEVNAME(sc->sc_dev)); + printf("%s: could not boot modem\n", sc->sc_dev.dv_xname); goto fail; } diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index 6e11ad6d992..2649731c975 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uftdi.c,v 1.37 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uftdi.c,v 1.38 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uftdi.c,v 1.14 2003/02/23 04:20:07 simonb Exp $ */ /* @@ -195,7 +195,7 @@ uftdi_attach(struct device *parent, struct device *self, void *aux) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfop; - char *devname = USBDEVNAME(sc->sc_dev); + char *devname = sc->sc_dev.dv_xname; int i; usbd_status err; struct ucom_attach_args uca; @@ -342,12 +342,12 @@ uftdi_attach(struct device *parent, struct device *self, void *aux) } if (uca.bulkin == -1) { printf("%s: Could not find data bulk in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto bad; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto bad; } diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 054199e78e5..e3f7b2648ac 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.42 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: ugen.c,v 1.43 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -169,7 +169,7 @@ ugen_attach(struct device *parent, struct device *self, void *aux) int conf; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); sc->sc_udev = udev = uaa->device; @@ -178,7 +178,7 @@ ugen_attach(struct device *parent, struct device *self, void *aux) err = usbd_set_config_index(udev, 0, 0); if (err) { printf("%s: setting configuration index 0 failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -188,7 +188,7 @@ ugen_attach(struct device *parent, struct device *self, void *aux) err = ugen_set_config(sc, conf); if (err) { printf("%s: setting configuration %d failed\n", - USBDEVNAME(sc->sc_dev), conf); + sc->sc_dev.dv_xname, conf); sc->sc_dying = 1; return; } @@ -210,7 +210,7 @@ ugen_set_config(struct ugen_softc *sc, int configno) int dir; DPRINTFN(1,("ugen_set_config: %s to configno %d, sc=%p\n", - USBDEVNAME(sc->sc_dev), configno, sc)); + sc->sc_dev.dv_xname, configno, sc)); /* * We start at 1, not 0, because we don't care whether the @@ -220,7 +220,7 @@ ugen_set_config(struct ugen_softc *sc, int configno) if (sc->sc_is_open[endptno]) { DPRINTFN(1, ("ugen_set_config: %s - endpoint %d is open\n", - USBDEVNAME(sc->sc_dev), endptno)); + sc->sc_dev.dv_xname, endptno)); return (USBD_IN_USE); } @@ -476,7 +476,7 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) int error = 0; u_char buffer[UGEN_CHUNK]; - DPRINTFN(5, ("%s: ugenread: %d\n", USBDEVNAME(sc->sc_dev), endpt)); + DPRINTFN(5, ("%s: ugenread: %d\n", sc->sc_dev.dv_xname, endpt)); if (sc->sc_dying) return (EIO); @@ -632,7 +632,7 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) usbd_xfer_handle xfer; usbd_status err; - DPRINTFN(5, ("%s: ugenwrite: %d\n", USBDEVNAME(sc->sc_dev), endpt)); + DPRINTFN(5, ("%s: ugenwrite: %d\n", sc->sc_dev.dv_xname, endpt)); if (sc->sc_dying) return (EIO); diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 752920dcdcd..4e933f32990 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhci.c,v 1.56 2007/06/10 10:15:35 mbalmer Exp $ */ +/* $OpenBSD: uhci.c,v 1.57 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -745,7 +745,7 @@ uhci_dumpregs(uhci_softc_t *sc) { DPRINTFN(-1,("%s regs: cmd=%04x, sts=%04x, intr=%04x, frnum=%04x, " "flbase=%08x, sof=%04x, portsc1=%04x, portsc2=%04x\n", - USBDEVNAME(sc->sc_bus.bdev), + sc->sc_bus.bdev.dv_xname, UREAD2(sc, UHCI_CMD), UREAD2(sc, UHCI_STS), UREAD2(sc, UHCI_INTR), @@ -1166,7 +1166,7 @@ uhci_intr1(uhci_softc_t *sc) #ifdef UHCI_DEBUG if (uhcidebug > 15) { - DPRINTF(("%s: uhci_intr1\n", USBDEVNAME(sc->sc_bus.bdev))); + DPRINTF(("%s: uhci_intr1\n", sc->sc_bus.bdev.dv_xname)); uhci_dumpregs(sc); } #endif @@ -1177,7 +1177,7 @@ uhci_intr1(uhci_softc_t *sc) if (sc->sc_suspend != PWR_RESUME) { printf("%s: interrupt while not operating ignored\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); UWRITE2(sc, UHCI_STS, status); /* acknowledge the ints */ return (0); } @@ -1190,23 +1190,23 @@ uhci_intr1(uhci_softc_t *sc) if (status & UHCI_STS_RD) { ack |= UHCI_STS_RD; #ifdef UHCI_DEBUG - printf("%s: resume detect\n", USBDEVNAME(sc->sc_bus.bdev)); + printf("%s: resume detect\n", sc->sc_bus.bdev.dv_xname); #endif } if (status & UHCI_STS_HSE) { ack |= UHCI_STS_HSE; - printf("%s: host system error\n", USBDEVNAME(sc->sc_bus.bdev)); + printf("%s: host system error\n", sc->sc_bus.bdev.dv_xname); } if (status & UHCI_STS_HCPE) { ack |= UHCI_STS_HCPE; printf("%s: host controller process error\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); } if (status & UHCI_STS_HCH) { /* no acknowledge needed */ if (!sc->sc_dying) { printf("%s: host controller halted\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); #ifdef UHCI_DEBUG uhci_dump_all(sc); #endif @@ -1221,7 +1221,7 @@ uhci_intr1(uhci_softc_t *sc) sc->sc_bus.no_intrs++; usb_schedsoftintr(&sc->sc_bus); - DPRINTFN(15, ("%s: uhci_intr: exit\n", USBDEVNAME(sc->sc_bus.bdev))); + DPRINTFN(15, ("%s: uhci_intr: exit\n", sc->sc_bus.bdev.dv_xname)); return (1); } @@ -1232,7 +1232,7 @@ uhci_softintr(void *v) uhci_softc_t *sc = v; uhci_intr_info_t *ii, *nextii; - DPRINTFN(10,("%s: uhci_softintr (%d)\n", USBDEVNAME(sc->sc_bus.bdev), + DPRINTFN(10,("%s: uhci_softintr (%d)\n", sc->sc_bus.bdev.dv_xname, sc->sc_bus.intr_context)); sc->sc_bus.intr_context++; @@ -1544,7 +1544,7 @@ uhci_reset(uhci_softc_t *sc) usb_delay_ms(&sc->sc_bus, 1); if (n >= UHCI_RESET_TIMEOUT) printf("%s: controller did not reset\n", - USBDEVNAME(sc->sc_bus.bdev)); + sc->sc_bus.bdev.dv_xname); } usbd_status @@ -1574,7 +1574,7 @@ uhci_run(uhci_softc_t *sc, int run) usb_delay_ms(&sc->sc_bus, 1); } splx(s); - printf("%s: cannot %s\n", USBDEVNAME(sc->sc_bus.bdev), + printf("%s: cannot %s\n", sc->sc_bus.bdev.dv_xname, run ? "start" : "stop"); return (USBD_IOERROR); } diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 11b983780b9..e166759ca68 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.c,v 1.24 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uhidev.c,v 1.25 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -136,7 +136,7 @@ uhidev_attach(struct device *parent, struct device *self, void *aux) id = usbd_get_interface_descriptor(iface); devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), + printf("\n%s: %s, iclass %d/%d\n", sc->sc_dev.dv_xname, devinfop, id->bInterfaceClass, id->bInterfaceSubClass); usbd_devinfo_free(devinfop); @@ -154,7 +154,7 @@ uhidev_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: could not read endpoint descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -175,7 +175,7 @@ uhidev_attach(struct device *parent, struct device *self, void *aux) (ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) { sc->sc_oep_addr = ed->bEndpointAddress; } else { - printf("%s: unexpected endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: unexpected endpoint\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -186,7 +186,7 @@ uhidev_attach(struct device *parent, struct device *self, void *aux) * endpoint is optional */ if (sc->sc_iep_addr == -1) { - printf("%s: no input interrupt endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: no input interrupt endpoint\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -228,7 +228,7 @@ uhidev_attach(struct device *parent, struct device *self, void *aux) err = usbd_read_report_desc(uaa->iface, &desc, &size, M_USBDEV); } if (err) { - printf("%s: no report descriptor\n", USBDEVNAME(sc->sc_dev)); + printf("%s: no report descriptor\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -241,12 +241,12 @@ uhidev_attach(struct device *parent, struct device *self, void *aux) if (nrepid < 0) return; if (nrepid > 0) - printf("%s: %d report ids\n", USBDEVNAME(sc->sc_dev), nrepid); + printf("%s: %d report ids\n", sc->sc_dev.dv_xname, nrepid); nrepid++; sc->sc_subdevs = malloc(nrepid * sizeof(device_ptr_t), M_USBDEV, M_NOWAIT); if (sc->sc_subdevs == NULL) { - printf("%s: no memory\n", USBDEVNAME(sc->sc_dev)); + printf("%s: no memory\n", sc->sc_dev.dv_xname); return; } bzero(sc->sc_subdevs, nrepid * sizeof(device_ptr_t)); @@ -287,7 +287,7 @@ uhidev_attach(struct device *parent, struct device *self, void *aux) repid, dev)); if (dev->sc_intr == NULL) { printf("%s: sc_intr == NULL\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } #endif @@ -416,7 +416,7 @@ uhidev_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) return; if (status != USBD_NORMAL_COMPLETION) { - DPRINTF(("%s: interrupt status=%d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: interrupt status=%d\n", sc->sc_dev.dv_xname, status)); usbd_clear_endpoint_stall_async(sc->sc_ipipe); return; @@ -438,7 +438,7 @@ uhidev_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) return; #ifdef UHIDEV_DEBUG if (scd->sc_in_rep_size != cc) - printf("%s: bad input length %d != %d\n",USBDEVNAME(sc->sc_dev), + printf("%s: bad input length %d != %d\n",sc->sc_dev.dv_xname, scd->sc_in_rep_size, cc); #endif scd->sc_intr(scd, p, cc); diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 0b9a9bfa72e..686324438f5 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhub.c,v 1.44 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uhub.c,v 1.45 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ @@ -137,13 +137,13 @@ uhub_attach(struct device *parent, struct device *self, void *aux) err = usbd_set_config_index(dev, 0, 1); if (err) { DPRINTF(("%s: configuration failed, error=%s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err))); + sc->sc_dev.dv_xname, usbd_errstr(err))); return; } if (dev->depth > USB_HUB_MAX_DEPTH) { printf("%s: hub depth (%d) exceeded, hub ignored\n", - USBDEVNAME(sc->sc_dev), USB_HUB_MAX_DEPTH); + sc->sc_dev.dv_xname, USB_HUB_MAX_DEPTH); return; } @@ -162,7 +162,7 @@ uhub_attach(struct device *parent, struct device *self, void *aux) } if (err) { DPRINTF(("%s: getting hub descriptor failed, error=%s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err))); + sc->sc_dev.dv_xname, usbd_errstr(err))); return; } @@ -172,7 +172,7 @@ uhub_attach(struct device *parent, struct device *self, void *aux) #ifdef UHUB_DEBUG printf("%s: %d port%s with %d removable, %s powered", - USBDEVNAME(sc->sc_dev), nports, nports != 1 ? "s" : "", + sc->sc_dev.dv_xname, nports, nports != 1 ? "s" : "", nremov, dev->self_powered ? "self" : "bus"); if (dev->depth > 0 && UHUB_IS_HIGH_SPEED(sc)) { @@ -184,7 +184,7 @@ uhub_attach(struct device *parent, struct device *self, void *aux) #endif if (nports == 0) { - printf("%s: no ports, hub ignored\n", USBDEVNAME(sc->sc_dev)); + printf("%s: no ports, hub ignored\n", sc->sc_dev.dv_xname); goto bad; } @@ -206,23 +206,23 @@ uhub_attach(struct device *parent, struct device *self, void *aux) if (!dev->self_powered && dev->powersrc->parent != NULL && !dev->powersrc->parent->self_powered) { printf("%s: bus powered hub connected to bus powered hub, " - "ignored\n", USBDEVNAME(sc->sc_dev)); + "ignored\n", sc->sc_dev.dv_xname); goto bad; } /* Set up interrupt pipe. */ err = usbd_device2interface_handle(dev, 0, &iface); if (err) { - printf("%s: no interface handle\n", USBDEVNAME(sc->sc_dev)); + printf("%s: no interface handle\n", sc->sc_dev.dv_xname); goto bad; } ed = usbd_interface2endpoint_descriptor(iface, 0); if (ed == NULL) { - printf("%s: no endpoint descriptor\n", USBDEVNAME(sc->sc_dev)); + printf("%s: no endpoint descriptor\n", sc->sc_dev.dv_xname); goto bad; } if ((ed->bmAttributes & UE_XFERTYPE) != UE_INTERRUPT) { - printf("%s: bad interrupt endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: bad interrupt endpoint\n", sc->sc_dev.dv_xname); goto bad; } @@ -231,7 +231,7 @@ uhub_attach(struct device *parent, struct device *self, void *aux) sizeof(sc->sc_status), uhub_intr, UHUB_INTR_INTERVAL); if (err) { printf("%s: cannot open interrupt pipe\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto bad; } @@ -301,7 +301,7 @@ uhub_attach(struct device *parent, struct device *self, void *aux) err = usbd_set_port_feature(dev, port, UHF_PORT_POWER); if (err) printf("%s: port %d power on failed, %s\n", - USBDEVNAME(sc->sc_dev), port, + sc->sc_dev.dv_xname, port, usbd_errstr(err)); DPRINTF(("usb_init_port: turn on port %d power\n", port)); } @@ -355,7 +355,7 @@ uhub_explore(usbd_device_handle dev) reconnect = up->reattach; up->reattach = 0; DPRINTFN(3,("uhub_explore: %s port %d status 0x%04x 0x%04x\n", - USBDEVNAME(sc->sc_dev), port, status, change)); + sc->sc_dev.dv_xname, port, status, change)); if (change & UPS_C_PORT_ENABLED) { DPRINTF(("uhub_explore: C_PORT_ENABLED\n")); usbd_clear_port_feature(dev, port, UHF_C_PORT_ENABLE); @@ -364,20 +364,20 @@ uhub_explore(usbd_device_handle dev) vanished. */ } else if (status & UPS_PORT_ENABLED) { printf("%s: illegal enable change, port %d\n", - USBDEVNAME(sc->sc_dev), port); + sc->sc_dev.dv_xname, port); } else { /* Port error condition. */ if (up->restartcnt) /* no message first time */ printf("%s: port error, restarting " "port %d\n", - USBDEVNAME(sc->sc_dev), port); + sc->sc_dev.dv_xname, port); if (up->restartcnt++ < USBD_RESTART_MAX) goto disco; else printf("%s: port error, giving up " "port %d\n", - USBDEVNAME(sc->sc_dev), port); + sc->sc_dev.dv_xname, port); } } if (!reconnect && !(change & UPS_C_CONNECT_STATUS)) { @@ -390,7 +390,7 @@ uhub_explore(usbd_device_handle dev) if (up->device == NULL && (status & UPS_CURRENT_CONNECT_STATUS)) printf("%s: connected, no device\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); #endif continue; } @@ -428,7 +428,7 @@ uhub_explore(usbd_device_handle dev) if (!(status & UPS_PORT_POWER)) printf("%s: strange, connected port %d has no power\n", - USBDEVNAME(sc->sc_dev), port); + sc->sc_dev.dv_xname, port); /* Wait for maximum device power up time. */ usbd_delay_ms(dev, USB_PORT_POWERUP_DELAY); @@ -436,7 +436,7 @@ uhub_explore(usbd_device_handle dev) /* Reset port, which implies enabling it. */ if (usbd_reset_port(dev, port, &up->status)) { printf("%s: port %d reset failed\n", - USBDEVNAME(sc->sc_dev), port); + sc->sc_dev.dv_xname, port); continue; } /* Get port status again, it might have changed during reset */ @@ -452,7 +452,7 @@ uhub_explore(usbd_device_handle dev) /* Nothing connected, just ignore it. */ #ifdef UHUB_DEBUG printf("%s: port %d, device disappeared after reset\n", - USBDEVNAME(sc->sc_dev), port); + sc->sc_dev.dv_xname, port); #endif continue; } @@ -480,7 +480,7 @@ uhub_explore(usbd_device_handle dev) * at 0 we have to disable the port instead. */ printf("%s: device problem, disabling port %d\n", - USBDEVNAME(sc->sc_dev), port); + sc->sc_dev.dv_xname, port); usbd_clear_port_feature(dev, port, UHF_PORT_ENABLE); } else { /* The port set up succeeded, reset error count. */ diff --git a/sys/dev/usb/uipaq.c b/sys/dev/usb/uipaq.c index 457be69965e..7128403d63d 100644 --- a/sys/dev/usb/uipaq.c +++ b/sys/dev/usb/uipaq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipaq.c,v 1.8 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uipaq.c,v 1.9 2007/06/10 14:49:01 mbalmer Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -157,7 +157,7 @@ uipaq_attach(struct device *parent, struct device *self, void *aux) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfop; - char *devname = USBDEVNAME(sc->sc_dev); + char *devname = sc->sc_dev.dv_xname; int i; usbd_status err; struct ucom_attach_args uca; @@ -203,7 +203,7 @@ uipaq_attach(struct device *parent, struct device *self, void *aux) /* err = uipaq_init(sc); if (err) { - printf("%s: init failed, %s\n", USBDEVNAME(sc->sc_dev), + printf("%s: init failed, %s\n", sc->sc_dev.dv_xname, usbd_errstr(err)); goto bad; }*/ @@ -249,7 +249,7 @@ uipaq_dtr(struct uipaq_softc* sc, int onoff) usbd_status err; int retries = 3; - DPRINTF(("%s: uipaq_dtr: onoff=%x\n", USBDEVNAME(sc->sc_dev), onoff)); + DPRINTF(("%s: uipaq_dtr: onoff=%x\n", sc->sc_dev.dv_xname, onoff)); /* Avoid sending unnecessary requests */ if (onoff && (sc->sc_lcr & UCDC_LINE_DTR)) @@ -282,7 +282,7 @@ uipaq_rts(struct uipaq_softc* sc, int onoff) usbd_status err; int retries = 3; - DPRINTF(("%s: uipaq_rts: onoff=%x\n", USBDEVNAME(sc->sc_dev), onoff)); + DPRINTF(("%s: uipaq_rts: onoff=%x\n", sc->sc_dev.dv_xname, onoff)); /* Avoid sending unnecessary requests */ if (onoff && (sc->sc_lcr & UCDC_LINE_RTS)) return; @@ -311,7 +311,7 @@ uipaq_break(struct uipaq_softc* sc, int onoff) usbd_status err; int retries = 3; - DPRINTF(("%s: uipaq_break: onoff=%x\n", USBDEVNAME(sc->sc_dev), onoff)); + DPRINTF(("%s: uipaq_break: onoff=%x\n", sc->sc_dev.dv_xname, onoff)); req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UCDC_SEND_BREAK; @@ -346,7 +346,7 @@ uipaq_set(void *addr, int portno, int reg, int onoff) break; default: printf("%s: unhandled set request: reg=%x onoff=%x\n", - USBDEVNAME(sc->sc_dev), reg, onoff); + sc->sc_dev.dv_xname, reg, onoff); return; } } diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c index d6b55e01f6f..039a0fb901f 100644 --- a/sys/dev/usb/ukbd.c +++ b/sys/dev/usb/ukbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ukbd.c,v 1.32 2007/06/10 10:15:35 mbalmer Exp $ */ +/* $OpenBSD: ukbd.c,v 1.33 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -460,7 +460,7 @@ ukbd_enable(void *v, int on) /* Should only be called to change state */ if (sc->sc_enabled == on) { DPRINTF(("ukbd_enable: %s: bad call on=%d\n", - USBDEVNAME(sc->sc_hdev.sc_dev), on)); + sc->sc_hdev.sc_dev.dv_xname, on)); return (EBUSY); } @@ -521,7 +521,7 @@ ukbd_detach(struct device *self, int flags) * XXX console, if there are any other keyboards. */ printf("%s: was console keyboard\n", - USBDEVNAME(sc->sc_hdev.sc_dev)); + sc->sc_hdev.sc_dev.dv_xname); wskbd_cndetach(); ukbd_is_console = 1; #endif diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index f89d2b1495d..e52813d70d5 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ulpt.c,v 1.26 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: ulpt.c,v 1.27 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: ulpt.c,v 1.57 2003/01/05 10:19:42 scw Exp $ */ /* $FreeBSD: src/sys/dev/usb/ulpt.c,v 1.24 1999/11/17 22:33:44 n_hibma Exp $ */ @@ -169,7 +169,7 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(10,("ulpt_attach: sc=%p\n", sc)); devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), + printf("\n%s: %s, iclass %d/%d\n", sc->sc_dev.dv_xname, devinfop, ifcd->bInterfaceClass, ifcd->bInterfaceSubClass); usbd_devinfo_free(devinfop); @@ -179,7 +179,7 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) cdesc = usbd_get_config_descriptor(dev); if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } iend = (usb_interface_descriptor_t *) @@ -211,7 +211,7 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) err = usbd_set_interface(iface, altno); if (err) { printf("%s: setting alternate interface failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -226,7 +226,7 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: couldn't get ep %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -239,7 +239,7 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) } if (sc->sc_out == -1) { printf("%s: could not find bulk out endpoint\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -249,7 +249,7 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) sc->sc_in = -1; } - printf("%s: using %s-directional mode\n", USBDEVNAME(sc->sc_dev), + printf("%s: using %s-directional mode\n", sc->sc_dev.dv_xname, sc->sc_in >= 0 ? "bi" : "uni"); DPRINTFN(10, ("ulpt_attach: bulk=%d\n", sc->sc_out)); @@ -277,17 +277,17 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) err = usbd_do_request_flags(dev, &req, devinfop, USBD_SHORT_XFER_OK, &alen, USBD_DEFAULT_TIMEOUT); if (err) { - printf("%s: cannot get device id\n", USBDEVNAME(sc->sc_dev)); + printf("%s: cannot get device id\n", sc->sc_dev.dv_xname); } else if (alen <= 2) { printf("%s: empty device id, no printer connected?\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); } else { /* devinfop now contains an IEEE-1284 device ID */ len = ((devinfop[0] & 0xff) << 8) | (devinfop[1] & 0xff); if (len > DEVINFOSIZE - 3) len = DEVINFOSIZE - 3; devinfo[len] = 0; - printf("%s: device id <", USBDEVNAME(sc->sc_dev)); + printf("%s: device id <", sc->sc_dev.dv_xname); ieee1284_print_id(devinfop+2); printf(">\n"); } @@ -526,11 +526,11 @@ ulpt_statusmsg(u_char status, struct ulpt_softc *sc) sc->sc_laststatus = status; if (new & LPS_SELECT) - log(LOG_NOTICE, "%s: offline\n", USBDEVNAME(sc->sc_dev)); + log(LOG_NOTICE, "%s: offline\n", sc->sc_dev.dv_xname); else if (new & LPS_NOPAPER) - log(LOG_NOTICE, "%s: out of paper\n", USBDEVNAME(sc->sc_dev)); + log(LOG_NOTICE, "%s: out of paper\n", sc->sc_dev.dv_xname); else if (new & LPS_NERR) - log(LOG_NOTICE, "%s: output error\n", USBDEVNAME(sc->sc_dev)); + log(LOG_NOTICE, "%s: output error\n", sc->sc_dev.dv_xname); return (status); } diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index ea974d45dc2..78a15580153 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass.c,v 1.48 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: umass.c,v 1.49 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: umass.c,v 1.116 2004/06/30 05:53:46 mycroft Exp $ */ /* @@ -306,7 +306,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) int i, bno, error; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); sc->sc_udev = uaa->device; @@ -348,7 +348,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) default: DPRINTF(UDMASS_GEN, ("%s: Unsupported wire protocol %u\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, id->bInterfaceProtocol)); return; } @@ -373,7 +373,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) default: DPRINTF(UDMASS_GEN, ("%s: Unsupported command protocol %u\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, id->bInterfaceSubClass)); return; } @@ -415,7 +415,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) break; } - printf("%s: using %s over %s\n", USBDEVNAME(sc->sc_dev), sCommand, + printf("%s: using %s over %s\n", sc->sc_dev.dv_xname, sCommand, sWire); if (quirk != NULL && quirk->uq_init != NULL) { @@ -441,7 +441,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: could not read endpoint descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN @@ -457,7 +457,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) #ifdef UMASS_DEBUG if (UGETW(ed->wMaxPacketSize) > 2) { DPRINTF(UDMASS_CBI, ("%s: intr size is %d\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, UGETW(ed->wMaxPacketSize))); } #endif @@ -469,7 +469,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) (sc->sc_wire == UMASS_WPROTO_CBI_I && !sc->sc_epaddr[UMASS_INTRIN])) { DPRINTF(UDMASS_USB, ("%s: endpoint not found %u/%u/%u\n", - USBDEVNAME(sc->sc_dev), sc->sc_epaddr[UMASS_BULKIN], + sc->sc_dev.dv_xname, sc->sc_epaddr[UMASS_BULKIN], sc->sc_epaddr[UMASS_BULKOUT], sc->sc_epaddr[UMASS_INTRIN])); return; @@ -482,7 +482,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) err = umass_bbb_get_max_lun(sc, &sc->maxlun); if (err) { printf("%s: unable to get Max Lun: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return; } } else { @@ -491,25 +491,25 @@ umass_attach(struct device *parent, struct device *self, void *aux) /* Open the bulk-in and -out pipe */ DPRINTF(UDMASS_USB, ("%s: opening iface %p epaddr %d for BULKOUT\n", - USBDEVNAME(sc->sc_dev), sc->sc_iface, + sc->sc_dev.dv_xname, sc->sc_iface, sc->sc_epaddr[UMASS_BULKOUT])); err = usbd_open_pipe(sc->sc_iface, sc->sc_epaddr[UMASS_BULKOUT], USBD_EXCLUSIVE_USE, &sc->sc_pipe[UMASS_BULKOUT]); if (err) { DPRINTF(UDMASS_USB, ("%s: cannot open %u-out pipe (bulk)\n", - USBDEVNAME(sc->sc_dev), sc->sc_epaddr[UMASS_BULKOUT])); + sc->sc_dev.dv_xname, sc->sc_epaddr[UMASS_BULKOUT])); umass_disco(sc); return; } DPRINTF(UDMASS_USB, ("%s: opening iface %p epaddr %d for BULKIN\n", - USBDEVNAME(sc->sc_dev), sc->sc_iface, + sc->sc_dev.dv_xname, sc->sc_iface, sc->sc_epaddr[UMASS_BULKIN])); err = usbd_open_pipe(sc->sc_iface, sc->sc_epaddr[UMASS_BULKIN], USBD_EXCLUSIVE_USE, &sc->sc_pipe[UMASS_BULKIN]); if (err) { DPRINTF(UDMASS_USB, ("%s: could not open %u-in pipe (bulk)\n", - USBDEVNAME(sc->sc_dev), sc->sc_epaddr[UMASS_BULKIN])); + sc->sc_dev.dv_xname, sc->sc_epaddr[UMASS_BULKIN])); umass_disco(sc); return; } @@ -527,13 +527,13 @@ umass_attach(struct device *parent, struct device *self, void *aux) */ if (sc->sc_wire == UMASS_WPROTO_CBI_I) { DPRINTF(UDMASS_USB, ("%s: opening iface %p epaddr %d for INTRIN\n", - USBDEVNAME(sc->sc_dev), sc->sc_iface, + sc->sc_dev.dv_xname, sc->sc_iface, sc->sc_epaddr[UMASS_INTRIN])); err = usbd_open_pipe(sc->sc_iface, sc->sc_epaddr[UMASS_INTRIN], USBD_EXCLUSIVE_USE, &sc->sc_pipe[UMASS_INTRIN]); if (err) { DPRINTF(UDMASS_USB, ("%s: couldn't open %u-in (intr)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sc_epaddr[UMASS_INTRIN])); umass_disco(sc); return; @@ -548,7 +548,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) sc->transfer_xfer[i] = usbd_alloc_xfer(uaa->device); if (sc->transfer_xfer[i] == NULL) { DPRINTF(UDMASS_USB, ("%s: Out of memory\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); umass_disco(sc); return; } @@ -602,22 +602,22 @@ umass_attach(struct device *parent, struct device *self, void *aux) error = umass_atapi_attach(sc); #else printf("%s: "UMASS_ATAPISTR" not configured\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); #endif break; case UMASS_CPROTO_ISD_ATA: - printf("%s: isdata not configured\n", USBDEVNAME(sc->sc_dev)); + printf("%s: isdata not configured\n", sc->sc_dev.dv_xname); break; default: printf("%s: command protocol=0x%x not supported\n", - USBDEVNAME(sc->sc_dev), sc->sc_cmd); + sc->sc_dev.dv_xname, sc->sc_cmd); umass_disco(sc); return; } if (error) { - printf("%s: bus attach failed\n", USBDEVNAME(sc->sc_dev)); + printf("%s: bus attach failed\n", sc->sc_dev.dv_xname); umass_disco(sc); return; } @@ -625,7 +625,7 @@ umass_attach(struct device *parent, struct device *self, void *aux) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, &sc->sc_dev); - DPRINTF(UDMASS_GEN, ("%s: Attach finished\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(UDMASS_GEN, ("%s: Attach finished\n", sc->sc_dev.dv_xname)); } int @@ -635,7 +635,7 @@ umass_detach(struct device *self, int flags) struct umassbus_softc *scbus; int rv = 0, i, s; - DPRINTF(UDMASS_USB, ("%s: detached\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(UDMASS_USB, ("%s: detached\n", sc->sc_dev.dv_xname)); /* Abort the pipes to wake up any waiting processes. */ for (i = 0 ; i < UMASS_NEP ; i++) { @@ -649,7 +649,7 @@ umass_detach(struct device *self, int flags) s = splusb(); if (--sc->sc_refcnt >= 0) { #ifdef DIAGNOSTIC - printf("%s: waiting for refcnt\n", USBDEVNAME(sc->sc_dev)); + printf("%s: waiting for refcnt\n", sc->sc_dev.dv_xname); #endif /* Wait for processes to go away. */ usb_detach_wait(&sc->sc_dev); @@ -683,7 +683,7 @@ umass_activate(struct device *dev, enum devact act) int rv = 0; DPRINTF(UDMASS_USB, ("%s: umass_activate: %d\n", - USBDEVNAME(sc->sc_dev), act)); + sc->sc_dev.dv_xname, act)); switch (act) { case DVACT_ACTIVATE: @@ -695,7 +695,7 @@ umass_activate(struct device *dev, enum devact act) break; rv = config_deactivate(scbus->sc_child); DPRINTF(UDMASS_USB, ("%s: umass_activate: child " - "returned %d\n", USBDEVNAME(sc->sc_dev), rv)); + "returned %d\n", sc->sc_dev.dv_xname, rv)); break; } return (rv); @@ -746,11 +746,11 @@ umass_polled_transfer(struct umass_softc *sc, usbd_xfer_handle xfer) if (sc->polling_depth) { if (sc->next_polled_xfer) panic("%s: got polled xfer %p, but %p already " - "pending\n", USBDEVNAME(sc->sc_dev), xfer, + "pending\n", sc->sc_dev.dv_xname, xfer, sc->next_polled_xfer); DPRINTF(UDMASS_XFER, ("%s: saving polled xfer %p\n", - USBDEVNAME(sc->sc_dev), xfer)); + sc->sc_dev.dv_xname, xfer)); sc->next_polled_xfer = xfer; return (USBD_IN_PROGRESS); @@ -760,11 +760,11 @@ umass_polled_transfer(struct umass_softc *sc, usbd_xfer_handle xfer) start_next_xfer: DPRINTF(UDMASS_XFER, ("%s: start polled xfer %p\n", - USBDEVNAME(sc->sc_dev), xfer)); + sc->sc_dev.dv_xname, xfer)); err = usbd_transfer(xfer); if (err && err != USBD_IN_PROGRESS && sc->next_polled_xfer == NULL) { DPRINTF(UDMASS_BBB, ("%s: failed to setup transfer, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err))); + sc->sc_dev.dv_xname, usbd_errstr(err))); sc->polling_depth--; return (err); } @@ -804,18 +804,18 @@ umass_setup_transfer(struct umass_softc *sc, usbd_pipe_handle pipe, if (sc->sc_udev->bus->use_polling) { DPRINTF(UDMASS_XFER,("%s: start polled xfer buffer=%p " - "buflen=%d flags=0x%x timeout=%d\n", USBDEVNAME(sc->sc_dev), + "buflen=%d flags=0x%x timeout=%d\n", sc->sc_dev.dv_xname, buffer, buflen, flags | sc->sc_xfer_flags, sc->timeout)); err = umass_polled_transfer(sc, xfer); } else { err = usbd_transfer(xfer); DPRINTF(UDMASS_XFER,("%s: start xfer buffer=%p buflen=%d " - "flags=0x%x timeout=%d\n", USBDEVNAME(sc->sc_dev), + "flags=0x%x timeout=%d\n", sc->sc_dev.dv_xname, buffer, buflen, flags | sc->sc_xfer_flags, sc->timeout)); } if (err && err != USBD_IN_PROGRESS) { DPRINTF(UDMASS_BBB, ("%s: failed to setup transfer, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err))); + sc->sc_dev.dv_xname, usbd_errstr(err))); return (err); } @@ -840,18 +840,18 @@ umass_setup_ctrl_transfer(struct umass_softc *sc, usb_device_request_t *req, if (sc->sc_udev->bus->use_polling) { DPRINTF(UDMASS_XFER,("%s: start polled ctrl xfer buffer=%p " - "buflen=%d flags=0x%x\n", USBDEVNAME(sc->sc_dev), buffer, + "buflen=%d flags=0x%x\n", sc->sc_dev.dv_xname, buffer, buflen, flags)); err = umass_polled_transfer(sc, xfer); } else { DPRINTF(UDMASS_XFER,("%s: start ctrl xfer buffer=%p buflen=%d " - "flags=0x%x\n", USBDEVNAME(sc->sc_dev), buffer, buflen, + "flags=0x%x\n", sc->sc_dev.dv_xname, buffer, buflen, flags)); err = usbd_transfer(xfer); } if (err && err != USBD_IN_PROGRESS) { DPRINTF(UDMASS_BBB, ("%s: failed to setup ctrl transfer, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err))); + sc->sc_dev.dv_xname, usbd_errstr(err))); /* do not reset, as this would make us loop */ return (err); @@ -903,7 +903,7 @@ umass_clear_endpoint_stall(struct umass_softc *sc, int endpt, return; DPRINTF(UDMASS_BBB, ("%s: Clear endpoint 0x%02x stall\n", - USBDEVNAME(sc->sc_dev), sc->sc_epaddr[endpt])); + sc->sc_dev.dv_xname, sc->sc_epaddr[endpt])); usbd_clear_endpoint_toggle(sc->sc_pipe[endpt]); @@ -958,7 +958,7 @@ umass_bbb_reset(struct umass_softc *sc, int status) */ DPRINTF(UDMASS_BBB, ("%s: Bulk Reset\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); sc->transfer_state = TSTATE_BBB_RESET1; sc->transfer_status = status; @@ -982,7 +982,7 @@ umass_bbb_transfer(struct umass_softc *sc, int lun, void *cmd, int cmdlen, usbd_status err; DPRINTF(UDMASS_BBB,("%s: umass_bbb_transfer cmd=0x%02x\n", - USBDEVNAME(sc->sc_dev), *(u_char *)cmd)); + sc->sc_dev.dv_xname, *(u_char *)cmd)); KASSERT(sc->sc_wire & UMASS_WPROTO_BBB, ("sc->sc_wire == 0x%02x wrong for umass_bbb_transfer\n", @@ -1018,23 +1018,23 @@ umass_bbb_transfer(struct umass_softc *sc, int lun, void *cmd, int cmdlen, /* check the given arguments */ KASSERT(datalen == 0 || data != NULL, - ("%s: datalen > 0, but no buffer",USBDEVNAME(sc->sc_dev))); + ("%s: datalen > 0, but no buffer",sc->sc_dev.dv_xname)); KASSERT(cmdlen <= CBWCDBLENGTH, ("%s: cmdlen exceeds CDB length in CBW (%d > %d)", - USBDEVNAME(sc->sc_dev), cmdlen, CBWCDBLENGTH)); + sc->sc_dev.dv_xname, cmdlen, CBWCDBLENGTH)); KASSERT(dir == DIR_NONE || datalen > 0, ("%s: datalen == 0 while direction is not NONE\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); KASSERT(datalen == 0 || dir != DIR_NONE, ("%s: direction is NONE while datalen is not zero\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); KASSERT(sizeof(umass_bbb_cbw_t) == UMASS_BBB_CBW_SIZE, ("%s: CBW struct does not have the right size (%d vs. %d)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sizeof(umass_bbb_cbw_t), UMASS_BBB_CBW_SIZE)); KASSERT(sizeof(umass_bbb_csw_t) == UMASS_BBB_CSW_SIZE, ("%s: CSW struct does not have the right size (%d vs. %d)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sizeof(umass_bbb_csw_t), UMASS_BBB_CSW_SIZE)); /* @@ -1120,7 +1120,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, */ DPRINTF(UDMASS_BBB, ("%s: Handling BBB state %d (%s), xfer=%p, %s\n", - USBDEVNAME(sc->sc_dev), sc->transfer_state, + sc->sc_dev.dv_xname, sc->transfer_state, states[sc->transfer_state], xfer, usbd_errstr(err))); switch (sc->transfer_state) { @@ -1130,7 +1130,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, /* Command transport phase, error handling */ if (err) { DPRINTF(UDMASS_BBB, ("%s: failed to send CBW\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); /* If the device detects that the CBW is invalid, then * the device may STALL both bulk endpoints and require * a Bulk-Reset @@ -1161,7 +1161,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, return; } else { DPRINTF(UDMASS_BBB, ("%s: no data phase\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); } /* FALLTHROUGH if no data phase, err == 0 */ @@ -1173,11 +1173,11 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_get_xfer_status(xfer, NULL, NULL, &sc->transfer_actlen, NULL); DPRINTF(UDMASS_BBB, ("%s: BBB_DATA actlen=%d\n", - USBDEVNAME(sc->sc_dev), sc->transfer_actlen)); + sc->sc_dev.dv_xname, sc->transfer_actlen)); if (err) { DPRINTF(UDMASS_BBB, ("%s: Data-%s %d failed, " - "%s\n", USBDEVNAME(sc->sc_dev), + "%s\n", sc->sc_dev.dv_xname, (sc->transfer_dir == DIR_IN?"in":"out"), sc->transfer_datalen,usbd_errstr(err))); @@ -1217,7 +1217,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, */ if (err) { /* should not occur */ printf("%s: BBB bulk-%s stall clear failed, %s\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, (sc->transfer_dir == DIR_IN? "in":"out"), usbd_errstr(err)); umass_bbb_reset(sc, STATUS_WIRE_FAILED); @@ -1252,7 +1252,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, /* Status transfer, error handling */ if (err) { DPRINTF(UDMASS_BBB, ("%s: Failed to read CSW, %s%s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err), + sc->sc_dev.dv_xname, usbd_errstr(err), (sc->transfer_state == TSTATE_BBB_STATUS1? ", retrying":""))); @@ -1287,7 +1287,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, * indicate that the device is confused -> reset it. */ printf("%s: Invalid CSW: sig 0x%08x should be 0x%08x\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, UGETDW(sc->csw.dCSWSignature), CSWSIGNATURE); @@ -1296,7 +1296,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, } else if (UGETDW(sc->csw.dCSWTag) != UGETDW(sc->cbw.dCBWTag)) { printf("%s: Invalid CSW: tag %d should be %d\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, UGETDW(sc->csw.dCSWTag), UGETDW(sc->cbw.dCBWTag)); @@ -1306,7 +1306,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, /* CSW is valid here */ } else if (sc->csw.bCSWStatus > CSWSTATUS_PHASE) { printf("%s: Invalid CSW: status %d > %d\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->csw.bCSWStatus, CSWSTATUS_PHASE); @@ -1314,7 +1314,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, return; } else if (sc->csw.bCSWStatus == CSWSTATUS_PHASE) { printf("%s: Phase Error, residue = %d\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, UGETDW(sc->csw.dCSWDataResidue)); umass_bbb_reset(sc, STATUS_WIRE_FAILED); @@ -1323,13 +1323,13 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, } else if (sc->transfer_actlen > sc->transfer_datalen) { /* Buffer overrun! Don't let this go by unnoticed */ panic("%s: transferred %d bytes instead of %d bytes", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->transfer_actlen, sc->transfer_datalen); #if 0 } else if (sc->transfer_datalen - sc->transfer_actlen != UGETDW(sc->csw.dCSWDataResidue)) { DPRINTF(UDMASS_BBB, ("%s: actlen=%d != residue=%d\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->transfer_datalen - sc->transfer_actlen, UGETDW(sc->csw.dCSWDataResidue))); @@ -1338,7 +1338,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, #endif } else if (sc->csw.bCSWStatus == CSWSTATUS_FAILED) { DPRINTF(UDMASS_BBB, ("%s: Command Failed, res = %d\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, UGETDW(sc->csw.dCSWDataResidue))); /* SCSI command failed but transfer was successful */ @@ -1362,7 +1362,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_BBB_RESET1: if (err) printf("%s: BBB reset failed, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->transfer_state = TSTATE_BBB_RESET2; umass_clear_endpoint_stall(sc, UMASS_BULKIN, @@ -1372,7 +1372,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_BBB_RESET2: if (err) /* should not occur */ printf("%s: BBB bulk-in clear stall failed, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); /* no error recovery, otherwise we end up in a loop */ sc->transfer_state = TSTATE_BBB_RESET3; @@ -1383,7 +1383,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_BBB_RESET3: if (err) /* should not occur */ printf("%s: BBB bulk-out clear stall failed, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); /* no error recovery, otherwise we end up in a loop */ sc->transfer_state = TSTATE_IDLE; @@ -1398,7 +1398,7 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, /***** Default *****/ default: panic("%s: Unknown state %d", - USBDEVNAME(sc->sc_dev), sc->transfer_state); + sc->sc_dev.dv_xname, sc->transfer_state); } } @@ -1452,11 +1452,11 @@ umass_cbi_reset(struct umass_softc *sc, int status) */ DPRINTF(UDMASS_CBI, ("%s: CBI Reset\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); KASSERT(sizeof(sc->cbl) >= SEND_DIAGNOSTIC_CMDLEN, ("%s: CBL struct is too small (%d < %d)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sizeof(sc->cbl), SEND_DIAGNOSTIC_CMDLEN)); sc->transfer_state = TSTATE_CBI_RESET1; @@ -1484,7 +1484,7 @@ umass_cbi_transfer(struct umass_softc *sc, int lun, usbd_status err; DPRINTF(UDMASS_CBI,("%s: umass_cbi_transfer cmd=0x%02x, len=%d\n", - USBDEVNAME(sc->sc_dev), *(u_char *)cmd, datalen)); + sc->sc_dev.dv_xname, *(u_char *)cmd, datalen)); KASSERT(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I), ("sc->sc_wire == 0x%02x wrong for umass_cbi_transfer\n", @@ -1517,10 +1517,10 @@ umass_cbi_transfer(struct umass_softc *sc, int lun, /* check the given arguments */ KASSERT(datalen == 0 || data != NULL, - ("%s: datalen > 0, but no buffer",USBDEVNAME(sc->sc_dev))); + ("%s: datalen > 0, but no buffer",sc->sc_dev.dv_xname)); KASSERT(datalen == 0 || dir != DIR_NONE, ("%s: direction is NONE while datalen is not zero\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); /* store the details for the data transfer phase */ sc->transfer_dir = dir; @@ -1565,7 +1565,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, */ DPRINTF(UDMASS_CBI, ("%s: Handling CBI state %d (%s), xfer=%p, %s\n", - USBDEVNAME(sc->sc_dev), sc->transfer_state, + sc->sc_dev.dv_xname, sc->transfer_state, states[sc->transfer_state], xfer, usbd_errstr(err))); switch (sc->transfer_state) { @@ -1574,7 +1574,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_CBI_COMMAND: if (err == USBD_STALLED) { DPRINTF(UDMASS_CBI, ("%s: Command Transport failed\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); /* Status transport by control pipe (section 2.3.2.1). * The command contained in the command block failed. * @@ -1592,7 +1592,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, return; } else if (err) { DPRINTF(UDMASS_CBI, ("%s: failed to send ADSC\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); umass_cbi_reset(sc, STATUS_WIRE_FAILED); return; } @@ -1619,7 +1619,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, return; } else { DPRINTF(UDMASS_CBI, ("%s: no data phase\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); } /* FALLTHROUGH if no data phase, err == 0 */ @@ -1631,11 +1631,11 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_get_xfer_status(xfer, NULL, NULL, &sc->transfer_actlen, NULL); DPRINTF(UDMASS_CBI, ("%s: CBI_DATA actlen=%d\n", - USBDEVNAME(sc->sc_dev), sc->transfer_actlen)); + sc->sc_dev.dv_xname, sc->transfer_actlen)); if (err) { DPRINTF(UDMASS_CBI, ("%s: Data-%s %d failed, " - "%s\n", USBDEVNAME(sc->sc_dev), + "%s\n", sc->sc_dev.dv_xname, (sc->transfer_dir == DIR_IN?"in":"out"), sc->transfer_datalen,usbd_errstr(err))); @@ -1686,7 +1686,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_CBI_STATUS: if (err) { DPRINTF(UDMASS_CBI, ("%s: Status Transport failed\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); /* Status transport by interrupt pipe (section 2.3.2.2). */ @@ -1706,7 +1706,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, u_int32_t actlen; usbd_get_xfer_status(xfer, NULL, NULL, &actlen, NULL); DPRINTF(UDMASS_CBI, ("%s: CBI_STATUS actlen=%d\n", - USBDEVNAME(sc->sc_dev), actlen)); + sc->sc_dev.dv_xname, actlen)); if (actlen != 2) break; } @@ -1721,7 +1721,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, DPRINTF(UDMASS_CBI, ("%s: UFI CCI, ASC = 0x%02x, " "ASCQ = 0x%02x\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sbl.ufi.asc, sc->sbl.ufi.ascq)); if ((sc->sbl.ufi.asc == 0 && sc->sbl.ufi.ascq == 0) || @@ -1740,7 +1740,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, /* Command Interrupt Data Block */ DPRINTF(UDMASS_CBI, ("%s: type=0x%02x, value=0x%02x\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sbl.common.type, sc->sbl.common.value)); if (sc->sbl.common.type == IDB_TYPE_CCI) { @@ -1769,7 +1769,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_CBI_DCLEAR: if (err) { /* should not occur */ printf("%s: CBI bulk-in/out stall clear failed, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); umass_cbi_reset(sc, STATUS_WIRE_FAILED); } else { sc->transfer_state = TSTATE_IDLE; @@ -1781,7 +1781,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_CBI_SCLEAR: if (err) { /* should not occur */ printf("%s: CBI intr-in stall clear failed, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); umass_cbi_reset(sc, STATUS_WIRE_FAILED); } else { sc->transfer_state = TSTATE_IDLE; @@ -1794,7 +1794,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_CBI_RESET1: if (err) printf("%s: CBI reset failed, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->transfer_state = TSTATE_CBI_RESET2; umass_clear_endpoint_stall(sc, UMASS_BULKIN, @@ -1804,7 +1804,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_CBI_RESET2: if (err) /* should not occur */ printf("%s: CBI bulk-in stall clear failed, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); /* no error recovery, otherwise we end up in a loop */ sc->transfer_state = TSTATE_CBI_RESET3; @@ -1815,7 +1815,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, case TSTATE_CBI_RESET3: if (err) /* should not occur */ printf("%s: CBI bulk-out stall clear failed, %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); /* no error recovery, otherwise we end up in a loop */ sc->transfer_state = TSTATE_IDLE; @@ -1831,7 +1831,7 @@ umass_cbi_state(usbd_xfer_handle xfer, usbd_private_handle priv, /***** Default *****/ default: panic("%s: Unknown state %d", - USBDEVNAME(sc->sc_dev), sc->transfer_state); + sc->sc_dev.dv_xname, sc->transfer_state); } } @@ -1843,7 +1843,7 @@ umass_bbb_get_max_lun(struct umass_softc *sc, u_int8_t *maxlun) *maxlun = 0; /* Default to 0. */ - DPRINTF(UDMASS_BBB, ("%s: Get Max Lun\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(UDMASS_BBB, ("%s: Get Max Lun\n", sc->sc_dev.dv_xname)); /* The Get Max Lun command is a class-specific request. */ req.bmRequestType = UT_READ_CLASS_INTERFACE; @@ -1857,7 +1857,7 @@ umass_bbb_get_max_lun(struct umass_softc *sc, u_int8_t *maxlun) switch (err) { case USBD_NORMAL_COMPLETION: DPRINTF(UDMASS_BBB, ("%s: Max Lun %d\n", - USBDEVNAME(sc->sc_dev), *maxlun)); + sc->sc_dev.dv_xname, *maxlun)); break; case USBD_STALLED: @@ -1866,7 +1866,7 @@ umass_bbb_get_max_lun(struct umass_softc *sc, u_int8_t *maxlun) */ err = USBD_NORMAL_COMPLETION; DPRINTF(UDMASS_BBB, ("%s: Get Max Lun not supported\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); break; case USBD_SHORT_XFER: @@ -1875,12 +1875,12 @@ umass_bbb_get_max_lun(struct umass_softc *sc, u_int8_t *maxlun) */ err = USBD_NORMAL_COMPLETION; DPRINTF(UDMASS_BBB, ("%s: Get Max Lun SHORT_XFER\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); break; default: printf("%s: Get Max Lun failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); /* XXX Should we port_reset the device? */ break; } @@ -1901,7 +1901,7 @@ umass_bbb_dump_cbw(struct umass_softc *sc, umass_bbb_cbw_t *cbw) DPRINTF(UDMASS_BBB, ("%s: CBW %d: cmdlen=%d " "(0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%s), " "data = %d bytes, dir = %s\n", - USBDEVNAME(sc->sc_dev), tag, clen, + sc->sc_dev.dv_xname, tag, clen, c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], (clen > 10? "...":""), @@ -1918,7 +1918,7 @@ umass_bbb_dump_csw(struct umass_softc *sc, umass_bbb_csw_t *csw) int status = csw->bCSWStatus; DPRINTF(UDMASS_BBB, ("%s: CSW %d: sig = 0x%08x (%s), tag = %d, " - "res = %d, status = 0x%02x (%s)\n", USBDEVNAME(sc->sc_dev), + "res = %d, status = 0x%02x (%s)\n", sc->sc_dev.dv_xname, tag, sig, (sig == CSWSIGNATURE? "valid":"invalid"), tag, res, status, (status == CSWSTATUS_GOOD? "good": @@ -1943,7 +1943,7 @@ umass_dump_buffer(struct umass_softc *sc, u_int8_t *buffer, int buflen, j = i % 16; if (j == 0 && i != 0) { DPRINTF(UDMASS_GEN, ("%s: 0x %s%s\n", - USBDEVNAME(sc->sc_dev), s1, s2)); + sc->sc_dev.dv_xname, s1, s2)); s2[0] = '\0'; } snprintf(&s1[j*2], sizeof s1 - j*2, "%02x", buffer[i] & 0xff); @@ -1951,6 +1951,6 @@ umass_dump_buffer(struct umass_softc *sc, u_int8_t *buffer, int buflen, if (buflen > printlen) snprintf(s3, sizeof s3, " ..."); DPRINTF(UDMASS_GEN, ("%s: 0x %s%s%s\n", - USBDEVNAME(sc->sc_dev), s1, s2, s3)); + sc->sc_dev.dv_xname, s1, s2, s3)); } #endif diff --git a/sys/dev/usb/umass_quirks.c b/sys/dev/usb/umass_quirks.c index a192316e12f..fb7682c0026 100644 --- a/sys/dev/usb/umass_quirks.c +++ b/sys/dev/usb/umass_quirks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass_quirks.c,v 1.27 2007/06/05 08:43:56 mbalmer Exp $ */ +/* $OpenBSD: umass_quirks.c,v 1.28 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: umass_quirks.c,v 1.67 2004/06/28 07:49:16 mycroft Exp $ */ /* @@ -482,7 +482,7 @@ umass_init_insystem(struct umass_softc *sc) if (err) { DPRINTF(UDMASS_USB, ("%s: could not switch to Alt Interface 1\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); return (err); } diff --git a/sys/dev/usb/umass_scsi.c b/sys/dev/usb/umass_scsi.c index 980fa6394e4..a8b0be85a16 100644 --- a/sys/dev/usb/umass_scsi.c +++ b/sys/dev/usb/umass_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass_scsi.c,v 1.16 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: umass_scsi.c,v 1.17 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -108,7 +108,7 @@ umass_scsi_attach(struct umass_softc *sc) DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: SCSI\n" "sc = 0x%x, scbus = 0x%x\n", - USBDEVNAME(sc->sc_dev), sc, scbus)); + sc->sc_dev.dv_xname, sc, scbus)); sc->sc_refcnt++; scbus->base.sc_child = @@ -138,7 +138,7 @@ umass_atapi_attach(struct umass_softc *sc) DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: ATAPI\n" "sc = 0x%x, scbus = 0x%x\n", - USBDEVNAME(sc->sc_dev), sc, scbus)); + sc->sc_dev.dv_xname, sc, scbus)); sc->sc_refcnt++; scbus->base.sc_child = config_found((struct device *)sc, @@ -192,7 +192,7 @@ umass_scsi_cmd(struct scsi_xfer *xs) DPRINTF(UDMASS_CMD, ("%s: umass_scsi_cmd: at %lu.%06lu: %d:%d " "xs=%p cmd=0x%02x datalen=%d (quirks=0x%x, poll=%d)\n", - USBDEVNAME(sc->sc_dev), sc->tv.tv_sec, sc->tv.tv_usec, + sc->sc_dev.dv_xname, sc->tv.tv_sec, sc->tv.tv_usec, sc_link->target, sc_link->lun, xs, xs->cmd->opcode, xs->datalen, sc_link->quirks, xs->flags & SCSI_POLL)); @@ -211,7 +211,7 @@ umass_scsi_cmd(struct scsi_xfer *xs) #if defined(UMASS_DEBUG) if (sc_link->target != UMASS_SCSIID_DEVICE) { DPRINTF(UDMASS_SCSI, ("%s: wrong SCSI ID %d\n", - USBDEVNAME(sc->sc_dev), sc_link->target)); + sc->sc_dev.dv_xname, sc_link->target)); xs->error = XS_DRIVER_STUFFUP; goto done; } @@ -378,7 +378,7 @@ umass_scsi_cb(struct umass_softc *sc, void *priv, int residue, int status) default: panic("%s: Unknown status %d in umass_scsi_cb", - USBDEVNAME(sc->sc_dev), status); + sc->sc_dev.dv_xname, status); } if (xs->flags & SCSI_POLL) @@ -421,7 +421,7 @@ umass_scsi_sense_cb(struct umass_softc *sc, void *priv, int residue, break; default: DPRINTF(UDMASS_SCSI, ("%s: Autosense failed, status %d\n", - USBDEVNAME(sc->sc_dev), status)); + sc->sc_dev.dv_xname, status)); xs->error = XS_DRIVER_STUFFUP; break; } diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c index 41c3b198e5b..3e03b0af0ed 100644 --- a/sys/dev/usb/umct.c +++ b/sys/dev/usb/umct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umct.c,v 1.22 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: umct.c,v 1.23 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: umct.c,v 1.10 2003/02/23 04:20:07 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -181,7 +181,7 @@ umct_attach(struct device *parent, struct device *self, void *aux) usb_endpoint_descriptor_t *ed; char *devinfop; - char *devname = USBDEVNAME(sc->sc_dev); + char *devname = sc->sc_dev.dv_xname; usbd_status err; int i; struct ucom_attach_args uca; @@ -214,7 +214,7 @@ umct_attach(struct device *parent, struct device *self, void *aux) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -238,7 +238,7 @@ umct_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -264,21 +264,21 @@ umct_attach(struct device *parent, struct device *self, void *aux) if (uca.bulkin == -1) { printf("%s: Could not find data bulk in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } if (sc->sc_intr_number== -1) { printf("%s: Could not find interrupt in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -560,7 +560,7 @@ umct_open(void *addr, int portno) umct_intr, USBD_DEFAULT_INTERVAL); if (err) { DPRINTF(("%s: cannot open interrupt pipe (addr %d)\n", - USBDEVNAME(sc->sc_dev), sc->sc_intr_number)); + sc->sc_dev.dv_xname, sc->sc_intr_number)); return (EIO); } } @@ -583,11 +583,11 @@ umct_close(void *addr, int portno) err = usbd_abort_pipe(sc->sc_intr_pipe); if (err) printf("%s: abort interrupt pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_intr_pipe); if (err) printf("%s: close interrupt pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); free(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } @@ -607,14 +607,14 @@ umct_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) return; - DPRINTF(("%s: abnormal status: %s\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: abnormal status: %s\n", sc->sc_dev.dv_xname, usbd_errstr(status))); usbd_clear_endpoint_stall_async(sc->sc_intr_pipe); return; } DPRINTF(("%s: umct status = MSR:%02x, LSR:%02x\n", - USBDEVNAME(sc->sc_dev), buf[0],buf[1])); + sc->sc_dev.dv_xname, buf[0],buf[1])); sc->sc_lsr = sc->sc_msr = 0; mstatus = buf[0]; diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c index 901b1238aff..ffbf6424a06 100644 --- a/sys/dev/usb/umidi.c +++ b/sys/dev/usb/umidi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umidi.c,v 1.19 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: umidi.c,v 1.20 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -173,7 +173,7 @@ umidi_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(1,("umidi_attach\n")); devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); sc->sc_iface = uaa->iface; @@ -181,7 +181,7 @@ umidi_attach(struct device *parent, struct device *self, void *aux) sc->sc_quirk = umidi_search_quirk(uaa->vendor, uaa->product, uaa->ifaceno); - printf("%s: ", USBDEVNAME(sc->sc_dev)); + printf("%s: ", sc->sc_dev.dv_xname); umidi_print_quirk(sc->sc_quirk); @@ -195,7 +195,7 @@ umidi_attach(struct device *parent, struct device *self, void *aux) goto error; } printf("%s: out=%d, in=%d\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sc_out_num_jacks, sc->sc_in_num_jacks); err = assign_all_jacks_automatically(sc); @@ -224,7 +224,7 @@ umidi_attach(struct device *parent, struct device *self, void *aux) return; error: - printf("%s: disabled.\n", USBDEVNAME(sc->sc_dev)); + printf("%s: disabled.\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; } @@ -359,7 +359,7 @@ alloc_pipe(struct umidi_endpoint *ep) struct umidi_softc *sc = ep->sc; usbd_status err; - DPRINTF(("%s: alloc_pipe %p\n", USBDEVNAME(sc->sc_dev), ep)); + DPRINTF(("%s: alloc_pipe %p\n", sc->sc_dev.dv_xname, ep)); SIMPLEQ_INIT(&ep->intrq); ep->pending = 0; ep->busy = 0; @@ -384,7 +384,7 @@ alloc_pipe(struct umidi_endpoint *ep) static void free_pipe(struct umidi_endpoint *ep) { - DPRINTF(("%s: free_pipe %p\n", USBDEVNAME(ep->sc->sc_dev), ep)); + DPRINTF(("%s: free_pipe %p\n", ep->sc->sc_dev.dv_xname, ep)); usbd_abort_pipe(ep->pipe); usbd_close_pipe(ep->pipe); usbd_free_xfer(ep->xfer); @@ -476,14 +476,14 @@ alloc_all_endpoints_fixed_ep(struct umidi_softc *sc) fp->out_ep[i].ep); if (!epd) { DPRINTF(("%s: cannot get endpoint descriptor(out:%d)\n", - USBDEVNAME(sc->sc_dev), fp->out_ep[i].ep)); + sc->sc_dev.dv_xname, fp->out_ep[i].ep)); err = USBD_INVAL; goto error; } if (UE_GET_XFERTYPE(epd->bmAttributes)!=UE_BULK || UE_GET_DIR(epd->bEndpointAddress)!=UE_DIR_OUT) { printf("%s: illegal endpoint(out:%d)\n", - USBDEVNAME(sc->sc_dev), fp->out_ep[i].ep); + sc->sc_dev.dv_xname, fp->out_ep[i].ep); err = USBD_INVAL; goto error; } @@ -503,14 +503,14 @@ alloc_all_endpoints_fixed_ep(struct umidi_softc *sc) fp->in_ep[i].ep); if (!epd) { DPRINTF(("%s: cannot get endpoint descriptor(in:%d)\n", - USBDEVNAME(sc->sc_dev), fp->in_ep[i].ep)); + sc->sc_dev.dv_xname, fp->in_ep[i].ep)); err = USBD_INVAL; goto error; } if (UE_GET_XFERTYPE(epd->bmAttributes)!=UE_BULK || UE_GET_DIR(epd->bEndpointAddress)!=UE_DIR_IN) { printf("%s: illegal endpoint(in:%d)\n", - USBDEVNAME(sc->sc_dev), fp->in_ep[i].ep); + sc->sc_dev.dv_xname, fp->in_ep[i].ep); err = USBD_INVAL; goto error; } @@ -1049,7 +1049,7 @@ dump_sc(struct umidi_softc *sc) { int i; - DPRINTFN(10, ("%s: dump_sc\n", USBDEVNAME(sc->sc_dev))); + DPRINTFN(10, ("%s: dump_sc\n", sc->sc_dev.dv_xname)); for (i=0; i<sc->sc_out_num_endpoints; i++) { DPRINTFN(10, ("\tout_ep(%p):\n", &sc->sc_out_ep[i])); dump_ep(&sc->sc_out_ep[i]); @@ -1127,7 +1127,7 @@ start_input_transfer(struct umidi_endpoint *ep) err = usbd_transfer(ep->xfer); if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS) { DPRINTF(("%s: start_input_transfer: usbd_transfer() failed err=%s\n", - USBDEVNAME(ep->sc->sc_dev), usbd_errstr(err))); + ep->sc->sc_dev.dv_xname, usbd_errstr(err))); return err; } return USBD_NORMAL_COMPLETION; @@ -1144,7 +1144,7 @@ start_output_transfer(struct umidi_endpoint *ep) err = usbd_transfer(ep->xfer); if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS) { DPRINTF(("%s: start_output_transfer: usbd_transfer() failed err=%s\n", - USBDEVNAME(ep->sc->sc_dev), usbd_errstr(err))); + ep->sc->sc_dev.dv_xname, usbd_errstr(err))); return err; } ep->used = ep->packetsize; @@ -1156,7 +1156,7 @@ start_output_transfer(struct umidi_endpoint *ep) #define DPR_PACKET(dir, sc, p) \ DPRINTFN(500, \ ("%s: umidi packet(" #dir "): %02X %02X %02X %02X\n", \ - USBDEVNAME(sc->sc_dev), \ + sc->sc_dev.dv_xname, \ (unsigned char)(p)->buffer[0], \ (unsigned char)(p)->buffer[1], \ (unsigned char)(p)->buffer[2], \ diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 75f7f0df930..cbb8205da3d 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umodem.c,v 1.28 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: umodem.c,v 1.29 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: umodem.c,v 1.45 2002/09/23 05:51:23 simonb Exp $ */ /* @@ -210,7 +210,7 @@ umodem_attach(struct device *parent, struct device *self, void *aux) sc->sc_ctl_iface = uaa->iface; id = usbd_get_interface_descriptor(sc->sc_ctl_iface); - printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), + printf("%s: %s, iclass %d/%d\n", sc->sc_dev.dv_xname, devinfop, id->bInterfaceClass, id->bInterfaceSubClass); usbd_devinfo_free(devinfop); sc->sc_ctl_iface_no = id->bInterfaceNumber; @@ -250,12 +250,12 @@ umodem_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_data_iface_no == 0) { printf("%s: no pointer to data interface\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto bad; } printf("%s: data interface %d, has %sCM over data, has %sbreak\n", - USBDEVNAME(sc->sc_dev), sc->sc_data_iface_no, + sc->sc_dev.dv_xname, sc->sc_data_iface_no, sc->sc_cm_cap & USB_CDC_CM_OVER_DATA ? "" : "no ", sc->sc_acm_cap & USB_CDC_ACM_HAS_BREAK ? "" : "no "); @@ -271,7 +271,7 @@ umodem_attach(struct device *parent, struct device *self, void *aux) } } if (sc->sc_data_iface == NULL) { - printf("%s: no data interface\n", USBDEVNAME(sc->sc_dev)); + printf("%s: no data interface\n", sc->sc_dev.dv_xname); goto bad; } @@ -286,7 +286,7 @@ umodem_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_data_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); goto bad; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -300,12 +300,12 @@ umodem_attach(struct device *parent, struct device *self, void *aux) if (uca.bulkin == -1) { printf("%s: Could not find data bulk in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto bad; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto bad; } @@ -320,7 +320,7 @@ umodem_attach(struct device *parent, struct device *self, void *aux) err = 0; if (err) { printf("%s: could not set data multiplex mode\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto bad; } sc->sc_cm_over_data = 1; @@ -346,7 +346,7 @@ umodem_attach(struct device *parent, struct device *self, void *aux) if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && (ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) { printf("%s: status change notification available\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_ctl_notify = ed->bEndpointAddress; } } @@ -413,11 +413,11 @@ umodem_close(void *addr, int portno) err = usbd_abort_pipe(sc->sc_notify_pipe); if (err) printf("%s: abort notify pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_notify_pipe); if (err) printf("%s: close notify pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_notify_pipe = NULL; } } @@ -434,14 +434,14 @@ umodem_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) return; - printf("%s: abnormal status: %s\n", USBDEVNAME(sc->sc_dev), + printf("%s: abnormal status: %s\n", sc->sc_dev.dv_xname, usbd_errstr(status)); return; } if (sc->sc_notify_buf.bmRequestType != UCDC_NOTIFICATION) { DPRINTF(("%s: unknown message type (%02x) on notify pipe\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sc_notify_buf.bmRequestType)); return; } @@ -454,12 +454,12 @@ umodem_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) */ if (UGETW(sc->sc_notify_buf.wLength) != 2) { printf("%s: Invalid notification length! (%d)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, UGETW(sc->sc_notify_buf.wLength)); break; } DPRINTF(("%s: notify bytes = %02x%02x\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sc_notify_buf.data[0], sc->sc_notify_buf.data[1])); /* Currently, lsr is always zero. */ @@ -476,7 +476,7 @@ umodem_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) break; default: DPRINTF(("%s: unknown notify message: %02x\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sc_notify_buf.bNotification)); break; } diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 06aaa1b30c0..8cc3d9ab7d3 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ums.c,v 1.21 2007/06/05 08:43:56 mbalmer Exp $ */ +/* $OpenBSD: ums.c,v 1.22 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -170,24 +170,24 @@ ums_attach(struct device *parent, struct device *self, void *aux) if (!hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), uha->reportid, hid_input, &sc->sc_loc_x, &flags)) { printf("\n%s: mouse has no X report\n", - USBDEVNAME(sc->sc_hdev.sc_dev)); + sc->sc_hdev.sc_dev.dv_xname); return; } if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) { printf("\n%s: X report 0x%04x not supported\n", - USBDEVNAME(sc->sc_hdev.sc_dev), flags); + sc->sc_hdev.sc_dev.dv_xname, flags); return; } if (!hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), uha->reportid, hid_input, &sc->sc_loc_y, &flags)) { printf("\n%s: mouse has no Y report\n", - USBDEVNAME(sc->sc_hdev.sc_dev)); + sc->sc_hdev.sc_dev.dv_xname); return; } if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) { printf("\n%s: Y report 0x%04x not supported\n", - USBDEVNAME(sc->sc_hdev.sc_dev), flags); + sc->sc_hdev.sc_dev.dv_xname, flags); return; } @@ -196,7 +196,7 @@ ums_attach(struct device *parent, struct device *self, void *aux) uha->reportid, hid_input, &sc->sc_loc_z, &flags)) { if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) { DPRINTF(("\n%s: Wheel report 0x%04x not supported\n", - USBDEVNAME(sc->sc_hdev.sc_dev), flags)); + sc->sc_hdev.sc_dev.dv_xname, flags)); sc->sc_loc_z.size = 0; /* Bad Z coord, ignore it */ } else { sc->flags |= UMS_Z; @@ -212,7 +212,7 @@ ums_attach(struct device *parent, struct device *self, void *aux) uha->reportid, hid_input, &sc->sc_loc_w, &flags)) { if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) { DPRINTF(("\n%s: Z report 0x%04x not supported\n", - USBDEVNAME(sc->sc_hdev.sc_dev), flags)); + sc->sc_hdev.sc_dev.dv_xname, flags)); /* Bad Z coord, ignore it */ sc->sc_loc_w.size = 0; } @@ -222,7 +222,7 @@ ums_attach(struct device *parent, struct device *self, void *aux) uha->reportid, hid_input, &sc->sc_loc_z, &flags)) { if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) { DPRINTF(("\n%s: Z report 0x%04x not supported\n", - USBDEVNAME(sc->sc_hdev.sc_dev), flags)); + sc->sc_hdev.sc_dev.dv_xname, flags)); sc->sc_loc_z.size = 0; /* Bad Z coord, ignore it */ } else { sc->flags |= UMS_Z; diff --git a/sys/dev/usb/umsm.c b/sys/dev/usb/umsm.c index a070acb7fc0..0e32e5ca2f6 100644 --- a/sys/dev/usb/umsm.c +++ b/sys/dev/usb/umsm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umsm.c,v 1.11 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: umsm.c,v 1.12 2007/06/10 14:49:01 mbalmer Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -105,12 +105,12 @@ umsm_attach(struct device *parent, struct device *self, void *aux) bzero(&uca, sizeof(uca)); sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); if (usbd_set_config_index(sc->sc_udev, UMSM_CONFIG_NO, 1) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -120,7 +120,7 @@ umsm_attach(struct device *parent, struct device *self, void *aux) &sc->sc_iface); if (error != 0) { printf("%s: could not get interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -132,7 +132,7 @@ umsm_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor found for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -145,7 +145,7 @@ umsm_attach(struct device *parent, struct device *self, void *aux) uca.bulkout = ed->bEndpointAddress; } if (uca.bulkin == -1 || uca.bulkout == -1) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } diff --git a/sys/dev/usb/uow.c b/sys/dev/usb/uow.c index a2f253ca3b2..de924a5ca6e 100644 --- a/sys/dev/usb/uow.c +++ b/sys/dev/usb/uow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uow.c,v 1.18 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uow.c,v 1.19 2007/06/10 14:49:01 mbalmer Exp $ */ /* * Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org> @@ -116,7 +116,7 @@ uow_attach(struct device *parent, struct device *self, void *aux) /* Display device info string */ printf("\n"); if ((devinfop = usbd_devinfo_alloc(uaa->device, 0)) != NULL) { - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); } @@ -124,7 +124,7 @@ uow_attach(struct device *parent, struct device *self, void *aux) if ((error = usbd_set_config_no(sc->sc_udev, DS2490_USB_CONFIG, 0)) != 0) { printf("%s: failed to set config %d: %s\n", - USBDEVNAME(sc->sc_dev), DS2490_USB_CONFIG, + sc->sc_dev.dv_xname, DS2490_USB_CONFIG, usbd_errstr(error)); return; } @@ -133,7 +133,7 @@ uow_attach(struct device *parent, struct device *self, void *aux) if ((error = usbd_device2interface_handle(sc->sc_udev, DS2490_USB_IFACE, &sc->sc_iface)) != 0) { printf("%s: failed to get iface %d: %s\n", - USBDEVNAME(sc->sc_dev), DS2490_USB_IFACE, + sc->sc_dev.dv_xname, DS2490_USB_IFACE, usbd_errstr(error)); return; } @@ -144,7 +144,7 @@ uow_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: failed to get endpoint %d descriptor\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return; } @@ -160,7 +160,7 @@ uow_attach(struct device *parent, struct device *self, void *aux) } if (ep_ibulk == -1 || ep_obulk == -1 || ep_intr == -1) { printf("%s: missing endpoint: ibulk %d, obulk %d, intr %d\n", - USBDEVNAME(sc->sc_dev), ep_ibulk, ep_obulk, ep_intr); + sc->sc_dev.dv_xname, ep_ibulk, ep_obulk, ep_intr); return; } @@ -168,13 +168,13 @@ uow_attach(struct device *parent, struct device *self, void *aux) if ((error = usbd_open_pipe(sc->sc_iface, ep_ibulk, USBD_EXCLUSIVE_USE, &sc->sc_ph_ibulk)) != 0) { printf("%s: failed to open bulk-in pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); return; } if ((error = usbd_open_pipe(sc->sc_iface, ep_obulk, USBD_EXCLUSIVE_USE, &sc->sc_ph_obulk)) != 0) { printf("%s: failed to open bulk-out pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } if ((error = usbd_open_pipe_intr(sc->sc_iface, ep_intr, @@ -182,7 +182,7 @@ uow_attach(struct device *parent, struct device *self, void *aux) sc->sc_regs, sizeof(sc->sc_regs), uow_intr, USBD_DEFAULT_INTERVAL)) != 0) { printf("%s: failed to open intr pipe: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(error)); + sc->sc_dev.dv_xname, usbd_errstr(error)); goto fail; } @@ -190,7 +190,7 @@ uow_attach(struct device *parent, struct device *self, void *aux) /* Allocate xfer for bulk transfers */ if ((sc->sc_xfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) { printf("%s: failed to alloc bulk xfer\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto fail; } #endif @@ -409,7 +409,7 @@ uow_cmd(struct uow_softc *sc, int type, int cmd, int param) USETW(req.wLength, 0); if ((error = usbd_do_request(sc->sc_udev, &req, NULL)) != 0) { printf("%s: cmd failed, type 0x%02x, cmd 0x%04x, " - "param 0x%04x: %s\n", USBDEVNAME(sc->sc_dev), type, cmd, + "param 0x%04x: %s\n", sc->sc_dev.dv_xname, type, cmd, param, usbd_errstr(error)); if (cmd != DS2490_CTL_RESET_DEVICE) uow_reset(sc); @@ -420,7 +420,7 @@ again: if (tsleep(sc->sc_regs, PRIBIO, "uowcmd", (UOW_TIMEOUT * hz) / 1000) != 0) { printf("%s: cmd timeout, type 0x%02x, cmd 0x%04x, " - "param 0x%04x\n", USBDEVNAME(sc->sc_dev), type, cmd, + "param 0x%04x\n", sc->sc_dev.dv_xname, type, cmd, param); return (1); } @@ -455,12 +455,12 @@ uow_read(struct uow_softc *sc, void *buf, int len) /* XXX: implement FIFO status monitoring */ if (len > DS2490_DATAFIFOSIZE) { printf("%s: read %d bytes, xfer too big\n", - USBDEVNAME(sc->sc_dev), len); + sc->sc_dev.dv_xname, len); return (-1); } if ((sc->sc_xfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) { - printf("%s: failed to alloc xfer\n", USBDEVNAME(sc->sc_dev)); + printf("%s: failed to alloc xfer\n", sc->sc_dev.dv_xname); return (-1); } usbd_setup_xfer(sc->sc_xfer, sc->sc_ph_ibulk, sc, buf, len, @@ -469,7 +469,7 @@ uow_read(struct uow_softc *sc, void *buf, int len) usbd_free_xfer(sc->sc_xfer); if (error != 0) { printf("%s: read failed, len %d: %s\n", - USBDEVNAME(sc->sc_dev), len, usbd_errstr(error)); + sc->sc_dev.dv_xname, len, usbd_errstr(error)); uow_reset(sc); return (-1); } @@ -486,12 +486,12 @@ uow_write(struct uow_softc *sc, const void *buf, int len) /* XXX: implement FIFO status monitoring */ if (len > DS2490_DATAFIFOSIZE) { printf("%s: write %d bytes, xfer too big\n", - USBDEVNAME(sc->sc_dev), len); + sc->sc_dev.dv_xname, len); return (1); } if ((sc->sc_xfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) { - printf("%s: failed to alloc xfer\n", USBDEVNAME(sc->sc_dev)); + printf("%s: failed to alloc xfer\n", sc->sc_dev.dv_xname); return (-1); } usbd_setup_xfer(sc->sc_xfer, sc->sc_ph_obulk, sc, (void *)buf, len, 0, @@ -500,7 +500,7 @@ uow_write(struct uow_softc *sc, const void *buf, int len) usbd_free_xfer(sc->sc_xfer); if (error != 0) { printf("%s: write failed, len %d: %s\n", - USBDEVNAME(sc->sc_dev), len, usbd_errstr(error)); + sc->sc_dev.dv_xname, len, usbd_errstr(error)); uow_reset(sc); return (1); } diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index a382c789e4e..bc0d70fdcf9 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uplcom.c,v 1.38 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: uplcom.c,v 1.39 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uplcom.c,v 1.29 2002/09/23 05:51:23 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -215,7 +215,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) usb_endpoint_descriptor_t *ed; char *devinfop; - char *devname = USBDEVNAME(sc->sc_dev); + char *devname = sc->sc_dev.dv_xname; usbd_status err; int i; struct ucom_attach_args uca; @@ -247,7 +247,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -256,7 +256,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) ddesc = usbd_get_device_descriptor(sc->sc_udev); if (ddesc == NULL) { printf("%s: failed to get device descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -266,7 +266,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) * variants. The datasheets disagree. */ if (ddesc->bMaxPacketSize == 0x40) { - DPRINTF(("%s: Assuming HX variant\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(("%s: Assuming HX variant\n", sc->sc_dev.dv_xname)); sc->sc_type_hx = 1; } else sc->sc_type_hx = 0; @@ -290,7 +290,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -304,7 +304,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_intr_number== -1) { printf("%s: Could not find interrupt in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -344,7 +344,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -360,14 +360,14 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) if (uca.bulkin == -1) { printf("%s: Could not find data bulk in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -388,7 +388,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) err = uplcom_reset(sc); if (err) { - printf("%s: reset failed, %s\n", USBDEVNAME(sc->sc_dev), + printf("%s: reset failed, %s\n", sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_dying = 1; return; @@ -690,7 +690,7 @@ uplcom_open(void *addr, int portno) uplcom_intr, USBD_DEFAULT_INTERVAL); if (err) { DPRINTF(("%s: cannot open interrupt pipe (addr %d)\n", - USBDEVNAME(sc->sc_dev), sc->sc_intr_number)); + sc->sc_dev.dv_xname, sc->sc_intr_number)); return (EIO); } } @@ -750,11 +750,11 @@ uplcom_close(void *addr, int portno) err = usbd_abort_pipe(sc->sc_intr_pipe); if (err) printf("%s: abort interrupt pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_intr_pipe); if (err) printf("%s: close interrupt pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); free(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } @@ -774,13 +774,13 @@ uplcom_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) return; - DPRINTF(("%s: abnormal status: %s\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: abnormal status: %s\n", sc->sc_dev.dv_xname, usbd_errstr(status))); usbd_clear_endpoint_stall_async(sc->sc_intr_pipe); return; } - DPRINTF(("%s: uplcom status = %02x\n", USBDEVNAME(sc->sc_dev), buf[8])); + DPRINTF(("%s: uplcom status = %02x\n", sc->sc_dev.dv_xname, buf[8])); sc->sc_lsr = sc->sc_msr = 0; pstatus = buf[8]; diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 33e8b583d17..82091f8c597 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: urio.c,v 1.26 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: urio.c,v 1.27 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: urio.c,v 1.15 2002/10/23 09:14:02 jdolecek Exp $ */ /* @@ -135,20 +135,20 @@ urio_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(10,("urio_attach: sc=%p\n", sc)); devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, URIO_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } err = usbd_device2interface_handle(dev, URIO_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -164,7 +164,7 @@ urio_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: couldn't get ep %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -176,7 +176,7 @@ urio_attach(struct device *parent, struct device *self, void *aux) } } if (sc->sc_in_addr == -1 || sc->sc_out_addr == -1) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); return; } diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index a4391421edb..8d58718b798 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.45 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: usb.c,v 1.46 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -186,7 +186,7 @@ usb_attach(struct device *parent, struct device *self, void *aux) sc->sc_bus->soft = softintr_establish(IPL_SOFTNET, sc->sc_bus->methods->soft_intr, sc->sc_bus); if (sc->sc_bus->soft == NULL) { - printf("%s: can't register softintr\n", USBDEVNAME(sc->sc_dev)); + printf("%s: can't register softintr\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -202,7 +202,7 @@ usb_attach(struct device *parent, struct device *self, void *aux) if (dev->hub == NULL) { sc->sc_dying = 1; printf("%s: root device is not a hub\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } sc->sc_bus->root_hub = dev; @@ -217,7 +217,7 @@ usb_attach(struct device *parent, struct device *self, void *aux) #endif } else { printf("%s: root hub problem, error=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); sc->sc_dying = 1; } if (cold) @@ -820,7 +820,7 @@ usb_detach(device_ptr_t self, int flags) wakeup(&sc->sc_bus->needs_explore); if (tsleep(sc, PWAIT, "usbdet", hz * 60)) printf("%s: event thread didn't die\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); DPRINTF(("usb_detach: event thread dead\n")); } diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index a8aed532b64..d92999a3f1b 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_port.h,v 1.76 2007/06/10 10:53:48 mbalmer Exp $ */ +/* $OpenBSD: usb_port.h,v 1.77 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: usb_port.h,v 1.62 2003/02/15 18:33:30 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -85,7 +85,6 @@ typedef struct proc *usb_proc_ptr; #define slinear16_to_ulinear8_be linear16_to_ulinear8_be typedef struct device *device_ptr_t; -#define USBDEVNAME(bdev) ((bdev).dv_xname) #define USBDEVUNIT(bdev) ((bdev).dv_unit) #define USBDEVPTRNAME(bdevptr) ((bdevptr)->dv_xname) #define USBGETSOFTC(d) ((void *)(d)) diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index aeb3945d7dc..b426eeac43d 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.51 2007/06/05 08:43:56 mbalmer Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.52 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -715,7 +715,7 @@ usbd_set_config_index(usbd_device_handle dev, int index, int msg) if (msg) printf("%s: device addr %d (config %d) exceeds power " "budget, %d mA > %d mA\n", - USBDEVNAME(dev->bus->bdev), dev->address, + dev->bus->bdev.dv_xname, dev->address, cdp->bConfigurationValue, power, dev->powersrc->power); err = USBD_NO_POWER; @@ -970,7 +970,7 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth, addr = usbd_getnewaddr(bus); if (addr < 0) { printf("%s: No free USB addresses, new device ignored.\n", - USBDEVNAME(bus->bdev)); + bus->bdev.dv_xname); return (USBD_NO_ADDR); } diff --git a/sys/dev/usb/usbf.c b/sys/dev/usb/usbf.c index 92d8ccb33e5..a4a59d56e21 100644 --- a/sys/dev/usb/usbf.c +++ b/sys/dev/usb/usbf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbf.c,v 1.5 2007/06/06 19:25:49 mk Exp $ */ +/* $OpenBSD: usbf.c,v 1.6 2007/06/10 14:49:01 mbalmer Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -80,7 +80,7 @@ struct usbf_softc { int sc_dying; }; -#define DEVNAME(sc) USBDEVNAME((sc)->sc_dev) +#define DEVNAME(sc) ((sc)->sc_dev.dv_xname) int usbf_match(struct device *, void *, void *); void usbf_attach(struct device *, struct device *, void *); diff --git a/sys/dev/usb/usbf_subr.c b/sys/dev/usb/usbf_subr.c index dc87c1c6089..68c42ce1845 100644 --- a/sys/dev/usb/usbf_subr.c +++ b/sys/dev/usb/usbf_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbf_subr.c,v 1.4 2007/06/10 10:15:35 mbalmer Exp $ */ +/* $OpenBSD: usbf_subr.c,v 1.5 2007/06/10 14:49:01 mbalmer Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -889,7 +889,7 @@ usbf_dump_buffer(usbf_xfer_handle xfer) u_char *p = xfer->buffer; u_int i; - printf("%s: ep%d-%s, length=%u, %s", USBDEVNAME(*dev), index, + printf("%s: ep%d-%s, length=%u, %s", dev->dv_xname, index, (xfer->rqflags & URQ_REQUEST) ? "setup" : (index == 0 ? "in" : (dir == UE_DIR_IN ? "in" : "out")), xfer->length, usbf_errstr(xfer->status)); diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index c6c93c696eb..41c95c7b740 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uscanner.c,v 1.28 2007/06/10 10:53:49 mbalmer Exp $ */ +/* $OpenBSD: uscanner.c,v 1.29 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uscanner.c,v 1.40 2003/01/27 00:32:44 wiz Exp $ */ /* @@ -264,7 +264,7 @@ uscanner_attach(struct device *parent, struct device *self, void *aux) usbd_status err; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); sc->sc_dev_flags = uscanner_lookup(uaa->vendor, uaa->product)->flags; @@ -274,7 +274,7 @@ uscanner_attach(struct device *parent, struct device *self, void *aux) err = usbd_set_config_no(uaa->device, 1, 1); /* XXX */ if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -284,7 +284,7 @@ uscanner_attach(struct device *parent, struct device *self, void *aux) id = usbd_get_interface_descriptor(sc->sc_iface); if (err || id == 0) { printf("%s: could not get interface descriptor, err=%d,id=%p\n", - USBDEVNAME(sc->sc_dev), err, id); + sc->sc_dev.dv_xname, err, id); return; } @@ -293,7 +293,7 @@ uscanner_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == 0) { printf("%s: could not read endpoint descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -312,7 +312,7 @@ uscanner_attach(struct device *parent, struct device *self, void *aux) /* Verify that we goething sensible */ if (ed_bulkin == NULL || ed_bulkout == NULL) { printf("%s: bulk-in and/or bulk-out endpoint not found\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -356,7 +356,7 @@ uscanneropen(dev_t dev, int flag, int mode, usb_proc_ptr p) USBD_EXCLUSIVE_USE, &sc->sc_bulkin_pipe); if (err) { printf("%s: cannot open bulk-in pipe (addr %d)\n", - USBDEVNAME(sc->sc_dev), sc->sc_bulkin); + sc->sc_dev.dv_xname, sc->sc_bulkin); uscanner_do_close(sc); return (EIO); } @@ -366,7 +366,7 @@ uscanneropen(dev_t dev, int flag, int mode, usb_proc_ptr p) USBD_EXCLUSIVE_USE, &sc->sc_bulkout_pipe); if (err) { printf("%s: cannot open bulk-out pipe (addr %d)\n", - USBDEVNAME(sc->sc_dev), sc->sc_bulkout); + sc->sc_dev.dv_xname, sc->sc_bulkout); uscanner_do_close(sc); return (EIO); } @@ -452,7 +452,7 @@ uscanner_do_read(struct uscanner_softc *sc, struct uio *uio, int flag) usbd_status err; int error = 0; - DPRINTFN(5, ("%s: uscannerread\n", USBDEVNAME(sc->sc_dev))); + DPRINTFN(5, ("%s: uscannerread\n", sc->sc_dev.dv_xname)); if (sc->sc_dying) return (EIO); @@ -507,7 +507,7 @@ uscanner_do_write(struct uscanner_softc *sc, struct uio *uio, int flag) int error = 0; usbd_status err; - DPRINTFN(5, ("%s: uscanner_do_write\n", USBDEVNAME(sc->sc_dev))); + DPRINTFN(5, ("%s: uscanner_do_write\n", sc->sc_dev.dv_xname)); if (sc->sc_dying) return (EIO); diff --git a/sys/dev/usb/uslcom.c b/sys/dev/usb/uslcom.c index 796aec90cc6..41d24c5dcb7 100644 --- a/sys/dev/usb/uslcom.c +++ b/sys/dev/usb/uslcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uslcom.c,v 1.9 2007/06/10 10:53:49 mbalmer Exp $ */ +/* $OpenBSD: uslcom.c,v 1.10 2007/06/10 14:49:01 mbalmer Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -158,12 +158,12 @@ uslcom_attach(struct device *parent, struct device *self, void *aux) bzero(&uca, sizeof(uca)); sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); if (usbd_set_config_index(sc->sc_udev, USLCOM_CONFIG_NO, 1) != 0) { printf("%s: could not set configuration no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -173,7 +173,7 @@ uslcom_attach(struct device *parent, struct device *self, void *aux) &sc->sc_iface); if (error != 0) { printf("%s: could not get interface handle\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -185,7 +185,7 @@ uslcom_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor found for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -199,7 +199,7 @@ uslcom_attach(struct device *parent, struct device *self, void *aux) } if (uca.bulkin == -1 || uca.bulkout == -1) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } diff --git a/sys/dev/usb/usscanner.c b/sys/dev/usb/usscanner.c index 6bcf94db2f0..434879b5c75 100644 --- a/sys/dev/usb/usscanner.c +++ b/sys/dev/usb/usscanner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usscanner.c,v 1.18 2007/06/10 10:53:49 mbalmer Exp $ */ +/* $OpenBSD: usscanner.c,v 1.19 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: usscanner.c,v 1.6 2001/01/23 14:04:14 augustss Exp $ */ /* @@ -206,20 +206,20 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) DPRINTFN(10,("usscanner_attach: sc=%p\n", sc)); devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_no(dev, USSCANNER_CONFIG_NO, 1); if (err) { printf("%s: setting config no failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } err = usbd_device2interface_handle(dev, USSCANNER_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); return; } @@ -236,7 +236,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: couldn't get ep %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -252,7 +252,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) } if (sc->sc_in_addr == -1 || sc->sc_intr_addr == -1 || sc->sc_out_addr == -1) { - printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); return; } @@ -260,7 +260,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) USBD_EXCLUSIVE_USE, &sc->sc_in_pipe); if (err) { printf("%s: open in pipe failed, err=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); return; } @@ -270,7 +270,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) if (err) { printf("%s: open intr pipe failed, err=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); usscanner_cleanup(sc); return; } @@ -278,7 +278,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) USBD_EXCLUSIVE_USE, &sc->sc_out_pipe); if (err) { printf("%s: open out pipe failed, err=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); usscanner_cleanup(sc); return; } @@ -286,7 +286,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) sc->sc_cmd_xfer = usbd_alloc_xfer(uaa->device); if (sc->sc_cmd_xfer == NULL) { printf("%s: alloc cmd xfer failed, err=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); usscanner_cleanup(sc); return; } @@ -296,7 +296,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) USSCANNER_MAX_TRANSFER_SIZE); if (sc->sc_cmd_buffer == NULL) { printf("%s: alloc cmd buffer failed, err=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); usscanner_cleanup(sc); return; } @@ -304,7 +304,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) sc->sc_intr_xfer = usbd_alloc_xfer (uaa->device); if (sc->sc_intr_xfer == NULL) { printf("%s: alloc intr xfer failed, err=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); usscanner_cleanup(sc); return; } @@ -312,7 +312,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) sc->sc_data_xfer = usbd_alloc_xfer(uaa->device); if (sc->sc_data_xfer == NULL) { printf("%s: alloc data xfer failed, err=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); usscanner_cleanup(sc); return; } @@ -320,7 +320,7 @@ usscanner_attach(struct device *parent, struct device *self, void *aux) USSCANNER_MAX_TRANSFER_SIZE); if (sc->sc_data_buffer == NULL) { printf("%s: alloc data buffer failed, err=%d\n", - USBDEVNAME(sc->sc_dev), err); + sc->sc_dev.dv_xname, err); usscanner_cleanup(sc); return; } @@ -476,10 +476,10 @@ usscanner_intr_cb(usbd_xfer_handle xfer, usbd_private_handle priv, #ifdef USSCANNER_DEBUG if (sc->sc_state != UAS_STATUS) { - printf("%s: !UAS_STATUS\n", USBDEVNAME(sc->sc_dev)); + printf("%s: !UAS_STATUS\n", sc->sc_dev.dv_xname); } if (sc->sc_status != 0) { - printf("%s: status byte=0x%02x\n", USBDEVNAME(sc->sc_dev), sc->sc_status); + printf("%s: status byte=0x%02x\n", sc->sc_dev.dv_xname, sc->sc_status); } #endif /* XXX what should we do on non-0 status */ @@ -504,7 +504,7 @@ usscanner_data_cb(usbd_xfer_handle xfer, usbd_private_handle priv, #ifdef USSCANNER_DEBUG if (sc->sc_state != UAS_DATA) { - printf("%s: !UAS_DATA\n", USBDEVNAME(sc->sc_dev)); + printf("%s: !UAS_DATA\n", sc->sc_dev.dv_xname); } #endif @@ -546,7 +546,7 @@ usscanner_sensedata_cb(usbd_xfer_handle xfer, usbd_private_handle priv, #ifdef USSCANNER_DEBUG if (sc->sc_state != UAS_SENSEDATA) { - printf("%s: !UAS_SENSEDATA\n", USBDEVNAME(sc->sc_dev)); + printf("%s: !UAS_SENSEDATA\n", sc->sc_dev.dv_xname); } #endif @@ -606,7 +606,7 @@ usscanner_sensecmd_cb(usbd_xfer_handle xfer, usbd_private_handle priv, #endif if (sc->sc_state != UAS_SENSECMD) { - printf("%s: !UAS_SENSECMD\n", USBDEVNAME(sc->sc_dev)); + printf("%s: !UAS_SENSECMD\n", sc->sc_dev.dv_xname); xs->error = XS_DRIVER_STUFFUP; goto done; } @@ -654,7 +654,7 @@ usscanner_cmd_cb(usbd_xfer_handle xfer, usbd_private_handle priv, #endif if (sc->sc_state != UAS_CMD) { - printf("%s: !UAS_CMD\n", USBDEVNAME(sc->sc_dev)); + printf("%s: !UAS_CMD\n", sc->sc_dev.dv_xname); xs->error = XS_DRIVER_STUFFUP; goto done; } @@ -712,7 +712,7 @@ usscanner_scsipi_cmd(struct scsipi_xfer *xs) #ifdef notyet DPRINTFN(8, ("%s: usscanner_scsi_cmd: %d:%d " "xs=%p cmd=0x%02x datalen=%d (quirks=0x%x, poll=%d)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc_link->scsipi_scsi.target, sc_link->scsipi_scsi.lun, xs, xs->cmd->opcode, xs->datalen, sc_link->quirks, xs->xs_control & XS_CTL_POLL)); @@ -726,14 +726,14 @@ usscanner_scsipi_cmd(struct scsipi_xfer *xs) #ifdef USSCANNER_DEBUG #ifdef notyet if (sc_link->scsipi_scsi.target != USSCANNER_SCSIID_DEVICE) { - DPRINTF(("%s: wrong SCSI ID %d\n", USBDEVNAME(sc->sc_dev), + DPRINTF(("%s: wrong SCSI ID %d\n", sc->sc_dev.dv_xname, sc_link->scsipi_scsi.target)); xs->error = XS_DRIVER_STUFFUP; goto done; } #endif if (sc->sc_state != UAS_IDLE) { - printf("%s: !UAS_IDLE\n", USBDEVNAME(sc->sc_dev)); + printf("%s: !UAS_IDLE\n", sc->sc_dev.dv_xname); xs->error = XS_DRIVER_STUFFUP; goto done; } diff --git a/sys/dev/usb/uts.c b/sys/dev/usb/uts.c index efc55588078..65d74ef3ce5 100644 --- a/sys/dev/usb/uts.c +++ b/sys/dev/usb/uts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uts.c,v 1.12 2007/06/10 10:53:49 mbalmer Exp $ */ +/* $OpenBSD: uts.c,v 1.13 2007/06/10 14:49:01 mbalmer Exp $ */ /* * Copyright (c) 2007 Robert Nagy <robert@openbsd.org> @@ -151,14 +151,14 @@ uts_attach(struct device *parent, struct device *self, void *aux) /* Display device info string */ printf("\n"); if ((devinfop = usbd_devinfo_alloc(uaa->device, 0)) != NULL) { - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); } /* Move the device into the configured state. */ if (usbd_set_config_index(uaa->device, UTS_CONFIG_INDEX, 1) != 0) { printf("%s: could not set configuartion no\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -167,7 +167,7 @@ uts_attach(struct device *parent, struct device *self, void *aux) cdesc = usbd_get_config_descriptor(sc->sc_udev); if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -175,7 +175,7 @@ uts_attach(struct device *parent, struct device *self, void *aux) /* get the interface */ if (usbd_device2interface_handle(uaa->device, 0, &sc->sc_iface) != 0) { printf("%s: failed to get interface\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -189,7 +189,7 @@ uts_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -203,7 +203,7 @@ uts_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_intr_number== -1) { printf("%s: Could not find interrupt in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -410,7 +410,7 @@ uts_get_pos(usbd_private_handle addr, struct uts_pos tp) } DPRINTF(("%s: down = 0x%x, sc->sc_pkts = 0x%x\n", - USBDEVNAME(sc->sc_dev), down, sc->sc_pkts)); + sc->sc_dev.dv_xname, down, sc->sc_pkts)); /* x/y values are not reliable if there is no pressure */ if (down) { @@ -457,7 +457,7 @@ uts_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) return; if (status != USBD_NORMAL_COMPLETION) { - printf("%s: status %d\n", USBDEVNAME(sc->sc_dev), status); + printf("%s: status %d\n", sc->sc_dev.dv_xname, status); usbd_clear_endpoint_stall_async(sc->sc_intr_pipe); return; } @@ -466,12 +466,12 @@ uts_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) if (len != sc->sc_pkts) { DPRINTF(("%s: bad input length %d != %d\n", - USBDEVNAME(sc->sc_dev), len, sc->sc_isize)); + sc->sc_dev.dv_xname, len, sc->sc_isize)); return; } DPRINTF(("%s: tp.z = %d, tp.x = %d, tp.y = %d\n", - USBDEVNAME(sc->sc_dev), tp.z, tp.x, tp.y)); + sc->sc_dev.dv_xname, tp.z, tp.x, tp.y)); wsmouse_input(sc->sc_wsmousedev, tp.z, tp.x, tp.y, 0, 0, WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y | diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index 5b2fac493a4..d7b9666fc9c 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvisor.c,v 1.31 2007/06/10 10:53:49 mbalmer Exp $ */ +/* $OpenBSD: uvisor.c,v 1.32 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uvisor.c,v 1.21 2003/08/03 21:59:26 nathanw Exp $ */ /* @@ -230,7 +230,7 @@ uvisor_attach(struct device *parent, struct device *self, void *aux) struct uvisor_palm_connection_info palmconinfo; usb_endpoint_descriptor_t *ed; char *devinfop; - char *devname = USBDEVNAME(sc->sc_dev); + char *devname = sc->sc_dev.dv_xname; int i, j, hasin, hasout, port; usbd_status err; struct ucom_attach_args uca; @@ -261,7 +261,7 @@ uvisor_attach(struct device *parent, struct device *self, void *aux) if ((sc->sc_flags & (VISOR | PALM4)) == 0) { printf("%s: device is neither visor nor palm\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); goto bad; } @@ -281,7 +281,7 @@ uvisor_attach(struct device *parent, struct device *self, void *aux) err = uvisor_init(sc, &coninfo, &palmconinfo); if (err) { - printf("%s: init failed, %s\n", USBDEVNAME(sc->sc_dev), + printf("%s: init failed, %s\n", sc->sc_dev.dv_xname, usbd_errstr(err)); goto bad; } @@ -338,7 +338,7 @@ uvisor_attach(struct device *parent, struct device *self, void *aux) ucomprint, ucomsubmatch); else printf("%s: no proper endpoints for port %d (%d,%d)\n", - USBDEVNAME(sc->sc_dev), port, hasin, hasout); + sc->sc_dev.dv_xname, port, hasin, hasout); } } else { sc->sc_numcon = palmconinfo.num_ports; diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index b05eb731c92..4c11affacad 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvscom.c,v 1.14 2007/06/10 10:53:49 mbalmer Exp $ */ +/* $OpenBSD: uvscom.c,v 1.15 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uvscom.c,v 1.9 2003/02/12 15:36:20 ichiro Exp $ */ /*- * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. @@ -231,7 +231,7 @@ uvscom_attach(struct device *parent, struct device *self, void *aux) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfop; - const char *devname = USBDEVNAME(sc->sc_dev); + const char *devname = sc->sc_dev.dv_xname; usbd_status err; int i; struct ucom_attach_args uca; @@ -263,7 +263,7 @@ uvscom_attach(struct device *parent, struct device *self, void *aux) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -286,7 +286,7 @@ uvscom_attach(struct device *parent, struct device *self, void *aux) ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", - USBDEVNAME(sc->sc_dev), i); + sc->sc_dev.dv_xname, i); sc->sc_dying = 1; return; } @@ -306,19 +306,19 @@ uvscom_attach(struct device *parent, struct device *self, void *aux) if (uca.bulkin == -1) { printf("%s: Could not find data bulk in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } if (sc->sc_intr_number == -1) { printf("%s: Could not find interrupt in\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); sc->sc_dying = 1; return; } @@ -341,7 +341,7 @@ uvscom_attach(struct device *parent, struct device *self, void *aux) err = uvscom_reset(sc); if (err) { - printf("%s: reset failed, %s\n", USBDEVNAME(sc->sc_dev), + printf("%s: reset failed, %s\n", sc->sc_dev.dv_xname, usbd_errstr(err)); sc->sc_dying = 1; return; @@ -413,7 +413,7 @@ uvscom_readstat(struct uvscom_softc *sc) usbd_status err; uint16_t r; - DPRINTF(("%s: send readstat\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(("%s: send readstat\n", sc->sc_dev.dv_xname)); req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = UVSCOM_READ_STATUS; @@ -424,12 +424,12 @@ uvscom_readstat(struct uvscom_softc *sc) err = usbd_do_request(sc->sc_udev, &req, &r); if (err) { printf("%s: uvscom_readstat: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (err); } DPRINTF(("%s: uvscom_readstat: r = %d\n", - USBDEVNAME(sc->sc_dev), r)); + sc->sc_dev.dv_xname, r)); return (USBD_NORMAL_COMPLETION); } @@ -440,7 +440,7 @@ uvscom_shutdown(struct uvscom_softc *sc) usb_device_request_t req; usbd_status err; - DPRINTF(("%s: send shutdown\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(("%s: send shutdown\n", sc->sc_dev.dv_xname)); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UVSCOM_SHUTDOWN; @@ -451,7 +451,7 @@ uvscom_shutdown(struct uvscom_softc *sc) err = usbd_do_request(sc->sc_udev, &req, NULL); if (err) { printf("%s: uvscom_shutdown: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (err); } @@ -461,7 +461,7 @@ uvscom_shutdown(struct uvscom_softc *sc) usbd_status uvscom_reset(struct uvscom_softc *sc) { - DPRINTF(("%s: uvscom_reset\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(("%s: uvscom_reset\n", sc->sc_dev.dv_xname)); return (USBD_NORMAL_COMPLETION); } @@ -469,7 +469,7 @@ uvscom_reset(struct uvscom_softc *sc) usbd_status uvscom_set_crtscts(struct uvscom_softc *sc) { - DPRINTF(("%s: uvscom_set_crtscts\n", USBDEVNAME(sc->sc_dev))); + DPRINTF(("%s: uvscom_set_crtscts\n", sc->sc_dev.dv_xname)); return (USBD_NORMAL_COMPLETION); } @@ -481,7 +481,7 @@ uvscom_set_line(struct uvscom_softc *sc, uint16_t line) usbd_status err; DPRINTF(("%s: uvscom_set_line: %04x\n", - USBDEVNAME(sc->sc_dev), line)); + sc->sc_dev.dv_xname, line)); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UVSCOM_LINE_CTL; @@ -492,7 +492,7 @@ uvscom_set_line(struct uvscom_softc *sc, uint16_t line) err = usbd_do_request(sc->sc_udev, &req, NULL); if (err) { printf("%s: uvscom_set_line: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (err); } @@ -506,7 +506,7 @@ uvscom_set_line_coding(struct uvscom_softc *sc, uint16_t lsp, uint16_t ls) usbd_status err; DPRINTF(("%s: uvscom_set_line_coding: %02x %02x\n", - USBDEVNAME(sc->sc_dev), lsp, ls)); + sc->sc_dev.dv_xname, lsp, ls)); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UVSCOM_SET_SPEED; @@ -517,7 +517,7 @@ uvscom_set_line_coding(struct uvscom_softc *sc, uint16_t lsp, uint16_t ls) err = usbd_do_request(sc->sc_udev, &req, NULL); if (err) { printf("%s: uvscom_set_line_coding: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (err); } @@ -530,7 +530,7 @@ uvscom_set_line_coding(struct uvscom_softc *sc, uint16_t lsp, uint16_t ls) err = usbd_do_request(sc->sc_udev, &req, NULL); if (err) { printf("%s: uvscom_set_line_coding: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return (err); } @@ -541,7 +541,7 @@ void uvscom_dtr(struct uvscom_softc *sc, int onoff) { DPRINTF(("%s: uvscom_dtr: onoff = %d\n", - USBDEVNAME(sc->sc_dev), onoff)); + sc->sc_dev.dv_xname, onoff)); if (sc->sc_dtr == onoff) return; /* no change */ @@ -560,7 +560,7 @@ void uvscom_rts(struct uvscom_softc *sc, int onoff) { DPRINTF(("%s: uvscom_rts: onoff = %d\n", - USBDEVNAME(sc->sc_dev), onoff)); + sc->sc_dev.dv_xname, onoff)); if (sc->sc_rts == onoff) return; /* no change */ @@ -579,7 +579,7 @@ void uvscom_break(struct uvscom_softc *sc, int onoff) { DPRINTF(("%s: uvscom_break: onoff = %d\n", - USBDEVNAME(sc->sc_dev), onoff)); + sc->sc_dev.dv_xname, onoff)); if (onoff) uvscom_set_line(sc, SET(sc->sc_lcr, UVSCOM_BREAK)); @@ -614,7 +614,7 @@ uvscom_param(void *addr, int portno, struct termios *t) uint16_t ls; DPRINTF(("%s: uvscom_param: sc = %p\n", - USBDEVNAME(sc->sc_dev), sc)); + sc->sc_dev.dv_xname, sc)); ls = 0; @@ -719,7 +719,7 @@ uvscom_open(void *addr, int portno) err = uvscom_readstat(sc); if (err) { DPRINTF(("%s: uvscom_open: readstat faild\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); return (EIO); } @@ -735,7 +735,7 @@ uvscom_open(void *addr, int portno) UVSCOM_INTR_INTERVAL); if (err) { printf("%s: cannot open interrupt pipe (addr %d)\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, sc->sc_intr_number); return (EIO); } @@ -753,14 +753,14 @@ uvscom_open(void *addr, int portno) } if (i == 0) { DPRINTF(("%s: unit is not ready\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); return (EIO); } /* check PC card was inserted */ if (ISSET(sc->sc_usr, UVSCOM_NOCARD)) { DPRINTF(("%s: no card\n", - USBDEVNAME(sc->sc_dev))); + sc->sc_dev.dv_xname)); return (EIO); } } @@ -785,12 +785,12 @@ uvscom_close(void *addr, int portno) err = usbd_abort_pipe(sc->sc_intr_pipe); if (err) printf("%s: abort interrupt pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, usbd_errstr(err)); err = usbd_close_pipe(sc->sc_intr_pipe); if (err) printf("%s: close interrupt pipe failed: %s\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, usbd_errstr(err)); free(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; @@ -812,14 +812,14 @@ uvscom_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) return; printf("%s: uvscom_intr: abnormal status: %s\n", - USBDEVNAME(sc->sc_dev), + sc->sc_dev.dv_xname, usbd_errstr(status)); usbd_clear_endpoint_stall_async(sc->sc_intr_pipe); return; } DPRINTFN(2, ("%s: uvscom status = %02x %02x\n", - USBDEVNAME(sc->sc_dev), buf[0], buf[1])); + sc->sc_dev.dv_xname, buf[0], buf[1])); sc->sc_lsr = sc->sc_msr = 0; sc->sc_usr = buf[1]; diff --git a/sys/dev/usb/uyap.c b/sys/dev/usb/uyap.c index 074fdf24a97..dc996308c7f 100644 --- a/sys/dev/usb/uyap.c +++ b/sys/dev/usb/uyap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uyap.c,v 1.11 2007/06/06 19:25:50 mk Exp $ */ +/* $OpenBSD: uyap.c,v 1.12 2007/06/10 14:49:01 mbalmer Exp $ */ /* $NetBSD: uyap.c,v 1.6 2002/07/11 21:14:37 augustss Exp $ */ /* @@ -84,12 +84,12 @@ uyap_attachhook(void *xsc) err = ezload_downloads_and_reset(sc->sc_udev, firmwares); if (err) { printf("%s: download ezdata format firmware error: %s\n", - USBDEVNAME(sc->sc_dev), usbd_errstr(err)); + sc->sc_dev.dv_xname, usbd_errstr(err)); return; } printf("%s: firmware download complete, disconnecting.\n", - USBDEVNAME(sc->sc_dev)); + sc->sc_dev.dv_xname); } void @@ -101,10 +101,10 @@ uyap_attach(struct device *parent, struct device *self, void *aux) char *devinfop; devinfop = usbd_devinfo_alloc(dev, 0); - printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop); usbd_devinfo_free(devinfop); - printf("%s: downloading firmware\n", USBDEVNAME(sc->sc_dev)); + printf("%s: downloading firmware\n", sc->sc_dev.dv_xname); sc->sc_udev = dev; if (rootvp == NULL) |