aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2022-06-23 13:44:25 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2022-07-28 19:28:36 +0000
commitc019a1690b85062729c775e2c820716edf5c37ea (patch)
tree193a3c6e308363ab4782d803fb0a32a6a20d62e6
parent828ea49debe34fddf63cb648b9e57871a34158b6 (diff)
downloadsrc-c019a1690b85062729c775e2c820716edf5c37ea.tar.gz
src-c019a1690b85062729c775e2c820716edf5c37ea.zip
hidbus(4): Align refcount checks for hidbus_intr_start() and hidbus_intr_stop().
No functional change intended. Discussed with: wulf @ MFC after: 1 week Sponsored by: NVIDIA Networking
-rw-r--r--sys/dev/hid/hidbus.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c
index 496bdef05700..92a96b10bdbd 100644
--- a/sys/dev/hid/hidbus.c
+++ b/sys/dev/hid/hidbus.c
@@ -610,20 +610,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);
@@ -636,7 +636,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)
@@ -648,9 +648,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);