I would like to kill matchlvl in order to move forward with cleaning
our usb stack. So I'd appreciate if people would test the following diff
and let me know if it breaks anything.

My devices don't seem to be affected by it.

Index: ugen.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ugen.c,v
retrieving revision 1.75
diff -u -p -r1.75 ugen.c
--- ugen.c      6 Nov 2013 16:58:13 -0000       1.75
+++ ugen.c      15 Nov 2013 08:50:12 -0000
@@ -140,10 +140,6 @@ ugen_match(struct device *parent, void *
 {
        struct usb_attach_arg *uaa = aux;
 
-#if 0
-       if (uaa->matchlvl)
-               return (uaa->matchlvl);
-#endif
        if (uaa->usegeneric) {
                return (UMATCH_GENERIC);
        } else
Index: uhid.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uhid.c,v
retrieving revision 1.54
diff -u -p -r1.54 uhid.c
--- uhid.c      15 Nov 2013 08:17:44 -0000      1.54
+++ uhid.c      15 Nov 2013 08:50:59 -0000
@@ -114,12 +114,12 @@ const struct cfattach uhid_ca = { 
 int
 uhid_match(struct device *parent, void *match, void *aux)
 {
+#ifdef UHID_DEBUG
        struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)aux;
+#endif
 
        DPRINTF(("uhid_match: report=%d\n", uha->reportid));
 
-       if (uha->matchlvl)
-               return (uha->matchlvl);
        return (UMATCH_IFACECLASS_GENERIC);
 }
 
Index: uhidev.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uhidev.c,v
retrieving revision 1.50
diff -u -p -r1.50 uhidev.c
--- uhidev.c    11 Nov 2013 09:16:03 -0000      1.50
+++ uhidev.c    15 Nov 2013 08:51:00 -0000
@@ -110,8 +110,6 @@ uhidev_match(struct device *parent, void
                return (UMATCH_NONE);
        if (usbd_get_quirks(uaa->device)->uq_flags & UQ_BAD_HID)
                return (UMATCH_NONE);
-       if (uaa->matchlvl)
-               return (uaa->matchlvl);
 
        return (UMATCH_IFACECLASS_GENERIC);
 }
@@ -332,10 +330,6 @@ int uhidevsubmatch(struct device *parent
        if (cf->uhidevcf_reportid != UHIDEV_UNK_REPORTID &&
            cf->uhidevcf_reportid != uha->reportid)
                return (0);
-       if (cf->uhidevcf_reportid == uha->reportid)
-               uha->matchlvl = UMATCH_VENDOR_PRODUCT;
-       else
-               uha->matchlvl = 0;
        return ((*cf->cf_attach->ca_match)(parent, cf, aux));
 }
 
Index: uhidev.h
===================================================================
RCS file: /cvs/src/sys/dev/usb/uhidev.h,v
retrieving revision 1.15
diff -u -p -r1.15 uhidev.h
--- uhidev.h    15 Nov 2013 08:17:44 -0000      1.15
+++ uhidev.h    15 Nov 2013 08:51:00 -0000
@@ -82,7 +82,6 @@ struct uhidev_attach_arg {
        struct uhidev_softc *parent;
        int reportid;
        int reportsize;
-       int matchlvl;
 };
 
 void uhidev_get_report_desc(struct uhidev_softc *, void **, int *);
Index: usb_subr.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.94
diff -u -p -r1.94 usb_subr.c
--- usb_subr.c  2 Nov 2013 12:23:58 -0000       1.94
+++ usb_subr.c  15 Nov 2013 08:51:01 -0000
@@ -1300,18 +1300,6 @@ usbd_submatch(struct device *parent, voi
             )
           )
                return 0;
-       if (cf->uhubcf_vendor != UHUB_UNK_VENDOR &&
-           cf->uhubcf_vendor == uaa->vendor &&
-           cf->uhubcf_product != UHUB_UNK_PRODUCT &&
-           cf->uhubcf_product == uaa->product) {
-               /* We have a vendor&product locator match */
-               if (cf->uhubcf_release != UHUB_UNK_RELEASE &&
-                   cf->uhubcf_release == uaa->release)
-                       uaa->matchlvl = UMATCH_VENDOR_PRODUCT_REV;
-               else
-                       uaa->matchlvl = UMATCH_VENDOR_PRODUCT;
-       } else
-               uaa->matchlvl = 0;
        return ((*cf->cf_attach->ca_match)(parent, cf, aux));
 }
 
Index: usbdi.h
===================================================================
RCS file: /cvs/src/sys/dev/usb/usbdi.h,v
retrieving revision 1.58
diff -u -p -r1.58 usbdi.h
--- usbdi.h     13 Nov 2013 13:48:08 -0000      1.58
+++ usbdi.h     15 Nov 2013 08:51:01 -0000
@@ -219,7 +219,6 @@ struct usb_attach_arg {
        int                     vendor;
        int                     product;
        int                     release;
-       int                     matchlvl;
        struct usbd_device      *device;        /* current device */
        struct usbd_interface   *iface; /* current interface */
        int                     usegeneric;

Reply via email to