aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2007-09-19 16:21:34 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2007-09-19 16:21:34 +0000
commit75d4506b87b427deb189e352970c4753ad75d3d0 (patch)
tree56fd80d6652b1891af5241293f38bd927708a2c4 /sys/dev/usb
parentea8979747eafddbd0c3c7c4f7afb1c84284865b1 (diff)
Notes
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/ehci_pci.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/usb/ehci_pci.c b/sys/dev/usb/ehci_pci.c
index 2ff396eff93e..c44eb1f47930 100644
--- a/sys/dev/usb/ehci_pci.c
+++ b/sys/dev/usb/ehci_pci.c
@@ -270,6 +270,7 @@ static int
ehci_pci_attach(device_t self)
{
ehci_softc_t *sc = device_get_softc(self);
+ devclass_t dc;
device_t parent;
device_t *neighbors;
device_t *nbus;
@@ -287,7 +288,7 @@ ehci_pci_attach(device_t self)
case PCI_USBREV_1_0:
case PCI_USBREV_1_1:
sc->sc_bus.usbrev = USBREV_UNKNOWN;
- printf("pre-2.0 USB rev\n");
+ device_printf(self, "pre-2.0 USB rev\n");
return ENXIO;
case PCI_USBREV_2_0:
sc->sc_bus.usbrev = USBREV_2_0;
@@ -403,6 +404,7 @@ ehci_pci_attach(device_t self)
return ENXIO;
}
ncomp = 0;
+ dc = devclass_find("usb");
slot = pci_get_slot(self);
function = pci_get_function(self);
for (i = 0; i < count; i++) {
@@ -410,9 +412,18 @@ ehci_pci_attach(device_t self)
pci_get_function(neighbors[i]) < function) {
res = device_get_children(neighbors[i],
&nbus, &buscount);
- if (res != 0 || buscount != 1)
+ if (res != 0)
continue;
+ if (buscount != 1) {
+ free(nbus, M_TEMP);
+ continue;
+ }
+ if (device_get_devclass(nbus[0]) != dc) {
+ free(nbus, M_TEMP);
+ continue;
+ }
bsc = device_get_softc(nbus[0]);
+ free(nbus, M_TEMP);
DPRINTF(("ehci_pci_attach: companion %s\n",
device_get_nameunit(bsc->bdev)));
sc->sc_comps[ncomp++] = bsc;