diff options
Diffstat (limited to 'sys/dev')
53 files changed, 771 insertions, 745 deletions
diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index 8e8a014be42..857e27189e6 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.80 2007/04/10 17:47:55 miod Exp $ */ +/* $OpenBSD: if_atu.c,v 1.81 2007/05/27 04:00:24 jsg Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. @@ -1091,9 +1091,10 @@ atu_get_card_config(struct atu_softc *sc) /* * Probe for an AT76c503 chip. */ -USB_MATCH(atu) +int +atu_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(atu, uaa); + struct usb_attach_arg *uaa = aux; int i; if (!uaa->iface) @@ -1234,9 +1235,11 @@ atu_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) * Attach the interface. Allocate softc structures, do * setup and ethernet/BPF attach. */ -USB_ATTACH(atu) +void +atu_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(atu, sc, uaa); + struct atu_softc *sc = (struct atu_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; usbd_status err; usbd_device_handle dev = uaa->device; @@ -1246,22 +1249,21 @@ USB_ATTACH(atu) sc->sc_state = ATU_S_UNCONFIG; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s", USBDEVNAME(sc->atu_dev), devinfop); + printf("\n%s: %s", USBDEVNAME(sc->atu_dev), 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)); - USB_ATTACH_ERROR_RETURN; + 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)); - USB_ATTACH_ERROR_RETURN; + return; } sc->atu_unit = self->dv_unit; @@ -1308,7 +1310,7 @@ USB_ATTACH(atu) * so we don't want to do any more configuration after this * point. */ - USB_ATTACH_SUCCESS_RETURN; + return; } uaa->iface = sc->atu_iface; @@ -1335,7 +1337,7 @@ USB_ATTACH(atu) " been downloaded\n", USBDEVNAME(sc->atu_dev))); atu_complete_attach(sc); - USB_ATTACH_SUCCESS_RETURN; + return; } } @@ -1352,8 +1354,6 @@ USB_ATTACH(atu) /* all the firmwares are in place, so complete the attach */ atu_complete_attach(sc); } - - USB_ATTACH_SUCCESS_RETURN; } void @@ -1477,9 +1477,10 @@ atu_complete_attach(struct atu_softc *sc) sc->sc_state = ATU_S_OK; } -USB_DETACH(atu) +int +atu_detach(struct device *self, int flags) { - USB_DETACH_START(atu, sc); + 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), diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 3e09c62d676..e8b6ebb501b 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.54 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_aue.c,v 1.55 2007/05/27 04:00:24 jsg Exp $ */ /* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -698,9 +698,10 @@ aue_reset(struct aue_softc *sc) /* * Probe for a Pegasus chip. */ -USB_MATCH(aue) +int +aue_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(aue, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -713,9 +714,11 @@ USB_MATCH(aue) * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. */ -USB_ATTACH(aue) +void +aue_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(aue, sc, uaa); + struct aue_softc *sc = (struct aue_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; int s; u_char eaddr[ETHER_ADDR_LEN]; @@ -731,15 +734,14 @@ USB_ATTACH(aue) DPRINTFN(5,(" : aue_attach: sc=%p", sc)); devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->aue_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->aue_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } usb_init_task(&sc->aue_tick_task, aue_tick_task, sc); @@ -750,7 +752,7 @@ USB_ATTACH(aue) if (err) { printf("%s: getting interface handle failed\n", USBDEVNAME(sc->aue_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->aue_flags = aue_lookup(uaa->vendor, uaa->product)->aue_flags; @@ -768,7 +770,7 @@ USB_ATTACH(aue) if (ed == NULL) { printf("%s: couldn't get endpoint descriptor %d\n", USBDEVNAME(sc->aue_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -785,7 +787,7 @@ USB_ATTACH(aue) 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)); - USB_ATTACH_ERROR_RETURN; + return; } @@ -847,13 +849,12 @@ USB_ATTACH(aue) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->aue_udev, USBDEV(sc->aue_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(aue) +int +aue_detach(struct device *self, int flags) { - USB_DETACH_START(aue, sc); + struct aue_softc *sc = (struct aue_softc *)self; struct ifnet *ifp = GET_IFP(sc); int s; diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 672dfce7808..0e42b72efa0 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.68 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_axe.c,v 1.69 2007/05/27 04:00:24 jsg Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org> @@ -541,9 +541,10 @@ axe_ax88772_init(struct axe_softc *sc) /* * Probe for a AX88172 chip. */ -USB_MATCH(axe) +int +axe_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(axe, uaa); + struct usb_attach_arg *uaa = aux; if (!uaa->iface) return(UMATCH_NONE); @@ -556,9 +557,11 @@ USB_MATCH(axe) * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. */ -USB_ATTACH(axe) +void +axe_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(axe, sc, uaa); + struct axe_softc *sc = (struct axe_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_status err; usb_interface_descriptor_t *id; @@ -571,7 +574,7 @@ USB_ATTACH(axe) int i, s; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; + printf("\n"); sc->axe_unit = self->dv_unit; /*device_get_unit(self);*/ @@ -580,7 +583,7 @@ USB_ATTACH(axe) printf("axe%d: getting interface handle failed\n", sc->axe_unit); usbd_devinfo_free(devinfop); - USB_ATTACH_ERROR_RETURN; + return; } sc->axe_flags = axe_lookup(uaa->vendor, uaa->product)->axe_flags; @@ -594,7 +597,7 @@ USB_ATTACH(axe) printf("axe%d: getting interface handle failed\n", sc->axe_unit); usbd_devinfo_free(devinfop); - USB_ATTACH_ERROR_RETURN; + return; } sc->axe_udev = dev; @@ -618,7 +621,7 @@ USB_ATTACH(axe) ed = usbd_interface2endpoint_descriptor(sc->axe_iface, i); if (!ed) { printf(" couldn't get ep %d\n", i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -718,13 +721,12 @@ USB_ATTACH(axe) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->axe_udev, USBDEV(sc->axe_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(axe) +int +axe_detach(struct device *self, int flags) { - USB_DETACH_START(axe, sc); + struct axe_softc *sc = (struct axe_softc *)self; int s; struct ifnet *ifp = GET_IFP(sc); diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index 4d806bc9168..9f82100ed8b 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.25 2007/05/21 05:18:56 jsg Exp $ */ +/* $OpenBSD: if_cdce.c,v 1.26 2007/05/27 04:00:24 jsg Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> @@ -107,9 +107,10 @@ Static const struct cdce_type cdce_devs[] = { USB_DECLARE_DRIVER_CLASS(cdce, DV_IFNET); -USB_MATCH(cdce) +int +cdce_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(cdce, uaa); + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id; if (uaa->iface == NULL) @@ -129,9 +130,11 @@ USB_MATCH(cdce) return (UMATCH_NONE); } -USB_ATTACH(cdce) +void +cdce_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(cdce, sc, uaa); + struct cdce_softc *sc = (struct cdce_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; int s; struct ifnet *ifp; @@ -146,8 +149,7 @@ USB_ATTACH(cdce) int i, j, numalts; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->cdce_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->cdce_dev), devinfop); usbd_devinfo_free(devinfop); sc->cdce_udev = uaa->device; @@ -165,7 +167,7 @@ USB_ATTACH(cdce) if (ud == NULL) { printf("%s: no union descriptor\n", USBDEVNAME(sc->cdce_dev)); - USB_ATTACH_ERROR_RETURN; + return; } data_ifcno = ud->bSlaveInterface[0]; @@ -184,7 +186,7 @@ USB_ATTACH(cdce) if (sc->cdce_data_iface == NULL) { printf("%s: no data interface\n", USBDEVNAME(sc->cdce_dev)); - USB_ATTACH_ERROR_RETURN; + return; } /* Find endpoints. */ @@ -196,7 +198,7 @@ USB_ATTACH(cdce) if (usbd_set_interface(sc->cdce_data_iface, j)) { printf("%s: setting alternate interface failed\n", USBDEVNAME(sc->cdce_dev)); - USB_ATTACH_ERROR_RETURN; + return; } id = usbd_get_interface_descriptor(sc->cdce_data_iface); sc->cdce_bulkin_no = sc->cdce_bulkout_no = -1; @@ -205,7 +207,7 @@ USB_ATTACH(cdce) if (!ed) { printf("%s: could not read endpoint descriptor\n", USBDEVNAME(sc->cdce_dev)); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -228,12 +230,12 @@ USB_ATTACH(cdce) if (sc->cdce_bulkin_no == -1) { printf("%s: could not find data bulk in\n", USBDEVNAME(sc->cdce_dev)); - USB_ATTACH_ERROR_RETURN; + return; } if (sc->cdce_bulkout_no == -1 ) { printf("%s: could not find data bulk out\n", USBDEVNAME(sc->cdce_dev)); - USB_ATTACH_ERROR_RETURN; + return; } s = splnet(); @@ -264,15 +266,14 @@ USB_ATTACH(cdce) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->cdce_udev, USBDEV(sc->cdce_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(cdce) +int +cdce_detach(struct device *self, int flags) { - USB_DETACH_START(cdce, sc); - struct ifnet *ifp = GET_IFP(sc); - int s; + struct cdce_softc *sc = (struct cdce_softc *)self; + struct ifnet *ifp = GET_IFP(sc); + int s; s = splusb(); diff --git a/sys/dev/usb/if_cdcef.c b/sys/dev/usb/if_cdcef.c index 06e930e059d..85c912f9537 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.12 2007/05/21 05:18:56 jsg Exp $ */ +/* $OpenBSD: if_cdcef.c,v 1.13 2007/05/27 04:00:24 jsg Exp $ */ /* * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org> @@ -129,12 +129,14 @@ struct usbf_function_methods cdcef_methods = { * USB function match/attach/detach */ -USB_MATCH(cdcef) +int +cdcef_match(struct device *parent, void *match, void *aux) { return UMATCH_GENERIC; } -USB_ATTACH(cdcef) +void +cdcef_attach(struct device *parent, struct device *self, void *aux) { struct cdcef_softc *sc = (struct cdcef_softc *)self; struct usbf_attach_arg *uaa = aux; @@ -168,14 +170,14 @@ USB_ATTACH(cdcef) err = usbf_add_config(dev, &sc->sc_config); if (err) { printf("%s: usbf_add_config failed\n", DEVNAME(sc)); - USB_ATTACH_ERROR_RETURN; + return; } err = usbf_add_interface(sc->sc_config, UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0, NULL, &sc->sc_iface); if (err) { printf("%s: usbf_add_interface failed\n", DEVNAME(sc)); - USB_ATTACH_ERROR_RETURN; + return; } /* XXX don't use hard-coded values 128 and 16. */ err = usbf_add_endpoint(sc->sc_iface, UE_DIR_IN | 2, UE_BULK, @@ -184,7 +186,7 @@ USB_ATTACH(cdcef) 64, 16, &sc->sc_ep_out); if (err) { printf("%s: usbf_add_endpoint failed\n", DEVNAME(sc)); - USB_ATTACH_ERROR_RETURN; + return; } /* Append a CDC union descriptor. */ @@ -197,7 +199,7 @@ USB_ATTACH(cdcef) (usb_descriptor_t *)&udesc, NULL); if (err) { printf("%s: usbf_add_config_desc failed\n", DEVNAME(sc)); - USB_ATTACH_ERROR_RETURN; + return; } /* @@ -206,7 +208,7 @@ USB_ATTACH(cdcef) err = usbf_end_config(sc->sc_config); if (err) { printf("%s: usbf_end_config failed\n", DEVNAME(sc)); - USB_ATTACH_ERROR_RETURN; + return; } /* Preallocate xfers and data buffers. */ @@ -218,7 +220,7 @@ USB_ATTACH(cdcef) CDCEF_BUFSZ); if (sc->sc_buffer_in == NULL || sc->sc_buffer_out == NULL) { printf("%s: usbf_alloc_buffer failed\n", DEVNAME(sc)); - USB_ATTACH_ERROR_RETURN; + return; } /* Open the bulk pipes. */ @@ -228,7 +230,7 @@ USB_ATTACH(cdcef) usbf_endpoint_address(sc->sc_ep_in), &sc->sc_pipe_in); if (err) { printf("%s: usbf_open_pipe failed\n", DEVNAME(sc)); - USB_ATTACH_ERROR_RETURN; + return; } /* Get ready to receive packets. */ @@ -237,7 +239,7 @@ USB_ATTACH(cdcef) err = usbf_transfer(sc->sc_xfer_out); if (err && err != USBF_IN_PROGRESS) { printf("%s: usbf_transfer failed\n", DEVNAME(sc)); - USB_ATTACH_ERROR_RETURN; + return; } s = splnet(); @@ -265,8 +267,6 @@ USB_ATTACH(cdcef) sc->sc_attached = 1; splx(s); - - USB_ATTACH_SUCCESS_RETURN; } usbf_status diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 190a9f11eb8..561670f7907 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.34 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_cue.c,v 1.35 2007/05/27 04:00:24 jsg Exp $ */ /* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -432,9 +432,10 @@ cue_reset(struct cue_softc *sc) /* * Probe for a CATC chip. */ -USB_MATCH(cue) +int +cue_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(cue, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -447,9 +448,11 @@ USB_MATCH(cue) * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. */ -USB_ATTACH(cue) +void +cue_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(cue, sc, uaa); + struct cue_softc *sc = (struct cue_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; int s; u_char eaddr[ETHER_ADDR_LEN]; @@ -464,15 +467,14 @@ USB_ATTACH(cue) DPRINTFN(5,(" : cue_attach: sc=%p, dev=%p", sc, dev)); devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->cue_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->cue_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } sc->cue_udev = dev; @@ -486,7 +488,7 @@ USB_ATTACH(cue) if (err) { printf("%s: getting interface handle failed\n", USBDEVNAME(sc->cue_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->cue_iface = iface; @@ -498,7 +500,7 @@ USB_ATTACH(cue) if (ed == NULL) { printf("%s: couldn't get ep %d\n", USBDEVNAME(sc->cue_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -555,13 +557,12 @@ USB_ATTACH(cue) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->cue_udev, USBDEV(sc->cue_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(cue) +int +cue_detach(struct device *self, int flags) { - USB_DETACH_START(cue, sc); + struct cue_softc *sc = (struct cue_softc *)self; struct ifnet *ifp = GET_IFP(sc); int s; diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 4e02638d5ee..01c446e88f9 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.46 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_kue.c,v 1.47 2007/05/27 04:00:24 jsg Exp $ */ /* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -400,9 +400,10 @@ kue_reset(struct kue_softc *sc) /* * Probe for a KLSI chip. */ -USB_MATCH(kue) +int +kue_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(kue, uaa); + struct usb_attach_arg *uaa = aux; DPRINTFN(25,("kue_match: enter\n")); @@ -430,14 +431,14 @@ kue_attachhook(void *xsc) if (kue_load_fw(sc)) { printf("%s: loading firmware failed\n", USBDEVNAME(sc->kue_dev)); - USB_ATTACH_ERROR_RETURN; + return; } err = usbd_device2interface_handle(dev, KUE_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", USBDEVNAME(sc->kue_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->kue_iface = iface; @@ -449,7 +450,7 @@ kue_attachhook(void *xsc) if (ed == NULL) { printf("%s: couldn't get ep %d\n", USBDEVNAME(sc->kue_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -465,7 +466,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)); - USB_ATTACH_ERROR_RETURN; + return; } /* Read ethernet descriptor */ @@ -474,7 +475,7 @@ kue_attachhook(void *xsc) if (err) { printf("%s: could not read Ethernet descriptor\n", USBDEVNAME(sc->kue_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->kue_mcfilters = malloc(KUE_MCFILTCNT(sc) * ETHER_ADDR_LEN, @@ -482,7 +483,7 @@ kue_attachhook(void *xsc) if (sc->kue_mcfilters == NULL) { printf("%s: no memory for multicast filter buffer\n", USBDEVNAME(sc->kue_dev)); - USB_ATTACH_ERROR_RETURN; + return; } s = splnet(); @@ -522,9 +523,11 @@ kue_attachhook(void *xsc) * Attach the interface. Allocate softc structures, do * setup and ethernet/BPF attach. */ -USB_ATTACH(kue) +void +kue_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(kue, sc, uaa); + struct kue_softc *sc = (struct kue_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; usbd_device_handle dev = uaa->device; usbd_status err; @@ -532,15 +535,14 @@ USB_ATTACH(kue) DPRINTFN(5,(" : kue_attach: sc=%p, dev=%p", sc, dev)); devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->kue_dev), devinfop); + printf("/n%s: %s\n", USBDEVNAME(sc->kue_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } sc->kue_udev = dev; @@ -554,13 +556,12 @@ USB_ATTACH(kue) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->kue_udev, USBDEV(sc->kue_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(kue) +int +kue_detach(struct device *self, int flags) { - USB_DETACH_START(kue, sc); + struct kue_softc *sc = (struct kue_softc *)self; struct ifnet *ifp = GET_IFP(sc); int s; diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index 40b7fd9dc42..782f00f7fe7 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.91 2007/05/21 06:10:43 jsg Exp $ */ +/* $OpenBSD: if_ral.c,v 1.92 2007/05/27 04:00:24 jsg Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -198,9 +198,10 @@ static const uint32_t ural_rf2526_r2[] = RAL_RF2526_R2; USB_DECLARE_DRIVER_CLASS(ural, DV_IFNET); -USB_MATCH(ural) +int +ural_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(ural, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -209,9 +210,11 @@ USB_MATCH(ural) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -USB_ATTACH(ural) +void +ural_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ural, sc, uaa); + struct ural_softc *sc = (struct ural_softc *)self; + struct usb_attach_arg *uaa = aux; struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; usb_interface_descriptor_t *id; @@ -223,14 +226,13 @@ USB_ATTACH(ural) sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } /* get the first interface handle */ @@ -239,7 +241,7 @@ USB_ATTACH(ural) if (error != 0) { printf("%s: could not get interface handle\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } /* @@ -253,7 +255,7 @@ USB_ATTACH(ural) if (ed == NULL) { printf("%s: no endpoint descriptor for iface %d\n", USBDEVNAME(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -265,7 +267,7 @@ USB_ATTACH(ural) } if (sc->sc_rx_no == -1 || sc->sc_tx_no == -1) { printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } usb_init_task(&sc->sc_task, ural_task, sc); @@ -345,13 +347,12 @@ USB_ATTACH(ural) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(ural) +int +ural_detach(struct device *self, int flags) { - USB_DETACH_START(ural, sc); + struct ural_softc *sc = (struct ural_softc *)self; struct ifnet *ifp = &sc->sc_ic.ic_if; int s; diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index c15595738f1..90832819911 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.56 2007/05/21 06:10:43 jsg Exp $ */ +/* $OpenBSD: if_rum.c,v 1.57 2007/05/27 04:00:24 jsg Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr> @@ -219,9 +219,10 @@ static const struct rfprog { USB_DECLARE_DRIVER_CLASS(rum, DV_IFNET); -USB_MATCH(rum) +int +rum_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(rum, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -253,9 +254,11 @@ rum_attachhook(void *xsc) free(ucode, M_DEVBUF); } -USB_ATTACH(rum) +void +rum_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(rum, sc, uaa); + struct rum_softc *sc = (struct rum_softc *)self; + struct usb_attach_arg *uaa = aux; struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; usb_interface_descriptor_t *id; @@ -268,14 +271,13 @@ USB_ATTACH(rum) sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } /* get the first interface handle */ @@ -284,7 +286,7 @@ USB_ATTACH(rum) if (error != 0) { printf("%s: could not get interface handle\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } /* @@ -298,7 +300,7 @@ USB_ATTACH(rum) if (ed == NULL) { printf("%s: no endpoint descriptor for iface %d\n", USBDEVNAME(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -310,7 +312,7 @@ USB_ATTACH(rum) } if (sc->sc_rx_no == -1 || sc->sc_tx_no == -1) { printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } usb_init_task(&sc->sc_task, rum_task, sc); @@ -329,7 +331,7 @@ USB_ATTACH(rum) if (ntries == 1000) { printf("%s: timeout waiting for chip to settle\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } /* retrieve MAC address and various other things from EEPROM */ @@ -432,13 +434,12 @@ USB_ATTACH(rum) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(rum) +int +rum_detach(struct device *self, int flags) { - USB_DETACH_START(rum, sc); + struct rum_softc *sc = (struct rum_softc *)self; struct ifnet *ifp = &sc->sc_ic.ic_if; int s; diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index 4258aa11874..b0ef6373406 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.18 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_uath.c,v 1.19 2007/05/27 04:00:24 jsg Exp $ */ /*- * Copyright (c) 2006 @@ -196,9 +196,10 @@ Static int uath_activate(device_ptr_t, enum devact); USB_DECLARE_DRIVER(uath); -USB_MATCH(uath) +int +uath_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uath, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -240,9 +241,11 @@ uath_attachhook(void *xsc) } } -USB_ATTACH(uath) +void +uath_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uath, sc, uaa); + struct uath_softc *sc = (struct uath_softc *)self; + struct usb_attach_arg *uaa = aux; struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; usbd_status error; @@ -254,8 +257,7 @@ USB_ATTACH(uath) sc->sc_port = uaa->port; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); sc->sc_flags = uath_lookup(uaa->vendor, uaa->product)->flags; @@ -263,7 +265,7 @@ USB_ATTACH(uath) 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)); - USB_ATTACH_ERROR_RETURN; + return; } /* get the first interface handle */ @@ -272,7 +274,7 @@ USB_ATTACH(uath) if (error != 0) { printf("%s: could not get interface handle\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } /* @@ -281,7 +283,7 @@ USB_ATTACH(uath) */ if (uath_open_pipes(sc) != 0) { printf("%s: could not open pipes\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } if (sc->sc_flags & UATH_FLAG_PRE_FIRMWARE) { @@ -289,7 +291,7 @@ USB_ATTACH(uath) mountroothook_establish(uath_attachhook, sc); else uath_attachhook(sc); - USB_ATTACH_SUCCESS_RETURN; + return; } /* @@ -418,19 +420,18 @@ USB_ATTACH(uath) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return; fail4: uath_free_tx_data_list(sc); fail3: uath_free_rx_cmd_list(sc); fail2: uath_free_tx_cmd_list(sc); fail1: uath_close_pipes(sc); - - USB_ATTACH_ERROR_RETURN; } -USB_DETACH(uath) +int +uath_detach(struct device *self, int flags) { - USB_DETACH_START(uath, sc); + struct uath_softc *sc = (struct uath_softc *)self; struct ifnet *ifp = &sc->sc_ic.ic_if; int s; diff --git a/sys/dev/usb/if_ubt.c b/sys/dev/usb/if_ubt.c index d5b96d5debb..6179a1b850c 100644 --- a/sys/dev/usb/if_ubt.c +++ b/sys/dev/usb/if_ubt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ubt.c,v 1.10 2007/05/23 01:32:25 ray Exp $ */ +/* $OpenBSD: if_ubt.c,v 1.11 2007/05/27 04:00:24 jsg Exp $ */ /* * ng_ubt.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ubt.c,v 1.10 2007/05/23 01:32:25 ray Exp $ + * $Id: if_ubt.c,v 1.11 2007/05/27 04:00:24 jsg Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c,v 1.20 2004/10/12 23:33:46 emax Exp $ */ @@ -100,7 +100,8 @@ Static int ubt_if_ioctl(struct ifnet *, u_long, caddr_t); Static int ubt_if_init(struct ifnet *); Static void ubt_if_watchdog(struct ifnet *); -USB_MATCH(ubt) +int +ubt_match(struct device *parent, void *match, void *aux) { #ifdef notyet /* @@ -129,8 +130,7 @@ USB_MATCH(ubt) { USB_VENDOR_MSI, USB_PRODUCT_MSI_BLUETOOTH_2 } }; - USB_MATCH_START(ubt, uaa); - + struct usb_attach_arg *uaa = aux; usb_device_descriptor_t *dd = usbd_get_device_descriptor(uaa->device); if (uaa->iface == NULL) @@ -151,9 +151,11 @@ USB_MATCH(ubt) return (UMATCH_NONE); } -USB_ATTACH(ubt) +void +ubt_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ubt, sc, uaa); + struct ubt_softc *sc = (struct ubt_softc *)self; + struct usb_attach_arg *uaa = aux; usb_config_descriptor_t *cd = NULL; usb_interface_descriptor_t *id = NULL; usb_endpoint_descriptor_t *ed = NULL; @@ -167,8 +169,7 @@ USB_ATTACH(ubt) sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); /* @@ -636,17 +637,17 @@ USB_ATTACH(ubt) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return; bad: #if 0 ubt_detach(self); #endif - USB_ATTACH_ERROR_RETURN; } -USB_DETACH(ubt) +int +ubt_detach(struct device *self, int flags) { - USB_DETACH_START(ubt, sc); + struct ubt_softc *sc = (struct ubt_softc *)self; struct ifnet *ifp = &sc->sc_if; /* Close pipes */ diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index 2b3e50cd865..a70d6626bb5 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.24 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_udav.c,v 1.25 2007/05/27 04:00:25 jsg 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 $ */ /* @@ -156,9 +156,10 @@ static const struct udav_type { /* Probe */ -USB_MATCH(udav) +int +udav_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(udav, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -168,9 +169,11 @@ USB_MATCH(udav) } /* Attach */ -USB_ATTACH(udav) +void +udav_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(udav, sc, uaa); + struct udav_softc *sc = (struct udav_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; usbd_status err; @@ -184,8 +187,7 @@ USB_ATTACH(udav) int i, s; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s", devname, devinfop); + printf("\n%s: %s", devname, devinfop); usbd_devinfo_free(devinfop); /* Move the device into the configured state. */ @@ -295,17 +297,17 @@ USB_ATTACH(udav) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, dev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return; bad: sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; } /* detach */ -USB_DETACH(udav) +int +udav_detach(struct device *self, int flags) { - USB_DETACH_START(udav, sc); + struct udav_softc *sc = (struct udav_softc *)self; struct ifnet *ifp = GET_IFP(sc); int s; diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c index fd3be4c9f61..1526c6d7300 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.27 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_upl.c,v 1.28 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -208,9 +208,10 @@ Static void upl_input(struct ifnet *, struct mbuf *); /* * Probe for a Prolific chip. */ -USB_MATCH(upl) +int +upl_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(upl, uaa); + struct usb_attach_arg *uaa = aux; struct upl_type *t; if (uaa->iface != NULL) @@ -223,9 +224,11 @@ USB_MATCH(upl) return (UMATCH_NONE); } -USB_ATTACH(upl) +void +upl_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(upl, sc, uaa); + struct upl_softc *sc = (struct upl_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; int s; usbd_device_handle dev = uaa->device; @@ -239,15 +242,14 @@ USB_ATTACH(upl) DPRINTFN(5,(" : upl_attach: sc=%p, dev=%p", sc, dev)); devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_udev = dev; @@ -258,7 +260,7 @@ USB_ATTACH(upl) if (err) { printf("%s: getting interface handle failed\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_iface = iface; @@ -270,7 +272,7 @@ USB_ATTACH(upl) if (ed == NULL) { printf("%s: couldn't get ep %d\n", USBDEVNAME(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -287,7 +289,7 @@ USB_ATTACH(upl) 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)); - USB_ATTACH_ERROR_RETURN; + return; } s = splnet(); @@ -325,13 +327,12 @@ USB_ATTACH(upl) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(upl) +int +upl_detach(struct device *self, int flags) { - USB_DETACH_START(upl, sc); + struct upl_softc *sc = (struct upl_softc *)self; struct ifnet *ifp = &sc->sc_if; int s; diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index c0738c08f17..24f70d1c298 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.37 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_url.c,v 1.38 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */ /* * Copyright (c) 2001, 2002 @@ -171,9 +171,10 @@ static const struct url_type { /* Probe */ -USB_MATCH(url) +int +url_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(url, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -182,9 +183,11 @@ USB_MATCH(url) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } /* Attach */ -USB_ATTACH(url) +void +url_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(url, sc, uaa); + struct url_softc *sc = (struct url_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; usbd_status err; @@ -198,8 +201,7 @@ USB_ATTACH(url) int i, s; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfop); + printf("\n%s: %s\n", devname, devinfop); usbd_devinfo_free(devinfop); /* Move the device into the configured state. */ @@ -322,17 +324,17 @@ USB_ATTACH(url) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, dev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return; bad: sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; } /* detach */ -USB_DETACH(url) +int +url_detach(struct device *self, int flags) { - USB_DETACH_START(url, sc); + struct url_softc *sc = (struct url_softc *)self; struct ifnet *ifp = GET_IFP(sc); int s; diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c index b6a32f5ab86..62d8aad68cc 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.35 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: if_wi_usb.c,v 1.36 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2003 Dale Rahn. All rights reserved. @@ -264,9 +264,10 @@ const struct wi_usb_type { USB_DECLARE_DRIVER_CLASS(wi_usb, DV_IFNET); -USB_MATCH(wi_usb) +int +wi_usb_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(wi_usb, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -280,9 +281,11 @@ USB_MATCH(wi_usb) * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. */ -USB_ATTACH(wi_usb) +void +wi_usb_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(wi_usb, sc, uaa); + struct wi_usb_softc *sc = (struct wi_usb_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; /* int s; */ usbd_device_handle dev = uaa->device; @@ -298,12 +301,11 @@ USB_ATTACH(wi_usb) if (err) { printf("%s: setting config no failed\n", USBDEVNAME(sc->wi_usb_dev)); - USB_ATTACH_ERROR_RETURN; + return; } devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->wi_usb_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->wi_usb_dev), devinfop); usbd_devinfo_free(devinfop); /* XXX - any tasks? */ @@ -312,7 +314,7 @@ USB_ATTACH(wi_usb) if (err) { printf("%s: getting interface handle failed\n", USBDEVNAME(sc->wi_usb_dev)); - USB_ATTACH_ERROR_RETURN; + return; } /* XXX - flags? */ @@ -337,7 +339,7 @@ USB_ATTACH(wi_usb) if (ed == NULL) { printf("%s: couldn't get endpoint descriptor %d\n", USBDEVNAME(sc->wi_usb_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -358,18 +360,18 @@ USB_ATTACH(wi_usb) if (wi_usb_rx_list_init(sc)) { printf("%s: rx list init failed\n", USBDEVNAME(sc->wi_usb_dev)); - USB_ATTACH_ERROR_RETURN; + return; } if (wi_usb_tx_list_init(sc)) { printf("%s: tx list init failed\n", USBDEVNAME(sc->wi_usb_dev)); - USB_ATTACH_ERROR_RETURN; + return; } if (wi_usb_open_pipes(sc)){ printf("%s: open pipes failed\n", USBDEVNAME(sc->wi_usb_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->wi_usb_attached = 1; @@ -378,14 +380,12 @@ USB_ATTACH(wi_usb) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->wi_usb_udev, USBDEV(sc->wi_usb_dev)); - - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(wi_usb) +int +wi_usb_detach(struct device *self, int flags) { - USB_DETACH_START(wi_usb, sc); + struct wi_usb_softc *sc = (struct wi_usb_softc *)self; struct ifnet *ifp = WI_GET_IFP(sc); struct wi_softc *wsc = &sc->sc_wi; int s; diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 4c05a6d2df1..fe9d03c3117 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.52 2007/02/11 00:08:04 jsg Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.53 2007/05/27 04:00:25 jsg Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -218,9 +218,10 @@ void zyd_amrr_timeout(void *); void zyd_newassoc(struct ieee80211com *, struct ieee80211_node *, int); -USB_MATCH(zyd) +int +zyd_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(zyd, uaa); + struct usb_attach_arg *uaa = aux; if (!uaa->iface) return UMATCH_NONE; @@ -258,17 +259,18 @@ zyd_attachhook(void *xsc) sc->attached = 1; } -USB_ATTACH(zyd) +void +zyd_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(zyd, sc, uaa); + struct zyd_softc *sc = (struct zyd_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; usb_device_descriptor_t* ddesc; sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); sc->mac_rev = zyd_lookup(uaa->vendor, uaa->product)->rev; @@ -278,15 +280,13 @@ USB_ATTACH(zyd) printf("%s: device version mismatch: 0x%x " "(only >= 43.30 supported)\n", USBDEVNAME(sc->sc_dev), UGETW(ddesc->bcdDevice)); - USB_ATTACH_ERROR_RETURN; + return; } if (rootvp == NULL) mountroothook_establish(zyd_attachhook, sc); else zyd_attachhook(sc); - - USB_ATTACH_SUCCESS_RETURN; } int @@ -407,9 +407,10 @@ zyd_complete_attach(struct zyd_softc *sc) fail: return error; } -USB_DETACH(zyd) +int +zyd_detach(struct device *self, int flags) { - USB_DETACH_START(zyd, sc); + struct zyd_softc *sc = (struct zyd_softc *)self; struct ifnet *ifp = &sc->sc_ic.ic_if; int s; diff --git a/sys/dev/usb/moscom.c b/sys/dev/usb/moscom.c index 3226693688b..65655d57b47 100644 --- a/sys/dev/usb/moscom.c +++ b/sys/dev/usb/moscom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: moscom.c,v 1.2 2006/10/26 06:02:43 jsg Exp $ */ +/* $OpenBSD: moscom.c,v 1.3 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -168,9 +168,10 @@ static const struct usb_devno moscom_devs[] = { USB_DECLARE_DRIVER(moscom); -USB_MATCH(moscom) +int +moscom_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(moscom, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -179,9 +180,11 @@ USB_MATCH(moscom) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -USB_ATTACH(moscom) +void +moscom_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(moscom, sc, uaa); + struct moscom_softc *sc = (struct moscom_softc *)self; + struct usb_attach_arg *uaa = aux; struct ucom_attach_args uca; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; @@ -192,15 +195,14 @@ USB_ATTACH(moscom) bzero(&uca, sizeof(uca)); sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the first interface handle */ @@ -210,7 +212,7 @@ USB_ATTACH(moscom) printf("%s: could not get interface handle\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } id = usbd_get_interface_descriptor(sc->sc_iface); @@ -222,7 +224,7 @@ USB_ATTACH(moscom) printf("%s: no endpoint descriptor found for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -236,7 +238,7 @@ USB_ATTACH(moscom) if (uca.bulkin == -1 || uca.bulkout == -1) { printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } uca.ibufsize = MOSCOMBUFSZ; @@ -253,13 +255,12 @@ USB_ATTACH(moscom) USBDEV(sc->sc_dev)); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(moscom) +int +moscom_detach(struct device *self, int flags) { - USB_DETACH_START(moscom, sc); + struct moscom_softc *sc = (struct moscom_softc *)self; int rv = 0; sc->sc_dying = 1; diff --git a/sys/dev/usb/uark.c b/sys/dev/usb/uark.c index c6c9d0aed69..cbe02d4b550 100644 --- a/sys/dev/usb/uark.c +++ b/sys/dev/usb/uark.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uark.c,v 1.2 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: uark.c,v 1.3 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -95,9 +95,10 @@ static const struct usb_devno uark_devs[] = { USB_DECLARE_DRIVER(uark); -USB_MATCH(uark) +int +uark_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uark, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -106,9 +107,11 @@ USB_MATCH(uark) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -USB_ATTACH(uark) +void +uark_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uark, sc, uaa); + struct uark_softc *sc = (struct uark_softc *)self; + struct usb_attach_arg *uaa = aux; struct ucom_attach_args uca; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; @@ -119,15 +122,14 @@ USB_ATTACH(uark) bzero(&uca, sizeof(uca)); sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the first interface handle */ @@ -137,7 +139,7 @@ USB_ATTACH(uark) printf("%s: could not get interface handle\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } id = usbd_get_interface_descriptor(sc->sc_iface); @@ -149,7 +151,7 @@ USB_ATTACH(uark) printf("%s: no endpoint descriptor found for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -163,7 +165,7 @@ USB_ATTACH(uark) if (uca.bulkin == -1 || uca.bulkout == -1) { printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } uca.ibufsize = UARKBUFSZ; @@ -180,13 +182,12 @@ USB_ATTACH(uark) USBDEV(sc->sc_dev)); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(uark) +int +uark_detach(struct device *self, int flags) { - USB_DETACH_START(uark, sc); + struct uark_softc *sc = (struct uark_softc *)self; int rv = 0; sc->sc_dying = 1; diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index 8d9be07fe19..daaa4ade912 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uaudio.c,v 1.38 2007/05/21 05:40:27 jsg Exp $ */ +/* $OpenBSD: uaudio.c,v 1.39 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */ /* @@ -363,9 +363,10 @@ Static struct audio_device uaudio_device = { USB_DECLARE_DRIVER(uaudio); -USB_MATCH(uaudio) +int +uaudio_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uaudio, uaa); + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id; if (uaa->iface == NULL) @@ -382,9 +383,11 @@ USB_MATCH(uaudio) return (UMATCH_IFACECLASS_IFACESUBCLASS); } -USB_ATTACH(uaudio) +void +uaudio_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uaudio, sc, uaa); + struct uaudio_softc *sc = (struct uaudio_softc *)self; + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id; usb_config_descriptor_t *cdesc; char *devinfop; @@ -401,14 +404,14 @@ USB_ATTACH(uaudio) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } err = uaudio_identify(sc, cdesc); if (err) { printf("%s: audio descriptors make no sense, error=%d\n", USBDEVNAME(sc->sc_dev), err); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_ac_ifaceh = uaa->iface; @@ -435,7 +438,7 @@ USB_ATTACH(uaudio) if (sc->sc_alts[j].ifaceh == NULL) { printf("%s: alt %d missing AS interface(s)\n", USBDEVNAME(sc->sc_dev), j); - USB_ATTACH_ERROR_RETURN; + return; } } @@ -461,8 +464,6 @@ USB_ATTACH(uaudio) DPRINTF(("uaudio_attach: doing audio_attach_mi\n")); sc->sc_audiodev = audio_attach_mi(&uaudio_hw_if, sc, &sc->sc_dev); - - USB_ATTACH_SUCCESS_RETURN; } /* diff --git a/sys/dev/usb/uberry.c b/sys/dev/usb/uberry.c index df155a3fe61..f6a3616c6b9 100644 --- a/sys/dev/usb/uberry.c +++ b/sys/dev/usb/uberry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uberry.c,v 1.3 2007/04/26 17:00:28 miod Exp $ */ +/* $OpenBSD: uberry.c,v 1.4 2007/05/27 04:00:25 jsg Exp $ */ /*- * Copyright (c) 2006 Theo de Raadt <deraadt@openbsd.org> @@ -51,9 +51,10 @@ Static struct usb_devno const uberry_devices[] = { USB_DECLARE_DRIVER(uberry); -USB_MATCH(uberry) +int +uberry_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uberry, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -62,35 +63,35 @@ USB_MATCH(uberry) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -USB_ATTACH(uberry) +void +uberry_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uberry, sc, uaa); + struct uberry_softc *sc = (struct uberry_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } printf("%s: Charging enabled\n", USBDEVNAME(sc->sc_dev)); usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(uberry) +int +uberry_detach(struct device *self, int flags) { - USB_DETACH_START(uberry, sc); + struct uberry_softc *sc = (struct uberry_softc *)self; usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, USBDEV(sc->sc_dev)); diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index cbc98a8160c..7a7cc7df043 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsa.c,v 1.21 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: ubsa.c,v 1.22 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: ubsa.c,v 1.5 2002/11/25 00:51:33 fvdl Exp $ */ /*- * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. @@ -248,9 +248,10 @@ Static const struct usb_devno ubsa_devs[] = { USB_DECLARE_DRIVER(ubsa); -USB_MATCH(ubsa) +int +ubsa_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(ubsa, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -259,9 +260,11 @@ USB_MATCH(ubsa) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(ubsa) +void +ubsa_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ubsa, sc, uaa); + struct ubsa_softc *sc = (struct ubsa_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usb_config_descriptor_t *cdesc; usb_interface_descriptor_t *id; @@ -273,8 +276,7 @@ USB_ATTACH(ubsa) int i; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfop); + printf("\n%s: %s\n", devname, devinfop); usbd_devinfo_free(devinfop); sc->sc_udev = dev; @@ -387,15 +389,14 @@ USB_ATTACH(ubsa) sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - USB_ATTACH_SUCCESS_RETURN; - error: - USB_ATTACH_ERROR_RETURN; + return; } -USB_DETACH(ubsa) +int +ubsa_detach(struct device *self, int flags) { - USB_DETACH_START(ubsa, sc); + struct ubsa_softc *sc = (struct ubsa_softc *)self; int rv = 0; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 6fee0fe07de..24b76b0dd8f 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.33 2007/05/20 00:52:26 jsg Exp $ */ +/* $OpenBSD: ucom.c,v 1.34 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -165,12 +165,14 @@ ucom_unlock(struct ucom_softc *sc) usb_detach_wakeup(USBDEV(sc->sc_dev)); } -USB_MATCH(ucom) +int +ucom_match(struct device *parent, void *match, void *aux) { return (1); } -USB_ATTACH(ucom) +void +ucom_attach(struct device *parent, struct device *self, void *aux) { struct ucom_softc *sc = (struct ucom_softc *)self; struct ucom_attach_args *uca = aux; @@ -202,11 +204,10 @@ USB_ATTACH(ucom) rw_init(&sc->sc_lock, "ucomlk"); sc->sc_open = 0; - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(ucom) +int +ucom_detach(struct device *self, int flags) { struct ucom_softc *sc = (struct ucom_softc *)self; struct tty *tp = sc->sc_tty; diff --git a/sys/dev/usb/ucycom.c b/sys/dev/usb/ucycom.c index 742ecb9fbd8..52c0aa4a811 100644 --- a/sys/dev/usb/ucycom.c +++ b/sys/dev/usb/ucycom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucycom.c,v 1.5 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: ucycom.c,v 1.6 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: ucycom.c,v 1.3 2005/08/05 07:27:47 skrll Exp $ */ /* @@ -167,7 +167,8 @@ Static const struct usb_devno ucycom_devs[] = { USB_DECLARE_DRIVER(ucycom); -USB_MATCH(ucycom) +int +ucycom_match(struct device *parent, void *match, void *aux) { struct uhidev_attach_arg *uha = aux; @@ -176,9 +177,11 @@ USB_MATCH(ucycom) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(ucycom) +void +ucycom_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ucycom, sc, uaa); + struct ucycom_softc *sc = (struct ucycom_softc *)self; + struct usb_attach_arg *uaa = aux; struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)uaa; usbd_device_handle dev = uha->parent->sc_udev; struct ucom_attach_args uca; @@ -233,8 +236,6 @@ USB_ATTACH(ucycom) sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); DPRINTF(("ucycom_attach: complete %p\n", sc->sc_subdev)); - - USB_ATTACH_SUCCESS_RETURN; } void diff --git a/sys/dev/usb/udcf.c b/sys/dev/usb/udcf.c index f94bf0106c3..b738635fd74 100644 --- a/sys/dev/usb/udcf.c +++ b/sys/dev/usb/udcf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udcf.c,v 1.32 2007/04/21 20:17:04 art Exp $ */ +/* $OpenBSD: udcf.c,v 1.33 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> @@ -135,9 +135,10 @@ void udcf_ct_probe(void *); USB_DECLARE_DRIVER(udcf); -USB_MATCH(udcf) +int +udcf_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(udcf, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -147,9 +148,11 @@ USB_MATCH(udcf) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -USB_ATTACH(udcf) +void +udcf_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(udcf, sc, uaa); + struct udcf_softc *sc = (struct udcf_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; struct timeval t; @@ -173,8 +176,7 @@ USB_ATTACH(udcf) } devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); id = usbd_get_interface_descriptor(iface); @@ -302,15 +304,15 @@ USB_ATTACH(udcf) timeout_add(&sc->sc_sl_to, t_wait + t_sl); DPRINTF(("synchronizing\n")); - USB_ATTACH_SUCCESS_RETURN; + return; fishy: DPRINTF(("udcf_attach failed\n")); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; } -USB_DETACH(udcf) +int +udcf_detach(struct device *self, int flags) { struct udcf_softc *sc = (struct udcf_softc *)self; diff --git a/sys/dev/usb/udsbr.c b/sys/dev/usb/udsbr.c index 6ee684abeff..92ac2bc6e5c 100644 --- a/sys/dev/usb/udsbr.c +++ b/sys/dev/usb/udsbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udsbr.c,v 1.10 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: udsbr.c,v 1.11 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: udsbr.c,v 1.7 2002/07/11 21:14:27 augustss Exp $ */ /* @@ -103,9 +103,10 @@ Static int udsbr_status(struct udsbr_softc *sc); USB_DECLARE_DRIVER(udsbr); -USB_MATCH(udsbr) +int +udsbr_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(udsbr, uaa); + struct usb_attach_arg *uaa = aux; DPRINTFN(50,("udsbr_match\n")); @@ -118,9 +119,11 @@ USB_MATCH(udsbr) return (UMATCH_VENDOR_PRODUCT); } -USB_ATTACH(udsbr) +void +udsbr_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(udsbr, sc, uaa); + struct udsbr_softc *sc = (struct udsbr_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; char *devinfop; usbd_status err; @@ -128,15 +131,14 @@ USB_ATTACH(udsbr) DPRINTFN(10,("udsbr_attach: sc=%p\n", sc)); devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_udev = dev; @@ -147,13 +149,12 @@ USB_ATTACH(udsbr) USBDEV(sc->sc_dev)); sc->sc_child = radio_attach_mi(&udsbr_hw_if, sc, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(udsbr) +int +udsbr_detach(struct device *self, int flags) { - USB_DETACH_START(udsbr, sc); + struct udsbr_softc *sc = (struct udsbr_softc *)self; int rv = 0; if (sc->sc_child != NULL) diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c index 4065be2414f..4a06d5dbc9c 100644 --- a/sys/dev/usb/ueagle.c +++ b/sys/dev/usb/ueagle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ueagle.c,v 1.13 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: ueagle.c,v 1.14 2007/05/27 04:00:25 jsg Exp $ */ /*- * Copyright (c) 2003-2006 @@ -127,9 +127,10 @@ Static void ueagle_stop(struct ifnet *, int); USB_DECLARE_DRIVER(ueagle); -USB_MATCH(ueagle) +int +ueagle_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(ueagle, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -154,15 +155,17 @@ ueagle_attachhook(void *xsc) } } -USB_ATTACH(ueagle) +void +ueagle_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ueagle, sc, uaa); + struct ueagle_softc *sc = (struct ueagle_softc *)self; + struct usb_attach_arg *uaa = aux; struct ifnet *ifp = &sc->sc_if; char *devinfop; uint8_t addr[ETHER_ADDR_LEN]; sc->sc_udev = uaa->device; - USB_ATTACH_SETUP; + printf("\n"); /* * Pre-firmware modems must be flashed and reset first. They will @@ -177,7 +180,7 @@ USB_ATTACH(ueagle) ueagle_attachhook(sc); /* processing of pre-firmware modems ends here */ - USB_ATTACH_SUCCESS_RETURN; + return; } devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); @@ -187,13 +190,13 @@ USB_ATTACH(ueagle) 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)); - USB_ATTACH_ERROR_RETURN; + return; } if (ueagle_getesi(sc, addr) != 0) { printf("%s: could not read end system identifier\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } printf("%s: address: %02x:%02x:%02x:%02x:%02x:%02x\n", @@ -222,13 +225,12 @@ USB_ATTACH(ueagle) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(ueagle) +int +ueagle_detach(struct device *self, int flags) { - USB_DETACH_START(ueagle, sc); + struct ueagle_softc *sc = (struct ueagle_softc *)self; struct ifnet *ifp = &sc->sc_if; if (sc->fw != NULL) diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index bd2a2ca3abd..ebb1e7f78db 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uftdi.c,v 1.33 2007/03/03 12:40:31 deraadt Exp $ */ +/* $OpenBSD: uftdi.c,v 1.34 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: uftdi.c,v 1.14 2003/02/23 04:20:07 simonb Exp $ */ /* @@ -126,9 +126,10 @@ struct ucom_methods uftdi_methods = { USB_DECLARE_DRIVER(uftdi); -USB_MATCH(uftdi) +int +uftdi_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uftdi, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) { if (uaa->vendor == USB_VENDOR_FTDI && @@ -184,9 +185,11 @@ USB_MATCH(uftdi) return (UMATCH_NONE); } -USB_ATTACH(uftdi) +void +uftdi_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uftdi, sc, uaa); + struct uftdi_softc *sc = (struct uftdi_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; usb_interface_descriptor_t *id; @@ -218,8 +221,7 @@ USB_ATTACH(uftdi) iface = uaa->iface; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfop); + printf("\n%s: %s\n", devname, devinfop); usbd_devinfo_free(devinfop); id = usbd_get_interface_descriptor(iface); @@ -370,12 +372,11 @@ USB_ATTACH(uftdi) DPRINTF(("uftdi: in=0x%x out=0x%x\n", uca.bulkin, uca.bulkout)); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - USB_ATTACH_SUCCESS_RETURN; + return; bad: DPRINTF(("uftdi_attach: ATTACH ERROR\n")); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; } int diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 11ff6f9eb01..420ff9089c8 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.37 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: ugen.c,v 1.38 2007/05/27 04:00:25 jsg 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 $ */ @@ -182,9 +182,10 @@ Static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx); USB_DECLARE_DRIVER(ugen); -USB_MATCH(ugen) +int +ugen_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(ugen, uaa); + struct usb_attach_arg *uaa = aux; #if 0 if (uaa->matchlvl) @@ -207,17 +208,18 @@ USB_MATCH(ugen) return (UMATCH_NONE); } -USB_ATTACH(ugen) +void +ugen_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ugen, sc, uaa); + struct ugen_softc *sc = (struct ugen_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle udev; char *devinfop; usbd_status err; int conf; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); sc->sc_udev = udev = uaa->device; @@ -228,7 +230,7 @@ USB_ATTACH(ugen) printf("%s: setting configuration index 0 failed\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } conf = usbd_get_config_descriptor(udev)->bConfigurationValue; @@ -238,7 +240,7 @@ USB_ATTACH(ugen) printf("%s: setting configuration %d failed\n", USBDEVNAME(sc->sc_dev), conf); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } #ifdef __FreeBSD__ @@ -253,8 +255,6 @@ USB_ATTACH(ugen) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } Static int @@ -799,9 +799,10 @@ ugen_activate(device_ptr_t self, enum devact act) } #endif -USB_DETACH(ugen) +int +ugen_detach(struct device *self, int flags) { - USB_DETACH_START(ugen, sc); + struct ugen_softc *sc = (struct ugen_softc *)self; struct ugen_endpoint *sce; int i, dir; int s; diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index b6ca1c84696..7118c4307ca 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhid.c,v 1.31 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: uhid.c,v 1.32 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -125,9 +125,10 @@ Static int uhid_do_ioctl(struct uhid_softc*, u_long, caddr_t, int, USB_DECLARE_DRIVER(uhid); -USB_MATCH(uhid) +int +uhid_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uhid, uaa); + struct usb_attach_arg *uaa = aux; struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)uaa; DPRINTF(("uhid_match: report=%d\n", uha->reportid)); @@ -137,9 +138,11 @@ USB_MATCH(uhid) return (UMATCH_IFACECLASS_GENERIC); } -USB_ATTACH(uhid) +void +uhid_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uhid, sc, uaa); + struct uhid_softc *sc = (struct uhid_softc *)self; + struct usb_attach_arg *uaa = aux; struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)uaa; int size, repid; void *desc; @@ -156,8 +159,6 @@ USB_ATTACH(uhid) printf(": input=%d, output=%d, feature=%d\n", sc->sc_isize, sc->sc_osize, sc->sc_fsize); - - USB_ATTACH_SUCCESS_RETURN; } int @@ -176,9 +177,10 @@ uhid_activate(device_ptr_t self, enum devact act) return (0); } -USB_DETACH(uhid) +int +uhid_detach(struct device *self, int flags) { - USB_DETACH_START(uhid, sc); + struct uhid_softc *sc = (struct uhid_softc *)self; int s; int maj, mn; diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 8e809827891..2f62fad3e92 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.c,v 1.20 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: uhidev.c,v 1.21 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -86,9 +86,10 @@ Static int uhidevsubmatch(struct device *parent, void *cf, void *aux); USB_DECLARE_DRIVER(uhidev); -USB_MATCH(uhidev) +int +uhidev_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uhidev, uaa); + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id; if (uaa->iface == NULL) @@ -116,9 +117,11 @@ USB_MATCH(uhidev) return (UMATCH_IFACECLASS_GENERIC); } -USB_ATTACH(uhidev) +void +uhidev_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uhidev, sc, uaa); + struct uhidev_softc *sc = (struct uhidev_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_interface_handle iface = uaa->iface; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; @@ -137,8 +140,7 @@ USB_ATTACH(uhidev) id = usbd_get_interface_descriptor(iface); devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), + printf("\n%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), devinfop, id->bInterfaceClass, id->bInterfaceSubClass); usbd_devinfo_free(devinfop); @@ -158,7 +160,7 @@ USB_ATTACH(uhidev) printf("%s: could not read endpoint descriptor\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } DPRINTFN(10,("uhidev_attach: bLength=%d bDescriptorType=%d " @@ -179,7 +181,7 @@ USB_ATTACH(uhidev) } else { printf("%s: unexpected endpoint\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } } @@ -190,7 +192,7 @@ USB_ATTACH(uhidev) if (sc->sc_iep_addr == -1) { printf("%s: no input interrupt endpoint\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* XXX need to extend this */ @@ -232,7 +234,7 @@ USB_ATTACH(uhidev) if (err) { printf("%s: no report descriptor\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_repdesc = desc; @@ -241,7 +243,7 @@ USB_ATTACH(uhidev) uha.uaa = uaa; nrepid = uhidev_maxrepid(desc, size); if (nrepid < 0) - USB_ATTACH_SUCCESS_RETURN; + return; if (nrepid > 0) printf("%s: %d report ids\n", USBDEVNAME(sc->sc_dev), nrepid); nrepid++; @@ -249,7 +251,7 @@ USB_ATTACH(uhidev) M_USBDEV, M_NOWAIT); if (sc->sc_subdevs == NULL) { printf("%s: no memory\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } bzero(sc->sc_subdevs, nrepid * sizeof(device_ptr_t)); sc->sc_nrepid = nrepid; @@ -290,14 +292,12 @@ USB_ATTACH(uhidev) if (dev->sc_intr == NULL) { printf("%s: sc_intr == NULL\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } #endif } } } - - USB_ATTACH_SUCCESS_RETURN; } int @@ -370,9 +370,10 @@ uhidev_activate(device_ptr_t self, enum devact act) return (rv); } -USB_DETACH(uhidev) +int +uhidev_detach(struct device *self, int flags) { - USB_DETACH_START(uhidev, sc); + struct uhidev_softc *sc = (struct uhidev_softc *)self; int i, rv; DPRINTF(("uhidev_detach: sc=%p flags=%d\n", sc, flags)); diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 6f86f8fa028..4009617f2bf 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhub.c,v 1.38 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: uhub.c,v 1.39 2007/05/27 04:00:25 jsg 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 $ */ @@ -134,9 +134,10 @@ Static driver_t uhubroot_driver = { }; #endif -USB_MATCH(uhub) +int +uhub_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uhub, uaa); + struct usb_attach_arg *uaa = aux; usb_device_descriptor_t *dd = usbd_get_device_descriptor(uaa->device); DPRINTFN(5,("uhub_match, dd=%p\n", dd)); @@ -149,9 +150,11 @@ USB_MATCH(uhub) return (UMATCH_NONE); } -USB_ATTACH(uhub) +void +uhub_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uhub, sc, uaa); + struct uhub_softc *sc = (struct uhub_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; char *devinfop; usbd_status err; @@ -167,21 +170,20 @@ USB_ATTACH(uhub) sc->sc_hub = dev; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); err = usbd_set_config_index(dev, 0, 1); if (err) { DPRINTF(("%s: configuration failed, error=%s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err))); - USB_ATTACH_ERROR_RETURN; + 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); - USB_ATTACH_ERROR_RETURN; + return; } /* Get hub descriptor. */ @@ -200,7 +202,7 @@ USB_ATTACH(uhub) if (err) { DPRINTF(("%s: getting hub descriptor failed, error=%s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err))); - USB_ATTACH_ERROR_RETURN; + return; } for (nremov = 0, port = 1; port <= nports; port++) @@ -225,7 +227,7 @@ USB_ATTACH(uhub) hub = malloc(sizeof(*hub) + (nports-1) * sizeof(struct usbd_port), M_USBDEV, M_NOWAIT); if (hub == NULL) - USB_ATTACH_ERROR_RETURN; + return; dev->hub = hub; dev->hub->hubsoftc = sc; hub->explore = uhub_explore; @@ -348,13 +350,12 @@ USB_ATTACH(uhub) sc->sc_running = 1; - USB_ATTACH_SUCCESS_RETURN; + return; bad: if (hub) free(hub, M_USBDEV); dev->hub = NULL; - USB_ATTACH_ERROR_RETURN; } usbd_status @@ -562,9 +563,10 @@ uhub_activate(device_ptr_t self, enum devact act) * Called from process context when the hub is gone. * Detach all devices on active ports. */ -USB_DETACH(uhub) +int +uhub_detach(struct device *self, int flags) { - USB_DETACH_START(uhub, sc); + struct uhub_softc *sc = (struct uhub_softc *)self; struct usbd_hub *hub = sc->sc_hub->hub; struct usbd_port *rup; int port, nports; diff --git a/sys/dev/usb/uipaq.c b/sys/dev/usb/uipaq.c index 478bf2b91a7..6ac9ee84588 100644 --- a/sys/dev/usb/uipaq.c +++ b/sys/dev/usb/uipaq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipaq.c,v 1.4 2006/06/23 06:27:11 miod Exp $ */ +/* $OpenBSD: uipaq.c,v 1.5 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -132,9 +132,10 @@ static const struct uipaq_type uipaq_devs[] = { USB_DECLARE_DRIVER(uipaq); -USB_MATCH(uipaq) +int +uipaq_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uipaq, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -146,9 +147,11 @@ USB_MATCH(uipaq) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(uipaq) +void +uipaq_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uipaq, sc, uaa); + struct uipaq_softc *sc = (struct uipaq_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; usb_interface_descriptor_t *id; @@ -177,8 +180,7 @@ USB_ATTACH(uipaq) } devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfop); + printf("\n%s: %s\n", devname, devinfop); usbd_devinfo_free(devinfop); sc->sc_flags = uipaq_lookup(uaa->vendor, uaa->product)->uv_flags; @@ -232,12 +234,11 @@ USB_ATTACH(uipaq) printf("%s: no proper endpoints found (%d,%d) \n", devname, uca.bulkin, uca.bulkout); - USB_ATTACH_SUCCESS_RETURN; + return; bad: DPRINTF(("uipaq_attach: ATTACH ERROR\n")); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; } diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c index ce3085c2102..1da423f23fd 100644 --- a/sys/dev/usb/ukbd.c +++ b/sys/dev/usb/ukbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ukbd.c,v 1.28 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: ukbd.c,v 1.29 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -334,9 +334,10 @@ struct wskbd_mapdata ukbd_keymapdata = { USB_DECLARE_DRIVER(ukbd); -USB_MATCH(ukbd) +int +ukbd_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(ukbd, uaa); + struct usb_attach_arg *uaa = aux; struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)uaa; int size; void *desc; @@ -349,9 +350,11 @@ USB_MATCH(ukbd) return (UMATCH_IFACECLASS); } -USB_ATTACH(ukbd) +void +ukbd_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ukbd, sc, uaa); + struct ukbd_softc *sc = (struct ukbd_softc *)self; + struct usb_attach_arg *uaa = aux; struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)uaa; usb_hid_descriptor_t *hid; u_int32_t qflags; @@ -367,7 +370,7 @@ USB_ATTACH(ukbd) if (parseerr != NULL) { printf("\n%s: attach failed, %s\n", sc->sc_hdev.sc_dev.dv_xname, parseerr); - USB_ATTACH_ERROR_RETURN; + return; } hid = usbd_get_hid_descriptor(uha->uaa->iface); @@ -448,8 +451,6 @@ USB_ATTACH(ukbd) ukbd_set_leds(sc, 0); sc->sc_wskbddev = config_found(self, &a, wskbddevprint); - - USB_ATTACH_SUCCESS_RETURN; } int @@ -496,9 +497,10 @@ ukbd_activate(device_ptr_t self, enum devact act) return (rv); } -USB_DETACH(ukbd) +int +ukbd_detach(struct device *self, int flags) { - USB_DETACH_START(ukbd, sc); + struct ukbd_softc *sc = (struct ukbd_softc *)self; int rv = 0; DPRINTF(("ukbd_detach: sc=%p flags=%d\n", sc, flags)); diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 2f0e24854d1..fc9a630cdc2 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ulpt.c,v 1.22 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: ulpt.c,v 1.23 2007/05/27 04:00:25 jsg 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 $ */ @@ -179,9 +179,10 @@ void ieee1284_print_id(char *); USB_DECLARE_DRIVER(ulpt); -USB_MATCH(ulpt) +int +ulpt_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(ulpt, uaa); + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id; DPRINTFN(10,("ulpt_match\n")); @@ -198,9 +199,11 @@ USB_MATCH(ulpt) return (UMATCH_NONE); } -USB_ATTACH(ulpt) +void +ulpt_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ulpt, sc, uaa); + struct ulpt_softc *sc = (struct ulpt_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_interface_handle iface = uaa->iface; usb_interface_descriptor_t *ifcd = usbd_get_interface_descriptor(iface); @@ -215,8 +218,7 @@ USB_ATTACH(ulpt) DPRINTFN(10,("ulpt_attach: sc=%p\n", sc)); devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), + printf("\n%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev), devinfop, ifcd->bInterfaceClass, ifcd->bInterfaceSubClass); usbd_devinfo_free(devinfop); @@ -227,7 +229,7 @@ USB_ATTACH(ulpt) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } iend = (usb_interface_descriptor_t *) ((char *)cdesc + UGETW(cdesc->wTotalLength)); @@ -260,7 +262,7 @@ USB_ATTACH(ulpt) printf("%s: setting alternate interface failed\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } } @@ -274,7 +276,7 @@ USB_ATTACH(ulpt) if (ed == NULL) { printf("%s: couldn't get ep %d\n", USBDEVNAME(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -288,7 +290,7 @@ USB_ATTACH(ulpt) printf("%s: could not find bulk out endpoint\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (usbd_get_quirks(dev)->uq_flags & UQ_BROKEN_BIDIR) { @@ -351,8 +353,6 @@ USB_ATTACH(ulpt) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -373,9 +373,10 @@ ulpt_activate(device_ptr_t self, enum devact act) } #endif -USB_DETACH(ulpt) +int +ulpt_detach(struct device *self, int flags) { - USB_DETACH_START(ulpt, sc); + struct ulpt_softc *sc = (struct ulpt_softc *)self; int s; #if defined(__NetBSD__) || defined(__OpenBSD__) int maj, mn; diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 4e54c5e84c8..1da92cde56c 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass.c,v 1.44 2006/06/23 06:27:11 miod Exp $ */ +/* $OpenBSD: umass.c,v 1.45 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: umass.c,v 1.116 2004/06/30 05:53:46 mycroft Exp $ */ /* @@ -255,9 +255,10 @@ Static void umass_dump_buffer(struct umass_softc *sc, u_int8_t *buffer, * USB device probe/attach/detach */ -USB_MATCH(umass) +int +umass_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(umass, uaa); + struct usb_attach_arg *uaa = aux; const struct umass_quirk *quirk; usb_interface_descriptor_t *id; @@ -297,9 +298,11 @@ USB_MATCH(umass) return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO); } -USB_ATTACH(umass) +void +umass_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(umass, sc, uaa); + struct umass_softc *sc = (struct umass_softc *)self; + struct usb_attach_arg *uaa = aux; const struct umass_quirk *quirk; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; @@ -309,8 +312,7 @@ USB_ATTACH(umass) int i, bno, error; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); sc->sc_udev = uaa->device; @@ -335,7 +337,7 @@ USB_ATTACH(umass) id = usbd_get_interface_descriptor(sc->sc_iface); if (id == NULL) - USB_ATTACH_ERROR_RETURN; + return; if (sc->sc_wire == UMASS_WPROTO_UNSPEC) { switch (id->bInterfaceProtocol) { @@ -354,7 +356,7 @@ USB_ATTACH(umass) ("%s: Unsupported wire protocol %u\n", USBDEVNAME(sc->sc_dev), id->bInterfaceProtocol)); - USB_ATTACH_ERROR_RETURN; + return; } } @@ -379,7 +381,7 @@ USB_ATTACH(umass) ("%s: Unsupported command protocol %u\n", USBDEVNAME(sc->sc_dev), id->bInterfaceSubClass)); - USB_ATTACH_ERROR_RETURN; + return; } } @@ -426,7 +428,7 @@ USB_ATTACH(umass) err = (*quirk->uq_init)(sc); if (err) { umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } } @@ -446,7 +448,7 @@ USB_ATTACH(umass) if (ed == NULL) { printf("%s: could not read endpoint descriptor\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { @@ -476,7 +478,7 @@ USB_ATTACH(umass) USBDEVNAME(sc->sc_dev), sc->sc_epaddr[UMASS_BULKIN], sc->sc_epaddr[UMASS_BULKOUT], sc->sc_epaddr[UMASS_INTRIN])); - USB_ATTACH_ERROR_RETURN; + return; } /* @@ -487,7 +489,7 @@ USB_ATTACH(umass) if (err) { printf("%s: unable to get Max Lun: %s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err)); - USB_ATTACH_ERROR_RETURN; + return; } } else { sc->maxlun = 0; @@ -504,7 +506,7 @@ USB_ATTACH(umass) DPRINTF(UDMASS_USB, ("%s: cannot open %u-out pipe (bulk)\n", USBDEVNAME(sc->sc_dev), sc->sc_epaddr[UMASS_BULKOUT])); umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } DPRINTF(UDMASS_USB, ("%s: opening iface %p epaddr %d for BULKIN\n", USBDEVNAME(sc->sc_dev), sc->sc_iface, @@ -515,7 +517,7 @@ USB_ATTACH(umass) DPRINTF(UDMASS_USB, ("%s: could not open %u-in pipe (bulk)\n", USBDEVNAME(sc->sc_dev), sc->sc_epaddr[UMASS_BULKIN])); umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } /* * Open the intr-in pipe if the protocol is CBI with CCI. @@ -540,7 +542,7 @@ USB_ATTACH(umass) USBDEVNAME(sc->sc_dev), sc->sc_epaddr[UMASS_INTRIN])); umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } } @@ -554,7 +556,7 @@ USB_ATTACH(umass) DPRINTF(UDMASS_USB, ("%s: Out of memory\n", USBDEVNAME(sc->sc_dev))); umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } } /* Allocate buffer for data transfer (it's huge). */ @@ -572,7 +574,7 @@ USB_ATTACH(umass) UMASS_MAX_TRANSFER_SIZE); if (sc->data_buffer == NULL) { umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } break; default: @@ -590,7 +592,7 @@ USB_ATTACH(umass) break; default: umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } error = 0; @@ -626,25 +628,24 @@ USB_ATTACH(umass) printf("%s: command protocol=0x%x not supported\n", USBDEVNAME(sc->sc_dev), sc->sc_cmd); umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } if (error) { printf("%s: bus attach failed\n", USBDEVNAME(sc->sc_dev)); umass_disco(sc); - USB_ATTACH_ERROR_RETURN; + return; } usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); DPRINTF(UDMASS_GEN, ("%s: Attach finished\n", USBDEVNAME(sc->sc_dev))); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(umass) +int +umass_detach(struct device *self, int flags) { - USB_DETACH_START(umass, sc); + struct umass_softc *sc = (struct umass_softc *)self; struct umassbus_softc *scbus; int rv = 0, i, s; diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c index 76dd051052c..1b229266558 100644 --- a/sys/dev/usb/umct.c +++ b/sys/dev/usb/umct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umct.c,v 1.18 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: umct.c,v 1.19 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: umct.c,v 1.10 2003/02/23 04:20:07 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -158,9 +158,10 @@ static const struct usb_devno umct_devs[] = { USB_DECLARE_DRIVER(umct); -USB_MATCH(umct) +int +umct_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(umct, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -169,9 +170,11 @@ USB_MATCH(umct) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(umct) +void +umct_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(umct, sc, uaa); + struct umct_softc *sc = (struct umct_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usb_config_descriptor_t *cdesc; usb_interface_descriptor_t *id; @@ -184,8 +187,7 @@ USB_ATTACH(umct) struct ucom_attach_args uca; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfop); + printf("\n%s: %s\n", devname, devinfop); usbd_devinfo_free(devinfop); sc->sc_udev = dev; @@ -204,7 +206,7 @@ USB_ATTACH(umct) printf("\n%s: failed to set configuration, err=%s\n", devname, usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the config descriptor */ @@ -214,7 +216,7 @@ USB_ATTACH(umct) printf("%s: failed to get configuration descriptor\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the interface */ @@ -224,7 +226,7 @@ USB_ATTACH(umct) printf("\n%s: failed to get interface, err=%s\n", devname, usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* Find the bulk{in,out} and interrupt endpoints */ @@ -238,7 +240,7 @@ USB_ATTACH(umct) printf("%s: no endpoint descriptor for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* @@ -264,21 +266,21 @@ USB_ATTACH(umct) printf("%s: Could not find data bulk in\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (sc->sc_intr_number== -1) { printf("%s: Could not find interrupt in\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_dtr = sc->sc_rts = 0; @@ -305,13 +307,12 @@ USB_ATTACH(umct) DPRINTF(("umct: in=0x%x out=0x%x intr=0x%x\n", uca.bulkin, uca.bulkout, sc->sc_intr_number )); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(umct) +int +umct_detach(struct device *self, int flags) { - USB_DETACH_START(umct, sc); + struct umct_softc *sc = (struct umct_softc *)self; int rv = 0; DPRINTF(("umct_detach: sc=%p flags=%d\n", sc, flags)); diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c index 9cd12b5c240..92102230676 100644 --- a/sys/dev/usb/umidi.c +++ b/sys/dev/usb/umidi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umidi.c,v 1.17 2007/05/05 16:31:27 krw Exp $ */ +/* $OpenBSD: umidi.c,v 1.18 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -138,9 +138,10 @@ struct midi_hw_if umidi_hw_if = { USB_DECLARE_DRIVER(umidi); -USB_MATCH(umidi) +int +umidi_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(umidi, uaa); + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id; DPRINTFN(1,("umidi_match\n")); @@ -160,10 +161,12 @@ USB_MATCH(umidi) return UMATCH_NONE; } -USB_ATTACH(umidi) +void +umidi_attach(struct device *parent, struct device *self, void *aux) { usbd_status err; - USB_ATTACH_START(umidi, sc, uaa); + struct umidi_softc *sc = (struct umidi_softc *)self; + struct usb_attach_arg *uaa = aux; char *devinfop; int i; @@ -219,11 +222,10 @@ USB_ATTACH(umidi) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - USB_ATTACH_SUCCESS_RETURN; + return; error: printf("%s: disabled.\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; } int @@ -244,9 +246,10 @@ umidi_activate(device_ptr_t self, enum devact act) return 0; } -USB_DETACH(umidi) +int +umidi_detach(struct device *self, int flags) { - USB_DETACH_START(umidi, sc); + struct umidi_softc *sc = (struct umidi_softc *)self; DPRINTFN(1,("umidi_detach\n")); diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 8b5f74953ec..f6c3025fbdb 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umodem.c,v 1.24 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: umodem.c,v 1.25 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: umodem.c,v 1.45 2002/09/23 05:51:23 simonb Exp $ */ /* @@ -152,9 +152,10 @@ Static struct ucom_methods umodem_methods = { USB_DECLARE_DRIVER(umodem); -USB_MATCH(umodem) +int +umodem_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(umodem, uaa); + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id; usb_device_descriptor_t *dd; int ret; @@ -182,9 +183,11 @@ USB_MATCH(umodem) return (ret); } -USB_ATTACH(umodem) +void +umodem_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(umodem, sc, uaa); + struct umodem_softc *sc = (struct umodem_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; @@ -201,7 +204,7 @@ USB_ATTACH(umodem) struct ucom_attach_args uca; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; + printf("\n"); sc->sc_udev = dev; sc->sc_ctl_iface = uaa->iface; @@ -368,11 +371,10 @@ USB_ATTACH(umodem) DPRINTF(("umodem_attach: sc=%p\n", sc)); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - USB_ATTACH_SUCCESS_RETURN; + return; bad: sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; } Static int @@ -729,9 +731,10 @@ umodem_activate(device_ptr_t self, enum devact act) return (rv); } -USB_DETACH(umodem) +int +umodem_detach(struct device *self, int flags) { - USB_DETACH_START(umodem, sc); + struct umodem_softc *sc = (struct umodem_softc *)self; int rv = 0; DPRINTF(("umodem_detach: sc=%p flags=%d\n", sc, flags)); diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 9457f52381f..f14d57914d1 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ums.c,v 1.19 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: ums.c,v 1.20 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -126,9 +126,10 @@ const struct wsmouse_accessops ums_accessops = { USB_DECLARE_DRIVER(ums); -USB_MATCH(ums) +int +ums_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(ums, uaa); + struct usb_attach_arg *uaa = aux; struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)uaa; int size; void *desc; @@ -141,9 +142,11 @@ USB_MATCH(ums) return (UMATCH_IFACECLASS); } -USB_ATTACH(ums) +void +ums_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(ums, sc, uaa); + struct ums_softc *sc = (struct ums_softc *)self; + struct usb_attach_arg *uaa = aux; struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)uaa; struct wsmousedev_attach_args a; int size; @@ -168,24 +171,24 @@ USB_ATTACH(ums) uha->reportid, hid_input, &sc->sc_loc_x, &flags)) { printf("\n%s: mouse has no X report\n", USBDEVNAME(sc->sc_hdev.sc_dev)); - USB_ATTACH_ERROR_RETURN; + 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); - USB_ATTACH_ERROR_RETURN; + 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)); - USB_ATTACH_ERROR_RETURN; + 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); - USB_ATTACH_ERROR_RETURN; + return; } /* Try the wheel as Z activator first */ @@ -261,8 +264,6 @@ USB_ATTACH(ums) a.accesscookie = sc; sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint); - - USB_ATTACH_SUCCESS_RETURN; } int @@ -284,9 +285,10 @@ ums_activate(device_ptr_t self, enum devact act) return (rv); } -USB_DETACH(ums) +int +ums_detach(struct device *self, int flags) { - USB_DETACH_START(ums, sc); + struct ums_softc *sc = (struct ums_softc *)self; int rv = 0; DPRINTF(("ums_detach: sc=%p flags=%d\n", sc, flags)); diff --git a/sys/dev/usb/umsm.c b/sys/dev/usb/umsm.c index 13b16f3365a..9778372eb38 100644 --- a/sys/dev/usb/umsm.c +++ b/sys/dev/usb/umsm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umsm.c,v 1.8 2007/05/13 12:17:30 fkr Exp $ */ +/* $OpenBSD: umsm.c,v 1.9 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -78,9 +78,10 @@ static const struct usb_devno umsm_devs[] = { USB_DECLARE_DRIVER(umsm); -USB_MATCH(umsm) +int +umsm_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(umsm, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -89,9 +90,11 @@ USB_MATCH(umsm) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -USB_ATTACH(umsm) +void +umsm_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(umsm, sc, uaa); + struct umsm_softc *sc = (struct umsm_softc *)self; + struct usb_attach_arg *uaa = aux; struct ucom_attach_args uca; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; @@ -102,15 +105,14 @@ USB_ATTACH(umsm) bzero(&uca, sizeof(uca)); sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the first interface handle */ @@ -120,7 +122,7 @@ USB_ATTACH(umsm) printf("%s: could not get interface handle\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } id = usbd_get_interface_descriptor(sc->sc_iface); @@ -132,7 +134,7 @@ USB_ATTACH(umsm) printf("%s: no endpoint descriptor found for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -145,7 +147,7 @@ USB_ATTACH(umsm) if (uca.bulkin == -1 || uca.bulkout == -1) { printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* We need to force size as some devices lie */ @@ -163,13 +165,12 @@ USB_ATTACH(umsm) USBDEV(sc->sc_dev)); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(umsm) +int +umsm_detach(struct device *self, int flags) { - USB_DETACH_START(umsm, sc); + struct umsm_softc *sc = (struct umsm_softc *)self; int rv = 0; sc->sc_dying = 1; diff --git a/sys/dev/usb/uow.c b/sys/dev/usb/uow.c index b9d0b7e6ce8..7773ecae8d7 100644 --- a/sys/dev/usb/uow.c +++ b/sys/dev/usb/uow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uow.c,v 1.14 2006/10/08 21:14:12 grange Exp $ */ +/* $OpenBSD: uow.c,v 1.15 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org> @@ -86,9 +86,10 @@ Static int uow_read(struct uow_softc *, void *, int); Static int uow_write(struct uow_softc *, const void *, int); Static int uow_reset(struct uow_softc *); -USB_MATCH(uow) +int +uow_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uow, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -97,9 +98,11 @@ USB_MATCH(uow) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(uow) +void +uow_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uow, sc, uaa); + struct uow_softc *sc = (struct uow_softc *)self; + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfop; @@ -111,7 +114,7 @@ USB_ATTACH(uow) sc->sc_udev = uaa->device; /* Display device info string */ - USB_ATTACH_SETUP; + printf("\n"); if ((devinfop = usbd_devinfo_alloc(uaa->device, 0)) != NULL) { printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); @@ -123,7 +126,7 @@ USB_ATTACH(uow) printf("%s: failed to set config %d: %s\n", USBDEVNAME(sc->sc_dev), DS2490_USB_CONFIG, usbd_errstr(error)); - USB_ATTACH_ERROR_RETURN; + return; } /* Get interface handle */ @@ -132,7 +135,7 @@ USB_ATTACH(uow) printf("%s: failed to get iface %d: %s\n", USBDEVNAME(sc->sc_dev), DS2490_USB_IFACE, usbd_errstr(error)); - USB_ATTACH_ERROR_RETURN; + return; } /* Find endpoints */ @@ -142,7 +145,7 @@ USB_ATTACH(uow) if (ed == NULL) { printf("%s: failed to get endpoint %d descriptor\n", USBDEVNAME(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -158,7 +161,7 @@ USB_ATTACH(uow) 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); - USB_ATTACH_ERROR_RETURN; + return; } /* Open pipes */ @@ -166,7 +169,7 @@ USB_ATTACH(uow) &sc->sc_ph_ibulk)) != 0) { printf("%s: failed to open bulk-in pipe: %s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(error)); - USB_ATTACH_ERROR_RETURN; + return; } if ((error = usbd_open_pipe(sc->sc_iface, ep_obulk, USBD_EXCLUSIVE_USE, &sc->sc_ph_obulk)) != 0) { @@ -212,7 +215,7 @@ USB_ATTACH(uow) oba.oba_bus = &sc->sc_ow_bus; sc->sc_ow_dev = config_found(self, &oba, onewirebus_print); - USB_ATTACH_SUCCESS_RETURN; + return; fail: if (sc->sc_ph_ibulk != NULL) @@ -223,12 +226,12 @@ fail: usbd_close_pipe(sc->sc_ph_intr); if (sc->sc_xfer != NULL) usbd_free_xfer(sc->sc_xfer); - USB_ATTACH_ERROR_RETURN; } -USB_DETACH(uow) +int +uow_detach(struct device *self, int flags) { - USB_DETACH_START(uow, sc); + struct uow_softc *sc = (struct uow_softc *)self; int rv = 0, s; s = splusb(); diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index f6b3f43f9b2..d8071d14d17 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uplcom.c,v 1.34 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: uplcom.c,v 1.35 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: uplcom.c,v 1.29 2002/09/23 05:51:23 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -191,9 +191,10 @@ static const struct usb_devno uplcom_devs[] = { USB_DECLARE_DRIVER(uplcom); -USB_MATCH(uplcom) +int +uplcom_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uplcom, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -202,9 +203,11 @@ USB_MATCH(uplcom) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(uplcom) +void +uplcom_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uplcom, sc, uaa); + struct uplcom_softc *sc = (struct uplcom_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usb_config_descriptor_t *cdesc; usb_device_descriptor_t *ddesc; @@ -218,8 +221,7 @@ USB_ATTACH(uplcom) struct ucom_attach_args uca; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfop); + printf("\n%s: %s\n", devname, devinfop); usbd_devinfo_free(devinfop); sc->sc_udev = dev; @@ -237,7 +239,7 @@ USB_ATTACH(uplcom) printf("\n%s: failed to set configuration, err=%s\n", devname, usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the config descriptor */ @@ -247,7 +249,7 @@ USB_ATTACH(uplcom) printf("%s: failed to get configuration descriptor\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the device descriptor */ @@ -256,7 +258,7 @@ USB_ATTACH(uplcom) printf("%s: failed to get device descriptor\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* @@ -276,7 +278,7 @@ USB_ATTACH(uplcom) printf("\n%s: failed to get interface, err=%s\n", devname, usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* Find the interrupt endpoints */ @@ -290,7 +292,7 @@ USB_ATTACH(uplcom) printf("%s: no endpoint descriptor for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -304,7 +306,7 @@ USB_ATTACH(uplcom) printf("%s: Could not find interrupt in\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* keep interface for interrupt */ @@ -329,7 +331,7 @@ USB_ATTACH(uplcom) printf("\n%s: failed to get second interface, err=%s\n", devname, usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } } @@ -344,7 +346,7 @@ USB_ATTACH(uplcom) printf("%s: no endpoint descriptor for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -360,14 +362,14 @@ USB_ATTACH(uplcom) printf("%s: Could not find data bulk in\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_dtr = sc->sc_rts = -1; @@ -389,7 +391,7 @@ USB_ATTACH(uplcom) printf("%s: reset failed, %s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, @@ -398,13 +400,12 @@ USB_ATTACH(uplcom) DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", uca.bulkin, uca.bulkout, sc->sc_intr_number )); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(uplcom) +int +uplcom_detach(struct device *self, int flags) { - USB_DETACH_START(uplcom, sc); + struct uplcom_softc *sc = (struct uplcom_softc *)self; int rv = 0; DPRINTF(("uplcom_detach: sc=%p flags=%d\n", sc, flags)); diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 7f02ff90d87..1ae4d52b157 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: urio.c,v 1.22 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: urio.c,v 1.23 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: urio.c,v 1.15 2002/10/23 09:14:02 jdolecek Exp $ */ /* @@ -145,9 +145,10 @@ static const struct usb_devno urio_devs[] = { USB_DECLARE_DRIVER(urio); -USB_MATCH(urio) +int +urio_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(urio, uaa); + struct usb_attach_arg *uaa = aux; DPRINTFN(50,("urio_match\n")); @@ -158,9 +159,11 @@ USB_MATCH(urio) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(urio) +void +urio_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(urio, sc, uaa); + struct urio_softc *sc = (struct urio_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; char *devinfop; @@ -172,22 +175,21 @@ USB_ATTACH(urio) DPRINTFN(10,("urio_attach: sc=%p\n", sc)); devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } err = usbd_device2interface_handle(dev, URIO_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_udev = dev; @@ -203,7 +205,7 @@ USB_ATTACH(urio) if (ed == NULL) { printf("%s: couldn't get ep %d\n", USBDEVNAME(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -215,7 +217,7 @@ USB_ATTACH(urio) } if (sc->sc_in_addr == -1 || sc->sc_out_addr == -1) { printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } #if defined(__FreeBSD__) @@ -229,13 +231,12 @@ USB_ATTACH(urio) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(urio) +int +urio_detach(struct device *self, int flags) { - USB_DETACH_START(urio, sc); + struct urio_softc *sc = (struct urio_softc *)self; int s; #if defined(__NetBSD__) || defined(__OpenBSD__) int maj, mn; diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index f5fda4ad634..6151962de3a 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.39 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: usb.c,v 1.40 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -146,13 +146,15 @@ Static const char *usbrev_str[] = USBREV_STR; USB_DECLARE_DRIVER(usb); -USB_MATCH(usb) +int +usb_match(struct device *parent, void *match, void *aux) { DPRINTF(("usbd_match\n")); return (UMATCH_GENERIC); } -USB_ATTACH(usb) +void +usb_attach(struct device *parent, struct device *self, void *aux) { struct usb_softc *sc = (struct usb_softc *)self; usbd_device_handle dev; @@ -181,7 +183,7 @@ USB_ATTACH(usb) default: printf(", not supported\n"); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } printf("\n"); @@ -200,7 +202,7 @@ USB_ATTACH(usb) if (sc->sc_bus->soft == NULL) { printf("%s: can't register softintr\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } #else usb_callout_init(sc->sc_bus->softi); @@ -215,7 +217,7 @@ USB_ATTACH(usb) sc->sc_dying = 1; printf("%s: root device is not a hub\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_bus->root_hub = dev; #if 1 @@ -237,8 +239,6 @@ USB_ATTACH(usb) config_pending_incr(); kthread_create_deferred(usb_create_event_thread, sc); - - USB_ATTACH_SUCCESS_RETURN; } #if defined(__NetBSD__) || defined(__OpenBSD__) diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 2d8af4cdc11..97fbe80cf16 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.67 2007/05/21 06:10:44 jsg Exp $ */ +/* $OpenBSD: usb_port.h,v 1.68 2007/05/27 04:00:25 jsg 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 $ */ @@ -166,44 +166,6 @@ const struct cfattach __CONCAT(dname,_ca) = { \ #define USB_DECLARE_DRIVER(dname) USB_DECLARE_DRIVER_CLASS(dname, DV_DULL) -#define USB_MATCH(dname) \ -int \ -__CONCAT(dname,_match)(parent, match, aux) \ - struct device *parent; \ - void *match; \ - void *aux; - -#define USB_MATCH_START(dname, uaa) \ - struct usb_attach_arg *uaa = aux - -#define USB_ATTACH(dname) \ -void \ -__CONCAT(dname,_attach)(parent, self, aux) \ - struct device *parent; \ - struct device *self; \ - void *aux; - -#define USB_ATTACH_START(dname, sc, uaa) \ - struct __CONCAT(dname,_softc) *sc = \ - (struct __CONCAT(dname,_softc) *)self; \ - struct usb_attach_arg *uaa = aux - -/* Returns from attach */ -#define USB_ATTACH_ERROR_RETURN return -#define USB_ATTACH_SUCCESS_RETURN return - -#define USB_ATTACH_SETUP printf("\n") - -#define USB_DETACH(dname) \ -int \ -__CONCAT(dname,_detach)(self, flags) \ - struct device *self; \ - int flags; - -#define USB_DETACH_START(dname, sc) \ - struct __CONCAT(dname,_softc) *sc = \ - (struct __CONCAT(dname,_softc) *)self - #define USB_GET_SC_OPEN(dname, unit, sc) \ if (unit >= __CONCAT(dname,_cd).cd_ndevs) \ return (ENXIO); \ diff --git a/sys/dev/usb/usbf.c b/sys/dev/usb/usbf.c index a82cb254248..195314fc3e1 100644 --- a/sys/dev/usb/usbf.c +++ b/sys/dev/usb/usbf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbf.c,v 1.2 2007/02/07 16:26:49 drahn Exp $ */ +/* $OpenBSD: usbf.c,v 1.3 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -105,12 +105,14 @@ struct cfdriver usbf_cd = { static const char * const usbrev_str[] = USBREV_STR; -USB_MATCH(usbf) +int +usbf_match(struct device *parent, void *match, void *aux) { return UMATCH_GENERIC; } -USB_ATTACH(usbf) +void +usbf_attach(struct device *parent, struct device *self, void *aux) { struct usbf_softc *sc = (struct usbf_softc *)self; int usbrev; diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 6de5fa2e70a..149b92c1145 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uscanner.c,v 1.23 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: uscanner.c,v 1.24 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: uscanner.c,v 1.40 2003/01/27 00:32:44 wiz Exp $ */ /* @@ -290,9 +290,10 @@ Static void uscanner_do_close(struct uscanner_softc *); USB_DECLARE_DRIVER(uscanner); -USB_MATCH(uscanner) +int +uscanner_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uscanner, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -301,9 +302,11 @@ USB_MATCH(uscanner) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(uscanner) +void +uscanner_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uscanner, sc, uaa); + struct uscanner_softc *sc = (struct uscanner_softc *)self; + struct usb_attach_arg *uaa = aux; usb_interface_descriptor_t *id = 0; usb_endpoint_descriptor_t *ed, *ed_bulkin = NULL, *ed_bulkout = NULL; char *devinfop; @@ -311,8 +314,7 @@ USB_ATTACH(uscanner) usbd_status err; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); sc->sc_dev_flags = uscanner_lookup(uaa->vendor, uaa->product)->flags; @@ -323,7 +325,7 @@ USB_ATTACH(uscanner) if (err) { printf("%s: setting config no failed\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } /* XXX We only check the first interface */ @@ -333,7 +335,7 @@ USB_ATTACH(uscanner) if (err || id == 0) { printf("%s: could not get interface descriptor, err=%d,id=%p\n", USBDEVNAME(sc->sc_dev), err, id); - USB_ATTACH_ERROR_RETURN; + return; } /* Find the two first bulk endpoints */ @@ -342,7 +344,7 @@ USB_ATTACH(uscanner) if (ed == 0) { printf("%s: could not read endpoint descriptor\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN @@ -361,7 +363,7 @@ USB_ATTACH(uscanner) if (ed_bulkin == NULL || ed_bulkout == NULL) { printf("%s: bulk-in and/or bulk-out endpoint not found\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_bulkin = ed_bulkin->bEndpointAddress; @@ -375,8 +377,6 @@ USB_ATTACH(uscanner) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - USB_ATTACH_SUCCESS_RETURN; } int @@ -623,9 +623,10 @@ uscanner_activate(device_ptr_t self, enum devact act) } #endif -USB_DETACH(uscanner) +int +uscanner_detach(struct device *self, int flags) { - USB_DETACH_START(uscanner, sc); + struct uscanner_softc *sc = (struct uscanner_softc *)self; int s; #if defined(__NetBSD__) || defined(__OpenBSD__) int maj, mn; diff --git a/sys/dev/usb/uslcom.c b/sys/dev/usb/uslcom.c index fd00419139a..e729baacb3a 100644 --- a/sys/dev/usb/uslcom.c +++ b/sys/dev/usb/uslcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uslcom.c,v 1.5 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: uslcom.c,v 1.6 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -131,9 +131,10 @@ static const struct usb_devno uslcom_devs[] = { USB_DECLARE_DRIVER(uslcom); -USB_MATCH(uslcom) +int +uslcom_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uslcom, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return UMATCH_NONE; @@ -142,9 +143,11 @@ USB_MATCH(uslcom) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -USB_ATTACH(uslcom) +void +uslcom_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uslcom, sc, uaa); + struct uslcom_softc *sc = (struct uslcom_softc *)self; + struct usb_attach_arg *uaa = aux; struct ucom_attach_args uca; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; @@ -155,15 +158,14 @@ USB_ATTACH(uslcom) bzero(&uca, sizeof(uca)); sc->sc_udev = uaa->device; devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the first interface handle */ @@ -173,7 +175,7 @@ USB_ATTACH(uslcom) printf("%s: could not get interface handle\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } id = usbd_get_interface_descriptor(sc->sc_iface); @@ -185,7 +187,7 @@ USB_ATTACH(uslcom) printf("%s: no endpoint descriptor found for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -199,7 +201,7 @@ USB_ATTACH(uslcom) if (uca.bulkin == -1 || uca.bulkout == -1) { printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } uca.ibufsize = USLCOMBUFSZ; @@ -216,13 +218,12 @@ USB_ATTACH(uslcom) USBDEV(sc->sc_dev)); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(uslcom) +int +uslcom_detach(struct device *self, int flags) { - USB_DETACH_START(uslcom, sc); + struct uslcom_softc *sc = (struct uslcom_softc *)self; int rv = 0; sc->sc_dying = 1; diff --git a/sys/dev/usb/usscanner.c b/sys/dev/usb/usscanner.c index 1a39a85f755..62789e456b6 100644 --- a/sys/dev/usb/usscanner.c +++ b/sys/dev/usb/usscanner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usscanner.c,v 1.13 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: usscanner.c,v 1.14 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: usscanner.c,v 1.6 2001/01/23 14:04:14 augustss Exp $ */ /* @@ -185,9 +185,10 @@ Static callback usscanner_sensedata_cb; USB_DECLARE_DRIVER(usscanner); -USB_MATCH(usscanner) +int +usscanner_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(usscanner, uaa); + struct usb_attach_arg *uaa = aux; DPRINTFN(50,("usscanner_match\n")); @@ -201,9 +202,11 @@ USB_MATCH(usscanner) return (UMATCH_NONE); } -USB_ATTACH(usscanner) +void +usscanner_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(usscanner, sc, uaa); + struct usscanner_softc *sc = (struct usscanner_softc *)self; + struct usb_attach_arg *uaa = aux; struct scsibus_attach_args saa; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; @@ -216,22 +219,21 @@ USB_ATTACH(usscanner) DPRINTFN(10,("usscanner_attach: sc=%p\n", sc)); devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), 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)); - USB_ATTACH_ERROR_RETURN; + return; } err = usbd_device2interface_handle(dev, USSCANNER_IFACE_IDX, &iface); if (err) { printf("%s: getting interface handle failed\n", USBDEVNAME(sc->sc_dev)); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_udev = dev; @@ -248,7 +250,7 @@ USB_ATTACH(usscanner) if (ed == NULL) { printf("%s: couldn't get ep %d\n", USBDEVNAME(sc->sc_dev), i); - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { @@ -264,7 +266,7 @@ USB_ATTACH(usscanner) 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)); - USB_ATTACH_ERROR_RETURN; + return; } err = usbd_open_pipe(sc->sc_iface, sc->sc_in_addr, @@ -272,7 +274,7 @@ USB_ATTACH(usscanner) if (err) { printf("%s: open in pipe failed, err=%d\n", USBDEVNAME(sc->sc_dev), err); - USB_ATTACH_ERROR_RETURN; + return; } /* The interrupt endpoint must be opened as a normal pipe. */ @@ -283,7 +285,7 @@ USB_ATTACH(usscanner) printf("%s: open intr pipe failed, err=%d\n", USBDEVNAME(sc->sc_dev), err); usscanner_cleanup(sc); - USB_ATTACH_ERROR_RETURN; + return; } err = usbd_open_pipe(sc->sc_iface, sc->sc_out_addr, USBD_EXCLUSIVE_USE, &sc->sc_out_pipe); @@ -291,7 +293,7 @@ USB_ATTACH(usscanner) printf("%s: open out pipe failed, err=%d\n", USBDEVNAME(sc->sc_dev), err); usscanner_cleanup(sc); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_cmd_xfer = usbd_alloc_xfer(uaa->device); @@ -299,7 +301,7 @@ USB_ATTACH(usscanner) printf("%s: alloc cmd xfer failed, err=%d\n", USBDEVNAME(sc->sc_dev), err); usscanner_cleanup(sc); - USB_ATTACH_ERROR_RETURN; + return; } /* XXX too big */ @@ -309,7 +311,7 @@ USB_ATTACH(usscanner) printf("%s: alloc cmd buffer failed, err=%d\n", USBDEVNAME(sc->sc_dev), err); usscanner_cleanup(sc); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_intr_xfer = usbd_alloc_xfer (uaa->device); @@ -317,7 +319,7 @@ USB_ATTACH(usscanner) printf("%s: alloc intr xfer failed, err=%d\n", USBDEVNAME(sc->sc_dev), err); usscanner_cleanup(sc); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_data_xfer = usbd_alloc_xfer(uaa->device); @@ -325,7 +327,7 @@ USB_ATTACH(usscanner) printf("%s: alloc data xfer failed, err=%d\n", USBDEVNAME(sc->sc_dev), err); usscanner_cleanup(sc); - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_data_buffer = usbd_alloc_buffer(sc->sc_data_xfer, USSCANNER_MAX_TRANSFER_SIZE); @@ -333,7 +335,7 @@ USB_ATTACH(usscanner) printf("%s: alloc data buffer failed, err=%d\n", USBDEVNAME(sc->sc_dev), err); usscanner_cleanup(sc); - USB_ATTACH_ERROR_RETURN; + return; } /* @@ -374,13 +376,12 @@ USB_ATTACH(usscanner) USBDEV(sc->sc_dev)); DPRINTFN(10, ("usscanner_attach: %p\n", sc->sc_udev)); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(usscanner) +int +usscanner_detach(struct device *self, int flags) { - USB_DETACH_START(usscanner, sc); + struct usscanner_softc *sc = (struct usscanner_softc *)self; int rv, s; DPRINTF(("usscanner_detach: sc=%p flags=%d\n", sc, flags)); diff --git a/sys/dev/usb/uts.c b/sys/dev/usb/uts.c index c4088327740..3ea5b96e8a2 100644 --- a/sys/dev/usb/uts.c +++ b/sys/dev/usb/uts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uts.c,v 1.7 2007/05/18 18:47:30 robert Exp $ */ +/* $OpenBSD: uts.c,v 1.8 2007/05/27 04:00:25 jsg Exp $ */ /* * Copyright (c) 2007 Robert Nagy <robert@openbsd.org> @@ -112,9 +112,10 @@ const struct wsmouse_accessops uts_accessops = { USB_DECLARE_DRIVER(uts); -USB_MATCH(uts) +int +uts_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uts, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface == NULL) return UMATCH_NONE; @@ -123,9 +124,11 @@ USB_MATCH(uts) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -USB_ATTACH(uts) +void +uts_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uts, sc, uaa); + struct uts_softc *sc = (struct uts_softc *)self; + struct usb_attach_arg *uaa = aux; usb_config_descriptor_t *cdesc; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; @@ -143,7 +146,7 @@ USB_ATTACH(uts) bcopy(&def_scale, &sc->sc_tsscale, sizeof(sc->sc_tsscale)); /* Display device info string */ - USB_ATTACH_SETUP; + printf("\n"); if ((devinfop = usbd_devinfo_alloc(uaa->device, 0)) != NULL) { printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); @@ -154,7 +157,7 @@ USB_ATTACH(uts) printf("%s: could not set configuartion no\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the config descriptor */ @@ -163,7 +166,7 @@ USB_ATTACH(uts) printf("%s: failed to get configuration descriptor\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the interface */ @@ -171,7 +174,7 @@ USB_ATTACH(uts) printf("%s: failed to get interface\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* Find the interrupt endpoint */ @@ -185,7 +188,7 @@ USB_ATTACH(uts) printf("%s: no endpoint descriptor for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -199,7 +202,7 @@ USB_ATTACH(uts) printf("%s: Could not find interrupt in\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, @@ -209,13 +212,12 @@ USB_ATTACH(uts) a.accesscookie = sc; sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(uts) +int +uts_detach(struct device *self, int flags) { - USB_DETACH_START(uts, sc); + struct uts_softc *sc = (struct uts_softc *)self; int rv = 0; if (sc->sc_intr_pipe != NULL) { diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index ab6a106f120..2e88d4f7118 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvisor.c,v 1.27 2006/06/23 06:27:12 miod Exp $ */ +/* $OpenBSD: uvisor.c,v 1.28 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: uvisor.c,v 1.21 2003/08/03 21:59:26 nathanw Exp $ */ /* @@ -203,9 +203,10 @@ static const struct uvisor_type uvisor_devs[] = { USB_DECLARE_DRIVER(uvisor); -USB_MATCH(uvisor) +int +uvisor_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uvisor, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -217,9 +218,11 @@ USB_MATCH(uvisor) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(uvisor) +void +uvisor_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uvisor, sc, uaa); + struct uvisor_softc *sc = (struct uvisor_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usbd_interface_handle iface; usb_interface_descriptor_t *id; @@ -250,8 +253,7 @@ USB_ATTACH(uvisor) } devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfop); + printf("\n%s: %s\n", devname, devinfop); usbd_devinfo_free(devinfop); sc->sc_flags = uvisor_lookup(uaa->vendor, uaa->product)->uv_flags; @@ -366,12 +368,11 @@ USB_ATTACH(uvisor) } } - USB_ATTACH_SUCCESS_RETURN; + return; bad: DPRINTF(("uvisor_attach: ATTACH ERROR\n")); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; } int diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index d2d5e059a0c..17cc96a8802 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvscom.c,v 1.9 2007/05/21 05:40:28 jsg Exp $ */ +/* $OpenBSD: uvscom.c,v 1.10 2007/05/27 04:00:25 jsg 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>. @@ -256,9 +256,10 @@ MODULE_DEPEND(uvscom, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); MODULE_VERSION(uvscom, UVSCOM_MODVER); #endif -USB_MATCH(uvscom) +int +uvscom_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uvscom, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -267,9 +268,11 @@ USB_MATCH(uvscom) UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } -USB_ATTACH(uvscom) +void +uvscom_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uvscom, sc, uaa); + struct uvscom_softc *sc = (struct uvscom_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; usb_config_descriptor_t *cdesc; usb_interface_descriptor_t *id; @@ -281,8 +284,7 @@ USB_ATTACH(uvscom) struct ucom_attach_args uca; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfop); + printf("\n%s: %s\n", devname, devinfop); usbd_devinfo_free(devinfop); sc->sc_udev = dev; @@ -300,7 +302,7 @@ USB_ATTACH(uvscom) printf("%s: failed to set configuration, err=%s\n", devname, usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the config descriptor */ @@ -310,7 +312,7 @@ USB_ATTACH(uvscom) printf("%s: failed to get configuration descriptor\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } /* get the common interface */ @@ -320,7 +322,7 @@ USB_ATTACH(uvscom) printf("%s: failed to get interface, err=%s\n", devname, usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } id = usbd_get_interface_descriptor(sc->sc_iface); @@ -333,7 +335,7 @@ USB_ATTACH(uvscom) printf("%s: no endpoint descriptor for %d\n", USBDEVNAME(sc->sc_dev), i); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && @@ -353,19 +355,19 @@ USB_ATTACH(uvscom) printf("%s: Could not find data bulk in\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } if (sc->sc_intr_number == -1) { printf("%s: Could not find interrupt in\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } sc->sc_dtr = sc->sc_rts = 0; @@ -389,7 +391,7 @@ USB_ATTACH(uvscom) printf("%s: reset failed, %s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err)); sc->sc_dying = 1; - USB_ATTACH_ERROR_RETURN; + return; } DPRINTF(("uvscom: in = 0x%x out = 0x%x intr = 0x%x\n", @@ -401,13 +403,12 @@ USB_ATTACH(uvscom) DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", uca.bulkin, uca.bulkout, sc->sc_intr_number )); sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(uvscom) +int +uvscom_detach(struct device *self, int flags) { - USB_DETACH_START(uvscom, sc); + struct uvscom_softc *sc = (struct uvscom_softc *)self; int rv = 0; DPRINTF(("uvscom_detach: sc = %p\n", sc)); diff --git a/sys/dev/usb/uyap.c b/sys/dev/usb/uyap.c index d93760c8749..0efcafeec66 100644 --- a/sys/dev/usb/uyap.c +++ b/sys/dev/usb/uyap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uyap.c,v 1.9 2005/08/01 05:36:49 brad Exp $ */ +/* $OpenBSD: uyap.c,v 1.10 2007/05/27 04:00:25 jsg Exp $ */ /* $NetBSD: uyap.c,v 1.6 2002/07/11 21:14:37 augustss Exp $ */ /* @@ -58,9 +58,10 @@ struct uyap_softc { USB_DECLARE_DRIVER(uyap); void uyap_attachhook(void *); -USB_MATCH(uyap) +int +uyap_match(struct device *parent, void *match, void *aux) { - USB_MATCH_START(uyap, uaa); + struct usb_attach_arg *uaa = aux; if (uaa->iface != NULL) return (UMATCH_NONE); @@ -84,22 +85,23 @@ uyap_attachhook(void *xsc) if (err) { printf("%s: download ezdata format firmware error: %s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err)); - USB_ATTACH_ERROR_RETURN; + return; } printf("%s: firmware download complete, disconnecting.\n", USBDEVNAME(sc->sc_dev)); } -USB_ATTACH(uyap) +void +uyap_attach(struct device *parent, struct device *self, void *aux) { - USB_ATTACH_START(uyap, sc, uaa); + struct uyap_softc *sc = (struct uyap_softc *)self; + struct usb_attach_arg *uaa = aux; usbd_device_handle dev = uaa->device; char *devinfop; devinfop = usbd_devinfo_alloc(dev, 0); - USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); usbd_devinfo_free(devinfop); printf("%s: downloading firmware\n", USBDEVNAME(sc->sc_dev)); @@ -109,14 +111,11 @@ USB_ATTACH(uyap) mountroothook_establish(uyap_attachhook, sc); else uyap_attachhook(sc); - - USB_ATTACH_SUCCESS_RETURN; } -USB_DETACH(uyap) +int +uyap_detach(struct device *self, int flags) { - /*USB_DETACH_START(uyap, sc);*/ - return (0); } |