git: 2817d3ac2a0a - stable/13 - hidbus(4): Align refcount checks for hidbus_intr_start() and hidbus_intr_stop().
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 04 Aug 2022 13:18:31 UTC
The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2817d3ac2a0a6163272ae5f30a9dc5705a977c26 commit 2817d3ac2a0a6163272ae5f30a9dc5705a977c26 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-06-23 13:44:25 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-08-04 13:17:56 +0000 hidbus(4): Align refcount checks for hidbus_intr_start() and hidbus_intr_stop(). No functional change intended. Discussed with: wulf @ Sponsored by: NVIDIA Networking (cherry picked from commit c019a1690b85062729c775e2c820716edf5c37ea) --- sys/dev/hid/hidbus.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c index 0de0a9bc1114..8ae7ff4fec9c 100644 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -611,20 +611,20 @@ hidbus_intr_start(device_t child) struct hidbus_softc *sc = device_get_softc(bus); struct hidbus_ivars *ivar = device_get_ivars(child); struct hidbus_ivars *tlc; - int refcnt = 0; + bool refcnted = false; int error; if (sx_xlock_sig(&sc->sx) != 0) return (EINTR); CK_STAILQ_FOREACH(tlc, &sc->tlcs, link) { - refcnt += tlc->refcnt; + refcnted |= (tlc->refcnt != 0); if (tlc == ivar) { mtx_lock(tlc->mtx); ++tlc->refcnt; mtx_unlock(tlc->mtx); } } - error = refcnt != 0 ? 0 : HID_INTR_START(device_get_parent(bus)); + error = refcnted ? 0 : HID_INTR_START(device_get_parent(bus)); sx_unlock(&sc->sx); return (error); @@ -637,7 +637,7 @@ hidbus_intr_stop(device_t child) struct hidbus_softc *sc = device_get_softc(bus); struct hidbus_ivars *ivar = device_get_ivars(child); struct hidbus_ivars *tlc; - bool refcnt = 0; + bool refcnted = false; int error; if (sx_xlock_sig(&sc->sx) != 0) @@ -649,9 +649,9 @@ hidbus_intr_stop(device_t child) --tlc->refcnt; mtx_unlock(tlc->mtx); } - refcnt += tlc->refcnt; + refcnted |= (tlc->refcnt != 0); } - error = refcnt != 0 ? 0 : HID_INTR_STOP(device_get_parent(bus)); + error = refcnted ? 0 : HID_INTR_STOP(device_get_parent(bus)); sx_unlock(&sc->sx); return (error);