Page MenuHomeFreeBSD

sound: Remove redundant refcount checks in vchan_setnew()
ClosedPublic

Authored by christos on Oct 23 2024, 9:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 9:21 AM
Unknown Object (File)
Tue, Nov 12, 7:39 PM
Unknown Object (File)
Wed, Nov 6, 4:33 PM
Unknown Object (File)
Wed, Nov 6, 4:32 PM
Unknown Object (File)
Wed, Nov 6, 2:35 PM
Unknown Object (File)
Nov 3 2024, 12:54 PM
Unknown Object (File)
Nov 2 2024, 2:05 PM
Unknown Object (File)
Oct 30 2024, 2:10 PM
Subscribers

Details

Summary

When adding a new vchan, we are looking for a parent channel which
either already has vchans (i.e CHN_F_HAS_VCHAN), or does not, but is
also not being used (i.e !CHN_F_BUSY). Since CHN_F_BUSY essentially
tells us if the channel is currently being used or not, there is no need
to check if the channel's refcount is 0 as well.

When removing a vchan, we first check if we have only 1 vchan allocated
that is also being used (so we cannot remove it at the moment), and then
we check if the vchan is not busy and remove it. Again, checking
CHN_F_BUSY is enough.

Sponsored by: The FreeBSD Foundation
MFC after: 2 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable