diff options
Diffstat (limited to 'sys')
33 files changed, 130 insertions, 137 deletions
diff --git a/sys/dev/if_ndis/if_ndis_usb.c b/sys/dev/if_ndis/if_ndis_usb.c index 8089f6c..d5073ac 100644 --- a/sys/dev/if_ndis/if_ndis_usb.c +++ b/sys/dev/if_ndis/if_ndis_usb.c @@ -130,7 +130,7 @@ USB_ATTACH(ndisusb) sc = (struct ndis_softc *)dummy; if (uaa->device == NULL) - USB_ATTACH_ERROR_RETURN; + return ENXIO; sc->ndis_dev = self; @@ -140,9 +140,9 @@ USB_ATTACH(ndisusb) windrv_create_pdo(drv, self); if (ndis_attach(self) != 0) - USB_ATTACH_ERROR_RETURN; + return ENXIO; - USB_ATTACH_SUCCESS_RETURN; + return 0; } static struct resource_list * diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 7b40328..504cc17 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -552,14 +552,14 @@ USB_ATTACH(uaudio) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } err = uaudio_identify(sc, cdesc); if (err) { printf("%s: audio descriptors make no sense, error=%d\n", device_get_nameunit(sc->sc_dev), err); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->sc_ac_ifaceh = uaa->iface; @@ -586,7 +586,7 @@ USB_ATTACH(uaudio) if (sc->sc_alts[j].ifaceh == NULL) { printf("%s: alt %d missing AS interface(s)\n", device_get_nameunit(sc->sc_dev), j); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } } @@ -620,7 +620,7 @@ USB_ATTACH(uaudio) sc->sc_dying = 0; if (audio_attach_mi(sc->sc_dev)) { printf("audio_attach_mi failed\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } #endif @@ -630,8 +630,7 @@ USB_ATTACH(uaudio) OID_AUTO, "async", CTLFLAG_RW, &sc->async, 0, "Asynchronous USB request"); #endif - - USB_ATTACH_SUCCESS_RETURN; + return 0; } #if defined(__NetBSD__) || defined(__OpenBSD__) diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index ce7c416..401dd25 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -644,13 +644,13 @@ USB_ATTACH(aue) if (usbd_set_config_no(sc->aue_udev, AUE_CONFIG_NO, 0)) { device_printf(self, "getting interface handle failed\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } err = usbd_device2interface_handle(uaa->device, AUE_IFACE_IDX, &iface); if (err) { device_printf(self, "getting interface handle failed\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->aue_iface = iface; @@ -666,7 +666,7 @@ USB_ATTACH(aue) ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { device_printf(self, "couldn't get ep %d\n", i); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -702,7 +702,7 @@ USB_ATTACH(aue) mtx_destroy(&sc->aue_mtx); sx_destroy(&sc->aue_sx); usb_ether_task_destroy(&sc->aue_taskqueue); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } ifp->if_softc = sc; if_initname(ifp, "aue", sc->aue_unit); @@ -736,7 +736,7 @@ USB_ATTACH(aue) mtx_destroy(&sc->aue_mtx); sx_destroy(&sc->aue_sx); usb_ether_task_destroy(&sc->aue_taskqueue); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->aue_qdat.ifp = ifp; @@ -751,7 +751,7 @@ USB_ATTACH(aue) sc->aue_link = 1; AUE_SXUNLOCK(sc); - USB_ATTACH_SUCCESS_RETURN; + return 0; } static int diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index af9df5a..ceb5edf 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -417,7 +417,7 @@ USB_ATTACH(axe) if (usbd_set_config_no(sc->axe_udev, AXE_CONFIG_NO, 1)) { device_printf(sc->axe_dev, "getting interface handle failed\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } usb_init_task(&sc->axe_tick_task, axe_tick_task, sc); @@ -425,7 +425,7 @@ USB_ATTACH(axe) if (usbd_device2interface_handle(uaa->device, AXE_IFACE_IDX, &sc->axe_iface)) { device_printf(sc->axe_dev, "getting interface handle failed\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } id = usbd_get_interface_descriptor(sc->axe_iface); @@ -435,7 +435,7 @@ USB_ATTACH(axe) ed = usbd_interface2endpoint_descriptor(sc->axe_iface, i); if (!ed) { device_printf(sc->axe_dev, "couldn't get ep %d\n", i); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -479,7 +479,7 @@ USB_ATTACH(axe) AXE_SLEEPUNLOCK(sc); sx_destroy(&sc->axe_sleeplock); mtx_destroy(&sc->axe_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } ifp->if_softc = sc; if_initname(ifp, "axe", device_get_unit(sc->axe_dev)); @@ -505,7 +505,7 @@ USB_ATTACH(axe) AXE_SLEEPUNLOCK(sc); sx_destroy(&sc->axe_sleeplock); mtx_destroy(&sc->axe_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* @@ -521,7 +521,7 @@ USB_ATTACH(axe) AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); - USB_ATTACH_SUCCESS_RETURN; + return 0; } static int diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index b3fbcc9..cb01b6f 100644 --- a/sys/dev/usb/if_cdce.c +++ b/sys/dev/usb/if_cdce.c @@ -160,7 +160,7 @@ USB_ATTACH(cdce) UDESC_CS_INTERFACE, UDESCSUB_CDC_UNION); if (ud == NULL) { device_printf(sc->cdce_dev, "no union descriptor\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } data_ifcno = ud->bSlaveInterface[0]; @@ -179,7 +179,7 @@ USB_ATTACH(cdce) if (sc->cdce_data_iface == NULL) { device_printf(sc->cdce_dev, "no data interface\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* @@ -208,7 +208,7 @@ USB_ATTACH(cdce) if (usbd_set_interface(sc->cdce_data_iface, j)) { device_printf(sc->cdce_dev, "setting alternate interface failed\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* Find endpoints. */ id = usbd_get_interface_descriptor(sc->cdce_data_iface); @@ -218,7 +218,7 @@ USB_ATTACH(cdce) if (!ed) { device_printf(sc->cdce_dev, "could not read endpoint descriptor\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -242,11 +242,11 @@ USB_ATTACH(cdce) if (sc->cdce_bulkin_no == -1) { device_printf(sc->cdce_dev, "could not find data bulk in\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (sc->cdce_bulkout_no == -1 ) { device_printf(sc->cdce_dev, "could not find data bulk out\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } mtx_init(&sc->cdce_mtx, device_get_nameunit(sc->cdce_dev), MTX_NETWORK_LOCK, @@ -285,7 +285,7 @@ USB_ATTACH(cdce) device_printf(sc->cdce_dev, "can not if_alloc()\n"); CDCE_UNLOCK(sc); mtx_destroy(&sc->cdce_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } ifp->if_softc = sc; if_initname(ifp, "cdce", device_get_unit(sc->cdce_dev)); @@ -314,7 +314,7 @@ USB_ATTACH(cdce) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->cdce_udev, USBDEV(sc->cdce_dev)); - USB_ATTACH_SUCCESS_RETURN; + return 0; } USB_DETACH(cdce) diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 8e9b3a9..cefa42f 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -443,7 +443,7 @@ USB_ATTACH(cue) if (usbd_set_config_no(sc->cue_udev, CUE_CONFIG_NO, 0)) { device_printf(sc->cue_dev, "getting interface handle failed\n"); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } id = usbd_get_interface_descriptor(uaa->iface); @@ -453,7 +453,7 @@ USB_ATTACH(cue) ed = usbd_interface2endpoint_descriptor(uaa->iface, i); if (!ed) { device_printf(sc->cue_dev, "couldn't get ep %d\n", i); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -485,7 +485,7 @@ USB_ATTACH(cue) device_printf(sc->cue_dev, "can not if_alloc()\n"); CUE_UNLOCK(sc); mtx_destroy(&sc->cue_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } ifp->if_softc = sc; if_initname(ifp, "cue", device_get_unit(sc->cue_dev)); @@ -511,7 +511,7 @@ USB_ATTACH(cue) sc->cue_dying = 0; CUE_UNLOCK(sc); - USB_ATTACH_SUCCESS_RETURN; + return 0; } static int diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 4a1a46b..3fbe904 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -421,7 +421,7 @@ USB_ATTACH(kue) ed = usbd_interface2endpoint_descriptor(uaa->iface, i); if (!ed) { device_printf(sc->kue_dev, "couldn't get ep %d\n", i); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -443,7 +443,7 @@ USB_ATTACH(kue) if (kue_load_fw(sc)) { KUE_UNLOCK(sc); mtx_destroy(&sc->kue_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* Reset the adapter. */ @@ -461,7 +461,7 @@ USB_ATTACH(kue) device_printf(sc->kue_dev, "can not if_alloc()\n"); KUE_UNLOCK(sc); mtx_destroy(&sc->kue_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } ifp->if_softc = sc; if_initname(ifp, "kue", device_get_unit(sc->kue_dev)); @@ -487,7 +487,7 @@ USB_ATTACH(kue) KUE_UNLOCK(sc); - USB_ATTACH_SUCCESS_RETURN; + return 0; } static int diff --git a/sys/dev/usb/if_rue.c b/sys/dev/usb/if_rue.c index 7ca7c7d..3839926 100644 --- a/sys/dev/usb/if_rue.c +++ b/sys/dev/usb/if_rue.c @@ -679,7 +679,7 @@ USB_ATTACH(rue) sc->rue_dying = 0; RUE_UNLOCK(sc); - USB_ATTACH_SUCCESS_RETURN; + return 0; error2: if_free(ifp); @@ -687,7 +687,7 @@ USB_ATTACH(rue) RUE_UNLOCK(sc); mtx_destroy(&sc->rue_mtx); error: - USB_ATTACH_ERROR_RETURN; + return ENXIO; } static int diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 16ed1ad..2af38f1 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -388,7 +388,7 @@ USB_ATTACH(rum) if (usbd_set_config_no(sc->sc_udev, RT2573_CONFIG_NO, 0) != 0) { printf("%s: could not set configuration no\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* get the first interface handle */ @@ -397,7 +397,7 @@ USB_ATTACH(rum) if (error != 0) { printf("%s: could not get interface handle\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* @@ -411,7 +411,7 @@ USB_ATTACH(rum) if (ed == NULL) { printf("%s: no endpoint descriptor for iface %d\n", device_get_nameunit(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -424,7 +424,7 @@ USB_ATTACH(rum) if (sc->sc_rx_no == -1 || sc->sc_tx_no == -1) { printf("%s: missing endpoint\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK, @@ -444,7 +444,7 @@ USB_ATTACH(rum) if (ntries == 1000) { printf("%s: timeout waiting for chip to settle\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* retrieve MAC address and various other things from EEPROM */ @@ -459,7 +459,7 @@ USB_ATTACH(rum) if (error != 0) { device_printf(sc->sc_dev, "could not load 8051 microcode\n"); mtx_destroy(&sc->sc_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } ifp = sc->sc_ifp = if_alloc(IFT_ETHER); @@ -467,7 +467,7 @@ USB_ATTACH(rum) printf("%s: can not if_alloc()\n", device_get_nameunit(sc->sc_dev)); mtx_destroy(&sc->sc_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } ifp->if_softc = sc; @@ -565,7 +565,7 @@ USB_ATTACH(rum) if (bootverbose) ieee80211_announce(ic); - USB_ATTACH_SUCCESS_RETURN; + return 0; } USB_DETACH(rum) diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index bbac3d6..4908057 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -442,7 +442,7 @@ USB_ATTACH(udav) if_free(ifp); UDAV_UNLOCK(sc); mtx_destroy(&sc->sc_mtx); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->sc_qdat.ifp = ifp; @@ -472,11 +472,11 @@ USB_ATTACH(udav) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, dev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return 0; bad: sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* detach */ diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c index 4ca311b..e4d71fb 100644 --- a/sys/dev/usb/if_ural.c +++ b/sys/dev/usb/if_ural.c @@ -373,7 +373,7 @@ USB_ATTACH(ural) if (usbd_set_config_no(sc->sc_udev, RAL_CONFIG_NO, 0) != 0) { printf("%s: could not set configuration no\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* get the first interface handle */ @@ -382,7 +382,7 @@ USB_ATTACH(ural) if (error != 0) { printf("%s: could not get interface handle\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* @@ -396,7 +396,7 @@ USB_ATTACH(ural) if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", device_get_nameunit(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -409,7 +409,7 @@ USB_ATTACH(ural) if (sc->sc_rx_no == -1 || sc->sc_tx_no == -1) { printf("%s: missing endpoint\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK, @@ -434,7 +434,7 @@ USB_ATTACH(ural) if (ifp == NULL) { printf("%s: can not if_alloc()\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } ifp->if_softc = sc; @@ -504,7 +504,7 @@ USB_ATTACH(ural) if (bootverbose) ieee80211_announce(ic); - USB_ATTACH_SUCCESS_RETURN; + return 0; } USB_DETACH(ural) diff --git a/sys/dev/usb/uark.c b/sys/dev/usb/uark.c index 6deb557..96cf939 100644 --- a/sys/dev/usb/uark.c +++ b/sys/dev/usb/uark.c @@ -189,12 +189,12 @@ USB_ATTACH(uark) DPRINTF(("uark: in=0x%x out=0x%x\n", ucom->sc_bulkin_no, ucom->sc_bulkout_no)); ucom_attach(&sc->sc_ucom); - USB_ATTACH_SUCCESS_RETURN; + return 0; bad: DPRINTF(("uftdi_attach: ATTACH ERROR\n")); ucom->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } USB_DETACH(uark) diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index 12c5e8c..9e24af2 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -398,10 +398,10 @@ USB_ATTACH(ubsa) TASK_INIT(&sc->sc_task, 0, ubsa_notify, sc); ucom_attach(ucom); - USB_ATTACH_SUCCESS_RETURN; + return 0; error: - USB_ATTACH_ERROR_RETURN; + return ENXIO; } USB_DETACH(ubsa) diff --git a/sys/dev/usb/ubser.c b/sys/dev/usb/ubser.c index 1a71b41..eb2bdb9 100644 --- a/sys/dev/usb/ubser.c +++ b/sys/dev/usb/ubser.c @@ -283,7 +283,7 @@ USB_ATTACH(ubser) if (ed == NULL) { printf("%s: couldn't get ep %d\n", device_get_nameunit(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -373,7 +373,7 @@ USB_ATTACH(ubser) } ubserstartread(sc); - USB_ATTACH_SUCCESS_RETURN; + return 0; fail_4: for (i = 0; i < sc->sc_numser; i++) { @@ -408,7 +408,7 @@ bad: } DPRINTF(("ubser_attach: ATTACH ERROR\n")); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } USB_DETACH(ubser) diff --git a/sys/dev/usb/udbp.c b/sys/dev/usb/udbp.c index fd6ecb5..a937407 100644 --- a/sys/dev/usb/udbp.c +++ b/sys/dev/usb/udbp.c @@ -270,7 +270,7 @@ USB_ATTACH(udbp) if (!ed) { printf("%s: could not read endpoint descriptor\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN @@ -289,7 +289,7 @@ USB_ATTACH(udbp) if (ed_bulkin == NULL || ed_bulkout == NULL) { printf("%s: bulk-in and/or bulk-out endpoint not found\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (ed_bulkin->wMaxPacketSize[0] != ed_bulkout->wMaxPacketSize[0] || @@ -300,7 +300,7 @@ USB_ATTACH(udbp) ed_bulkout->wMaxPacketSize[0], ed_bulkin->wMaxPacketSize[1], ed_bulkout->wMaxPacketSize[1]); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->sc_bulkin = ed_bulkin->bEndpointAddress; @@ -383,7 +383,7 @@ USB_ATTACH(udbp) if (err) { goto bad; } - USB_ATTACH_SUCCESS_RETURN; + return 0; bad: #if 0 /* probably done in udbp_detach() */ if (sc->sc_bulkout_buffer) { @@ -400,7 +400,7 @@ bad: } #endif udbp_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 6e60356..bdd57ee 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -160,11 +160,11 @@ USB_ATTACH(ufm) UID_ROOT, GID_OPERATOR, 0644, "ufm%d", device_get_unit(self)); DPRINTFN(10, ("ufm_attach: %p\n", sc->sc_udev)); - USB_ATTACH_SUCCESS_RETURN; + return 0; nobulk: device_printf(sc->sc_dev, "could not find %s\n", ermsg); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index aa86337..f82bf8a 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -357,12 +357,12 @@ USB_ATTACH(uftdi) #endif DPRINTF(("uftdi: in=0x%x out=0x%x\n", ucom->sc_bulkin_no, ucom->sc_bulkout_no)); ucom_attach(&sc->sc_ucom); - USB_ATTACH_SUCCESS_RETURN; + return 0; bad: DPRINTF(("uftdi_attach: ATTACH ERROR\n")); ucom->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } #if 0 int diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 007f8c8..ae20401 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -225,7 +225,7 @@ USB_ATTACH(uhid) printf("%s: could not read endpoint descriptor\n", device_get_nameunit(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } DPRINTFN(10,("uhid_attach: bLength=%d bDescriptorType=%d " @@ -241,7 +241,7 @@ USB_ATTACH(uhid) (ed->bmAttributes & UE_XFERTYPE) != UE_INTERRUPT) { printf("%s: unexpected endpoint\n", device_get_nameunit(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->sc_ep_addr = ed->bEndpointAddress; @@ -296,7 +296,7 @@ USB_ATTACH(uhid) if (err) { printf("%s: no report descriptor\n", device_get_nameunit(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } (void)usbd_set_idle(iface, 0, 0); @@ -314,7 +314,7 @@ USB_ATTACH(uhid) 0644, "uhid%d", device_get_unit(self)); #endif - USB_ATTACH_SUCCESS_RETURN; + return 0; } #if defined(__NetBSD__) || defined(__OpenBSD__) diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c index 7898c50..d827740 100644 --- a/sys/dev/usb/ukbd.c +++ b/sys/dev/usb/ukbd.c @@ -163,7 +163,7 @@ USB_ATTACH(ukbd) sc->sc_dev = self; sw = kbd_get_switch(DRIVER_NAME); if (sw == NULL) - USB_ATTACH_ERROR_RETURN; + return ENXIO; id = usbd_get_interface_descriptor(iface); @@ -171,19 +171,19 @@ USB_ATTACH(ukbd) arg[1] = (void *)ukbd_intr; kbd = NULL; if ((*sw->probe)(unit, (void *)arg, 0)) - USB_ATTACH_ERROR_RETURN; + return ENXIO; if ((*sw->init)(unit, &kbd, (void *)arg, 0)) - USB_ATTACH_ERROR_RETURN; + return ENXIO; (*sw->enable)(kbd); #ifdef KBD_INSTALL_CDEV if (kbd_attach(kbd)) - USB_ATTACH_ERROR_RETURN; + return ENXIO; #endif if (bootverbose) (*sw->diag)(kbd, bootverbose); - USB_ATTACH_SUCCESS_RETURN; + return 0; } int diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 8bbc421..dc39028 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -209,7 +209,7 @@ USB_ATTACH(ulpt) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } iend = (usb_interface_descriptor_t *) ((char *)cdesc + UGETW(cdesc->wTotalLength)); @@ -242,7 +242,7 @@ USB_ATTACH(ulpt) printf("%s: setting alternate interface failed\n", device_get_nameunit(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } } @@ -256,7 +256,7 @@ USB_ATTACH(ulpt) if (ed == NULL) { printf("%s: couldn't get ep %d\n", device_get_nameunit(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -270,7 +270,7 @@ USB_ATTACH(ulpt) printf("%s: could not find bulk out endpoint\n", device_get_nameunit(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (usbd_get_quirks(dev)->uq_flags & UQ_BROKEN_BIDIR) { @@ -332,7 +332,7 @@ USB_ATTACH(ulpt) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return 0; } diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 2645f63..4c2b9b2 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -995,7 +995,7 @@ USB_ATTACH(umass) "Alt Interface %d\n", device_get_nameunit(sc->sc_dev), 1)); umass_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } } @@ -1015,7 +1015,7 @@ USB_ATTACH(umass) if (!ed) { printf("%s: could not read endpoint descriptor\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { @@ -1044,7 +1044,7 @@ USB_ATTACH(umass) device_get_nameunit(sc->sc_dev), sc->bulkin, sc->bulkout, sc->intrin)); umass_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* Open the bulk-in and -out pipe */ @@ -1054,7 +1054,7 @@ USB_ATTACH(umass) DPRINTF(UDMASS_USB, ("%s: cannot open %d-out pipe (bulk)\n", device_get_nameunit(sc->sc_dev), sc->bulkout)); umass_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } err = usbd_open_pipe(sc->iface, sc->bulkin, USBD_EXCLUSIVE_USE, &sc->bulkin_pipe); @@ -1062,7 +1062,7 @@ USB_ATTACH(umass) DPRINTF(UDMASS_USB, ("%s: could not open %d-in pipe (bulk)\n", device_get_nameunit(sc->sc_dev), sc->bulkin)); umass_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* Open the intr-in pipe if the protocol is CBI with CCI. * Note: early versions of the Zip drive do have an interrupt pipe, but @@ -1082,7 +1082,7 @@ USB_ATTACH(umass) DPRINTF(UDMASS_USB, ("%s: couldn't open %d-in (intr)\n", device_get_nameunit(sc->sc_dev), sc->intrin)); umass_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } } @@ -1096,7 +1096,7 @@ USB_ATTACH(umass) DPRINTF(UDMASS_USB, ("%s: Out of memory\n", device_get_nameunit(sc->sc_dev))); umass_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } } @@ -1155,14 +1155,14 @@ USB_ATTACH(umass) err = umass_cam_attach_sim(sc); if (err) { umass_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* scan the new sim */ err = umass_cam_attach(sc); if (err) { umass_cam_detach_sim(sc); umass_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } } else { panic("%s:%d: Unknown proto 0x%02x", @@ -1172,7 +1172,7 @@ USB_ATTACH(umass) sc->transfer_state = TSTATE_IDLE; DPRINTF(UDMASS_GEN, ("%s: Attach finished\n", device_get_nameunit(sc->sc_dev))); - USB_ATTACH_SUCCESS_RETURN; + return 0; } USB_DETACH(umass) diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c index 39080af..23ebe4d 100644 --- a/sys/dev/usb/umct.c +++ b/sys/dev/usb/umct.c @@ -267,10 +267,10 @@ USB_ATTACH(umct) ucom->sc_callback = &umct_callback; ucom_attach(ucom); TASK_INIT(&sc->sc_task, 0, umct_notify, sc); - USB_ATTACH_SUCCESS_RETURN; + return 0; error: - USB_ATTACH_ERROR_RETURN; + return ENXIO; } USB_DETACH(umct) diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 23fbbef..7eb50aa 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -406,11 +406,11 @@ USB_ATTACH(umodem) TASK_INIT(&sc->sc_task, 0, umodem_notify, sc); ucom_attach(&sc->sc_ucom); - USB_ATTACH_SUCCESS_RETURN; + return 0; bad: ucom->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } static int diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index ab2d36f..fad6c54 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -208,7 +208,7 @@ USB_ATTACH(ums) if (!ed) { printf("%s: could not read endpoint descriptor\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } DPRINTFN(10,("ums_attach: bLength=%d bDescriptorType=%d " @@ -224,33 +224,33 @@ USB_ATTACH(ums) UE_GET_XFERTYPE(ed->bmAttributes) != UE_INTERRUPT) { printf("%s: unexpected endpoint\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } err = usbd_read_report_desc(uaa->iface, &desc, &size, M_TEMP); if (err) - USB_ATTACH_ERROR_RETURN; + return ENXIO; if (!hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), hid_input, &sc->sc_loc_x, &flags)) { printf("%s: mouse has no X report\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) { printf("%s: X report 0x%04x not supported\n", device_get_nameunit(sc->sc_dev), flags); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (!hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), hid_input, &sc->sc_loc_y, &flags)) { printf("%s: mouse has no Y report\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) { printf("%s: Y report 0x%04x not supported\n", device_get_nameunit(sc->sc_dev), flags); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* try to guess the Z activator: first check Z, then WHEEL */ @@ -288,7 +288,7 @@ USB_ATTACH(ums) M_USBDEV, M_NOWAIT); if (!sc->sc_loc_btn) { printf("%s: no memory\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } printf("%s: %d buttons%s%s.\n", device_get_nameunit(sc->sc_dev), @@ -304,7 +304,7 @@ USB_ATTACH(ums) if (!sc->sc_ibuf) { printf("%s: no memory\n", device_get_nameunit(sc->sc_dev)); free(sc->sc_loc_btn, M_USB); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->sc_ep_addr = ed->bEndpointAddress; @@ -364,7 +364,7 @@ USB_ATTACH(ums) sc->flags |= UMS_SPUR_BUT_UP; } - USB_ATTACH_SUCCESS_RETURN; + return 0; } diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index 8a07c51..178af5e 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -538,10 +538,10 @@ USB_ATTACH(uplcom) TASK_INIT(&sc->sc_task, 0, uplcom_notify, sc); ucom_attach(&sc->sc_ucom); - USB_ATTACH_SUCCESS_RETURN; + return 0; error: - USB_ATTACH_ERROR_RETURN; + return ENXIO; } USB_DETACH(uplcom) diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 0e09e6a..6594c6a 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -262,11 +262,11 @@ USB_ATTACH(urio) DPRINTFN(10, ("urio_attach: %p\n", sc->sc_udev)); - USB_ATTACH_SUCCESS_RETURN; + return 0; nobulk: printf("%s: could not find %s\n", device_get_nameunit(sc->sc_dev),ermsg); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index cc073aa..0033e79 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -253,7 +253,7 @@ USB_ATTACH(usb) default: printf(", not supported\n"); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } printf("\n"); @@ -272,7 +272,7 @@ USB_ATTACH(usb) if (sc->sc_bus->soft == NULL) { printf("%s: can't register softintr\n", device_get_nameunit(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } #else usb_callout_init(sc->sc_bus->softi); @@ -287,7 +287,7 @@ USB_ATTACH(usb) sc->sc_dying = 1; printf("%s: root device is not a hub\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->sc_bus->root_hub = dev; #if 1 @@ -336,7 +336,7 @@ USB_ATTACH(usb) } #endif - USB_ATTACH_SUCCESS_RETURN; + return 0; } static const char *taskq_names[] = USB_TASKQ_NAMES; diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 1a514e2..a221450 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -148,10 +148,6 @@ __CONCAT(dname,_attach)(device_t self) struct __CONCAT(dname,_softc) *sc = device_get_softc(self); \ struct usb_attach_arg *uaa = device_get_ivars(self) -/* Returns from attach */ -#define USB_ATTACH_ERROR_RETURN return ENXIO -#define USB_ATTACH_SUCCESS_RETURN return 0 - #define USB_DETACH(dname) \ static int \ __CONCAT(dname,_detach)(device_t self) diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 033fd97..e521b89 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -327,7 +327,7 @@ USB_ATTACH(uscanner) if (err) { printf("%s: setting config no failed\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* XXX We only check the first interface */ @@ -337,7 +337,7 @@ USB_ATTACH(uscanner) if (err || id == 0) { printf("%s: could not get interface descriptor, err=%d,id=%p\n", device_get_nameunit(sc->sc_dev), err, id); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* Find the two first bulk endpoints */ @@ -346,7 +346,7 @@ USB_ATTACH(uscanner) if (ed == 0) { printf("%s: could not read endpoint descriptor\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN @@ -365,7 +365,7 @@ USB_ATTACH(uscanner) if (ed_bulkin == NULL || ed_bulkout == NULL) { printf("%s: bulk-in and/or bulk-out endpoint not found\n", device_get_nameunit(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } sc->sc_bulkin = ed_bulkin->bEndpointAddress; @@ -380,7 +380,7 @@ USB_ATTACH(uscanner) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return 0; } int diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index 841fad1..595cf9a 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -367,12 +367,12 @@ USB_ATTACH(uvisor) DPRINTF(("uvisor: in=0x%x out=0x%x\n", ucom->sc_bulkin_no, ucom->sc_bulkout_no)); ucom_attach(&sc->sc_ucom); - USB_ATTACH_SUCCESS_RETURN; + return 0; bad: DPRINTF(("uvisor_attach: ATTACH ERROR\n")); ucom->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } #if 0 diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index bba2a3b..a09c644 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -428,11 +428,11 @@ USB_ATTACH(uvscom) TASK_INIT(&sc->sc_task, 0, uvscom_notify, sc); ucom_attach(&sc->sc_ucom); - USB_ATTACH_SUCCESS_RETURN; + return 0; error: ucom->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return ENXIO; } USB_DETACH(uvscom) diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index 7727ef8..e50d25e 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -750,11 +750,11 @@ USB_ATTACH(ubt) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return 0; bad: ubt_detach(self); - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* USB_ATTACH(ubt) */ /* diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index a9cd67b..8a907e8 100644 --- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -207,11 +207,10 @@ USB_ATTACH(ubtbcmfw) UID_ROOT, GID_OPERATOR, 0644, "%s.%d", USBDEVNAME(sc->sc_dev), UBTBCMFW_BULK_OUT); - USB_ATTACH_SUCCESS_RETURN; + return 0; bad: ubtbcmfw_detach(self); - - USB_ATTACH_ERROR_RETURN; + return ENXIO; } /* @@ -556,4 +555,3 @@ ubtbcmfw_poll(struct cdev *dev, int events, usb_proc_ptr p) return (revents); } - |