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
This commit is contained in:
parent
828ea49deb
commit
c019a1690b
@ -610,20 +610,20 @@ hidbus_intr_start(device_t child)
|
|||||||
struct hidbus_softc *sc = device_get_softc(bus);
|
struct hidbus_softc *sc = device_get_softc(bus);
|
||||||
struct hidbus_ivars *ivar = device_get_ivars(child);
|
struct hidbus_ivars *ivar = device_get_ivars(child);
|
||||||
struct hidbus_ivars *tlc;
|
struct hidbus_ivars *tlc;
|
||||||
int refcnt = 0;
|
bool refcnted = false;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (sx_xlock_sig(&sc->sx) != 0)
|
if (sx_xlock_sig(&sc->sx) != 0)
|
||||||
return (EINTR);
|
return (EINTR);
|
||||||
CK_STAILQ_FOREACH(tlc, &sc->tlcs, link) {
|
CK_STAILQ_FOREACH(tlc, &sc->tlcs, link) {
|
||||||
refcnt += tlc->refcnt;
|
refcnted |= (tlc->refcnt != 0);
|
||||||
if (tlc == ivar) {
|
if (tlc == ivar) {
|
||||||
mtx_lock(tlc->mtx);
|
mtx_lock(tlc->mtx);
|
||||||
++tlc->refcnt;
|
++tlc->refcnt;
|
||||||
mtx_unlock(tlc->mtx);
|
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);
|
sx_unlock(&sc->sx);
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
@ -636,7 +636,7 @@ hidbus_intr_stop(device_t child)
|
|||||||
struct hidbus_softc *sc = device_get_softc(bus);
|
struct hidbus_softc *sc = device_get_softc(bus);
|
||||||
struct hidbus_ivars *ivar = device_get_ivars(child);
|
struct hidbus_ivars *ivar = device_get_ivars(child);
|
||||||
struct hidbus_ivars *tlc;
|
struct hidbus_ivars *tlc;
|
||||||
bool refcnt = 0;
|
bool refcnted = false;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (sx_xlock_sig(&sc->sx) != 0)
|
if (sx_xlock_sig(&sc->sx) != 0)
|
||||||
@ -648,9 +648,9 @@ hidbus_intr_stop(device_t child)
|
|||||||
--tlc->refcnt;
|
--tlc->refcnt;
|
||||||
mtx_unlock(tlc->mtx);
|
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);
|
sx_unlock(&sc->sx);
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
|
Loading…
Reference in New Issue
Block a user