From 990e9fea48684e427174d9d42f30d8e60cd3f0e4 Mon Sep 17 00:00:00 2001 From: Josef Karthauser Date: Thu, 28 Mar 2002 12:22:58 +0000 Subject: [PATCH] Use usb_lookup instead of rolling our own. Suggested by: Lennart Augustsson --- sys/dev/usb/uvscom.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index ffffdfd427e1..312ee9f9709d 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -211,16 +211,13 @@ struct ucom_callback uvscom_callback = { NULL }; -static const struct uvscom_product { - uint16_t vendor; - uint16_t product; -} uvscom_products [] = { +static const struct usb_devno uvscom_devs [] = { /* SUNTAC U-Cable type P1 */ { USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_PS64P1 }, /* SUNTAC Slipper U */ { USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_VS10U }, - { 0, 0 } }; +#define uvscom_lookup(v, p) usb_lookup(uvscom_devs, v, p) Static device_probe_t uvscom_match; Static device_attach_t uvscom_attach; @@ -247,18 +244,12 @@ MODULE_VERSION(uvscom, UVSCOM_MODVER); USB_MATCH(uvscom) { USB_MATCH_START(uvscom, uaa); - int i; if (uaa->iface != NULL) return (UMATCH_NONE); - for (i = 0; uvscom_products[i].vendor != 0; i++) { - if (uvscom_products[i].vendor == uaa->vendor && - uvscom_products[i].product == uaa->product) { - return (UMATCH_VENDOR_PRODUCT); - } - } - return (UMATCH_NONE); + return (uvscom_lookup(uaa->vendor, uaa->product) != NULL ? + UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } USB_ATTACH(uvscom)