usb(4): Use the global BUS topology lock where appropriate.

MFC after:		1 week
Sponsored by:		NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2022-03-17 15:20:51 +01:00
parent a85ff2114c
commit 5e203517e0
2 changed files with 8 additions and 8 deletions

View File

@ -1647,7 +1647,7 @@ uhub_child_location(device_t parent, device_t child, struct sbuf *sb)
sc = device_get_softc(parent);
hub = sc->sc_udev->hub;
mtx_lock(&Giant);
bus_topo_lock();
uhub_find_iface_index(hub, child, &res);
if (!res.udev) {
DPRINTF("device not on hub\n");
@ -1667,7 +1667,7 @@ uhub_child_location(device_t parent, device_t child, struct sbuf *sb)
#endif
);
done:
mtx_unlock(&Giant);
bus_topo_unlock();
return (0);
}
@ -1687,7 +1687,7 @@ uhub_get_device_path(device_t bus, device_t child, const char *locator,
sc = device_get_softc(bus);
hub = sc->sc_udev->hub;
mtx_lock(&Giant);
bus_topo_lock();
uhub_find_iface_index(hub, child, &res);
if (!res.udev) {
printf("device not on hub\n");
@ -1695,7 +1695,7 @@ uhub_get_device_path(device_t bus, device_t child, const char *locator,
}
sbuf_printf(sb, "/USB(0x%x,0x%x)", res.portno - 1, res.iface_index);
done:
mtx_unlock(&Giant);
bus_topo_unlock();
return (0);
}
@ -1718,7 +1718,7 @@ uhub_child_pnpinfo(device_t parent, device_t child, struct sbuf*sb)
sc = device_get_softc(parent);
hub = sc->sc_udev->hub;
mtx_lock(&Giant);
bus_topo_lock();
uhub_find_iface_index(hub, child, &res);
if (!res.udev) {
DPRINTF("device not on hub\n");
@ -1755,7 +1755,7 @@ uhub_child_pnpinfo(device_t parent, device_t child, struct sbuf*sb)
usbd_ctrl_unlock(res.udev);
}
done:
mtx_unlock(&Giant);
bus_topo_unlock();
return (0);
}

View File

@ -526,9 +526,9 @@ acpi_uhub_read_ivar(device_t dev, device_t child, int idx, uintptr_t *res)
struct acpi_uhub_softc *sc = device_get_softc(dev);
ACPI_HANDLE ah;
mtx_lock(&Giant);
bus_topo_lock();
uhub_find_iface_index(sc->usc.sc_udev->hub, child, &hres);
mtx_unlock(&Giant);
bus_topo_unlock();
if ((idx == ACPI_IVAR_HANDLE) &&
(hres.portno > 0) &&