Since we cannot really guarantee that devices will be at the same place
on the USB tree and this stuff is unused, I don't see a reason to keep
it.

ok?

Index: usb_subr.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.110
diff -u -p -r1.110 usb_subr.c
--- usb_subr.c  5 Oct 2014 08:40:29 -0000       1.110
+++ usb_subr.c  30 Oct 2014 22:45:02 -0000
@@ -66,7 +66,6 @@ void          usbd_devinfo_vp(struct usbd_device
 char           *usbd_get_string(struct usbd_device *, int, char *, size_t);
 int            usbd_getnewaddr(struct usbd_bus *);
 int            usbd_print(void *, const char *);
-int            usbd_submatch(struct device *, void *, void *);
 void           usbd_free_iface_data(struct usbd_device *, int);
 usbd_status    usbd_probe_and_attach(struct device *,
                    struct usbd_device *, int, int);
@@ -873,7 +872,7 @@ usbd_probe_and_attach(struct device *par
 
        /* First try with device specific drivers. */
        DPRINTF(("usbd_probe_and_attach trying device specific drivers\n"));
-       dv = config_found_sm(parent, &uaa, usbd_print, usbd_submatch);
+       dv = config_found(parent, &uaa, usbd_print);
        if (dv) {
                dev->subdevs = malloc(2 * sizeof dv, M_USB, M_NOWAIT);
                if (dev->subdevs == NULL) {
@@ -933,8 +932,7 @@ usbd_probe_and_attach(struct device *par
                                continue;
                        uaa.iface = ifaces[i];
                        uaa.ifaceno = ifaces[i]->idesc->bInterfaceNumber;
-                       dv = config_found_sm(parent, &uaa, usbd_print,
-                                          usbd_submatch);
+                       dv = config_found(parent, &uaa, usbd_print);
                        if (dv != NULL) {
                                dev->subdevs[dev->ndevs++] = dv;
                                usbd_claim_iface(dev, i);
@@ -970,7 +968,7 @@ generic:
        uaa.configno = dev->ndevs == 0 ? UHUB_UNK_CONFIGURATION :
            dev->cdesc->bConfigurationValue;
        uaa.ifaceno = UHUB_UNK_INTERFACE;
-       dv = config_found_sm(parent, &uaa, usbd_print, usbd_submatch);
+       dv = config_found(parent, &uaa, usbd_print);
        if (dv != NULL) {
                if (dev->ndevs == 0) {
                        dev->subdevs = malloc(2 * sizeof dv, M_USB, M_NOWAIT);
@@ -1257,45 +1255,6 @@ usbd_print(void *aux, const char *pnp)
                printf(" %s\n", devinfop);
        free(devinfop, M_TEMP, 0);
        return (UNCONF);
-}
-
-int
-usbd_submatch(struct device *parent, void *match, void *aux)
-{
-       struct cfdata *cf = match;
-       struct usb_attach_arg *uaa = aux;
-
-       DPRINTFN(5,("usbd_submatch port=%d,%d configno=%d,%d "
-           "ifaceno=%d,%d vendor=0x%x,0x%x product=0x%x,0x%x release=%d,%d\n",
-           uaa->port, cf->uhubcf_port,
-           uaa->configno, cf->uhubcf_configuration,
-           uaa->ifaceno, cf->uhubcf_interface,
-           uaa->vendor, cf->uhubcf_vendor,
-           uaa->product, cf->uhubcf_product,
-           uaa->release, cf->uhubcf_release));
-       if (uaa->port != 0 &&   /* root hub has port 0, it should match */
-           ((uaa->port != 0 &&
-             cf->uhubcf_port != UHUB_UNK_PORT &&
-             cf->uhubcf_port != uaa->port) ||
-            (uaa->configno != UHUB_UNK_CONFIGURATION &&
-             cf->uhubcf_configuration != UHUB_UNK_CONFIGURATION &&
-             cf->uhubcf_configuration != uaa->configno) ||
-            (uaa->ifaceno != UHUB_UNK_INTERFACE &&
-             cf->uhubcf_interface != UHUB_UNK_INTERFACE &&
-             cf->uhubcf_interface != uaa->ifaceno) ||
-            (uaa->vendor != UHUB_UNK_VENDOR &&
-             cf->uhubcf_vendor != UHUB_UNK_VENDOR &&
-             cf->uhubcf_vendor != uaa->vendor) ||
-            (uaa->product != UHUB_UNK_PRODUCT &&
-             cf->uhubcf_product != UHUB_UNK_PRODUCT &&
-             cf->uhubcf_product != uaa->product) ||
-            (uaa->release != UHUB_UNK_RELEASE &&
-             cf->uhubcf_release != UHUB_UNK_RELEASE &&
-             cf->uhubcf_release != uaa->release)
-            )
-          )
-               return 0;
-       return ((*cf->cf_attach->ca_match)(parent, cf, aux));
 }
 
 void
Index: usbdivar.h
===================================================================
RCS file: /cvs/src/sys/dev/usb/usbdivar.h,v
retrieving revision 1.62
diff -u -p -r1.62 usbdivar.h
--- usbdivar.h  9 Aug 2014 09:45:14 -0000       1.62
+++ usbdivar.h  30 Oct 2014 22:47:06 -0000
@@ -253,39 +253,8 @@ void               usb_needs_explore(struct usbd_devi
 void           usb_needs_reattach(struct usbd_device *);
 void           usb_schedsoftintr(struct usbd_bus *);
 
-/* Locator stuff. */
-
-/* XXX these values are used to statically bind some elements in the USB tree
- * to specific driver instances. This should be somehow emulated in FreeBSD
- * but can be done later on.
- * The values are copied from the files.usb file in the NetBSD sources.
- */
-#define UHUBCF_PORT_DEFAULT -1
-#define UHUBCF_CONFIGURATION_DEFAULT -1
-#define UHUBCF_INTERFACE_DEFAULT -1
-#define UHUBCF_VENDOR_DEFAULT -1
-#define UHUBCF_PRODUCT_DEFAULT -1
-#define UHUBCF_RELEASE_DEFAULT -1
-
-#define        UHUBCF_PORT             0
-#define        UHUBCF_CONFIGURATION    1
-#define        UHUBCF_INTERFACE        2
-#define        UHUBCF_VENDOR           3
-#define        UHUBCF_PRODUCT          4
-#define        UHUBCF_RELEASE          5
-
-#define        uhubcf_port             cf_loc[UHUBCF_PORT]
-#define        uhubcf_configuration    cf_loc[UHUBCF_CONFIGURATION]
-#define        uhubcf_interface        cf_loc[UHUBCF_INTERFACE]
-#define        uhubcf_vendor           cf_loc[UHUBCF_VENDOR]
-#define        uhubcf_product          cf_loc[UHUBCF_PRODUCT]
-#define        uhubcf_release          cf_loc[UHUBCF_RELEASE]
-#define        UHUB_UNK_PORT           UHUBCF_PORT_DEFAULT /* wildcarded 
'port' */
-#define        UHUB_UNK_CONFIGURATION  UHUBCF_CONFIGURATION_DEFAULT /* 
wildcarded 'configuration' */
-#define        UHUB_UNK_INTERFACE      UHUBCF_INTERFACE_DEFAULT /* wildcarded 
'interface' */
-#define        UHUB_UNK_VENDOR         UHUBCF_VENDOR_DEFAULT /* wildcarded 
'vendor' */
-#define        UHUB_UNK_PRODUCT        UHUBCF_PRODUCT_DEFAULT /* wildcarded 
'product' */
-#define        UHUB_UNK_RELEASE        UHUBCF_RELEASE_DEFAULT /* wildcarded 
'release' */
+#define        UHUB_UNK_CONFIGURATION  -1
+#define        UHUB_UNK_INTERFACE      -1
 
 static inline int
 usbd_xfer_isread(struct usbd_xfer *xfer)

Reply via email to