git: 7c4c5368aeb8 - main - hidraw(4): Replace Giant with bus_topo_lock

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sat, 24 Dec 2022 09:53:15 UTC
The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=7c4c5368aeb8dde4d53dfd5055e40cc0b42a0899

commit 7c4c5368aeb8dde4d53dfd5055e40cc0b42a0899
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2022-12-24 09:45:41 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-12-24 09:51:13 +0000

    hidraw(4): Replace Giant with bus_topo_lock
---
 sys/dev/hid/hidraw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/dev/hid/hidraw.c b/sys/dev/hid/hidraw.c
index 8964e31f7bba..4ea39dda3837 100644
--- a/sys/dev/hid/hidraw.c
+++ b/sys/dev/hid/hidraw.c
@@ -679,10 +679,9 @@ hidraw_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
 
 		buf = HIDRAW_LOCAL_ALLOC(local_buf, hgd->hgd_maxlen);
 		copyin(hgd->hgd_data, buf, hgd->hgd_maxlen);
-		/* Lock newbus around set_report_descr call */
-		mtx_lock(&Giant);
+		bus_topo_lock();
 		error = hid_set_report_descr(sc->sc_dev, buf, hgd->hgd_maxlen);
-		mtx_unlock(&Giant);
+		bus_topo_unlock();
 		HIDRAW_LOCAL_FREE(local_buf, buf);
 
 		/* Realloc hidraw input queue */