From 543a8dc3357c78204d94ced0db8695ea9bf8dfd7 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sun, 6 Jun 2010 17:53:32 +0000 Subject: Use usb_lookup() instead of rolling our own. ok armani@ fabien@ --- sys/dev/usb/if_urndis.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'sys/dev/usb') diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c index a5ab3760ba3..ec269ac3e3c 100644 --- a/sys/dev/usb/if_urndis.c +++ b/sys/dev/usb/if_urndis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urndis.c,v 1.20 2010/04/05 08:11:34 armani Exp $ */ +/* $OpenBSD: if_urndis.c,v 1.21 2010/06/06 17:53:31 miod Exp $ */ /* * Copyright (c) 2010 Jonathan Armani @@ -130,11 +130,8 @@ struct cfattach urndis_ca = { /* * Supported devices that we can't match by class IDs. */ -struct urndis_type { - u_int16_t urndis_vid; - u_int16_t urndis_pid; -} urndis_devs[] = { - { USB_VENDOR_HTC, USB_PRODUCT_HTC_ANDROID }, +static const struct usb_devno urndis_devs[] = { + { USB_VENDOR_HTC, USB_PRODUCT_HTC_ANDROID } }; usbd_status @@ -1311,7 +1308,6 @@ urndis_match(struct device *parent, void *match, void *aux) { struct usb_attach_arg *uaa; usb_interface_descriptor_t *id; - int i; uaa = aux; @@ -1327,17 +1323,8 @@ urndis_match(struct device *parent, void *match, void *aux) id->bInterfaceProtocol == UIPROTO_RNDIS) return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO); - for (i = 0; i < sizeof(urndis_devs) / sizeof(urndis_devs[0]); i++) { - struct urndis_type *t; - - t = &urndis_devs[i]; - - if (uaa->vendor == t->urndis_vid && - uaa->product == t->urndis_pid) - return UMATCH_VENDOR_PRODUCT; - } - - return (UMATCH_NONE); + return (usb_lookup(urndis_devs, uaa->vendor, uaa->product) != NULL) ? + UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } void -- cgit v1.2.3