summaryrefslogtreecommitdiff
path: root/sys/dev/usb/moscom.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2007-05-27 04:00:26 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2007-05-27 04:00:26 +0000
commit8af8360c45b95e6b193754943c92302b8b294a5f (patch)
treea6019b8f5be3c6276cfe93066c6277c7a5b877fe /sys/dev/usb/moscom.c
parent86426f8d732cd6e237f154fe80a9dd0ca0c2a8aa (diff)
Farewell USB_{ATTACH,MATCH,DETACH}* you will not be missed.
ok deraadt@ krw@ mbalmer@
Diffstat (limited to 'sys/dev/usb/moscom.c')
-rw-r--r--sys/dev/usb/moscom.c31
1 files changed, 16 insertions, 15 deletions
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;