aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2022-03-17 14:20:51 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2022-03-17 14:27:45 +0000
commit5e203517e0d231e7edfa86bac5d577137896ce45 (patch)
tree796672e82cc0a1590e570817c90294275c0cd7dc
parenta85ff2114ccb751546f81ceb6b6d3244235363a1 (diff)
downloadsrc-5e203517e0d231e7edfa86bac5d577137896ce45.tar.gz
src-5e203517e0d231e7edfa86bac5d577137896ce45.zip
usb(4): Use the global BUS topology lock where appropriate.
MFC after: 1 week Sponsored by: NVIDIA Networking
-rw-r--r--sys/dev/usb/usb_hub.c12
-rw-r--r--sys/dev/usb/usb_hub_acpi.c4
2 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c
index 77e519126567..6cd4cfd37ee4 100644
--- a/sys/dev/usb/usb_hub.c
+++ b/sys/dev/usb/usb_hub.c
@@ -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);
}
diff --git a/sys/dev/usb/usb_hub_acpi.c b/sys/dev/usb/usb_hub_acpi.c
index ec5a457cb810..5a4e73005400 100644
--- a/sys/dev/usb/usb_hub_acpi.c
+++ b/sys/dev/usb/usb_hub_acpi.c
@@ -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) &&