Use usb_lookup instead of rolling our own.

Suggested by:	Lennart Augustsson <lennart@augustsson.net>
This commit is contained in:
joe 2002-03-28 12:22:58 +00:00
parent 7703eadb26
commit 6e213ce2c4

View File

@ -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)