diff options
author | 2015-06-12 15:47:31 +0000 | |
---|---|---|
committer | 2015-06-12 15:47:31 +0000 | |
commit | 7ebc5b51da5611c78123bf2a163bb4cee0fee6d5 (patch) | |
tree | 9e2efe12c6dafc889c8722d6cffa0d9c8496d325 /sys/dev/usb/if_rsu.c | |
parent | Remove superfluous splnet() protection. (diff) | |
download | wireguard-openbsd-7ebc5b51da5611c78123bf2a163bb4cee0fee6d5.tar.xz wireguard-openbsd-7ebc5b51da5611c78123bf2a163bb4cee0fee6d5.zip |
Only match devices with a valid configuration.
Most of the WiFi/Ethernet USB adapter only have one configuration and always
use its first interface. In order to improve USB descriptors parsing start
by reducing the number of places where a configuration is set.
Tests & ok stsp@
Diffstat (limited to 'sys/dev/usb/if_rsu.c')
-rw-r--r-- | sys/dev/usb/if_rsu.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/sys/dev/usb/if_rsu.c b/sys/dev/usb/if_rsu.c index 72f4b0b6945..e995b39ec01 100644 --- a/sys/dev/usb/if_rsu.c +++ b/sys/dev/usb/if_rsu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsu.c,v 1.26 2015/03/14 03:38:49 jsg Exp $ */ +/* $OpenBSD: if_rsu.c,v 1.27 2015/06/12 15:47:31 mpi Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -197,11 +197,11 @@ rsu_match(struct device *parent, void *match, void *aux) { struct usb_attach_arg *uaa = aux; - if (uaa->iface != NULL) + if (uaa->iface == NULL || uaa->configno != 1) return (UMATCH_NONE); return ((usb_lookup(rsu_devs, uaa->vendor, uaa->product) != NULL) ? - UMATCH_VENDOR_PRODUCT : UMATCH_NONE); + UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE); } void @@ -214,24 +214,11 @@ rsu_attach(struct device *parent, struct device *self, void *aux) int i, error; sc->sc_udev = uaa->device; + sc->sc_iface = uaa->iface; usb_init_task(&sc->sc_task, rsu_task, sc, USB_TASK_TYPE_GENERIC); timeout_set(&sc->calib_to, rsu_calib_to, sc); - if (usbd_set_config_no(sc->sc_udev, 1, 0) != 0) { - printf("%s: could not set configuration no\n", - sc->sc_dev.dv_xname); - return; - } - - /* Get the first interface handle. */ - error = usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface); - if (error != 0) { - printf("%s: could not get interface handle\n", - sc->sc_dev.dv_xname); - return; - } - /* Read chip revision. */ sc->cut = MS(rsu_read_4(sc, R92S_PMC_FSM), R92S_PMC_FSM_CUT); if (sc->cut != 3) |