HomeFreeBSD

sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion

Description

sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion

Before de8c0d15a64fa ("sound: Get rid of snd_clone and use
DEVFS_CDEVPRIV(9)"), sound(4) would create one device for each allocated
channel. The device names would be chosen from dsp_cdevs[], and created
with dsp_unit2name(). Additionally, dsp_cdevs[] was also used to match
these devices names, as well as OSSv4 aliases in dsp_clone().

Since sound(4) does not create separate devices for each channel
anymore, the meaning and use dsp_cdevs[] has changed. Part of it no
longer corresponds to devices at all, but instead is used to create
channel names, and another part is used to match only OSSv4 aliases in
dsp_clone().

To address this confusion, separate dsp_cdevs[] into a dsp_aliases[]
array, and move dsp_unit2name() to pcm/channel.c and rename it to
chn_mkname().

While here, get rid of the SND_DEV_DSPHW_* channel types, and simply use
the existing PCMDIR_* constants as the channel types. There is no need
to duplicate the same meaning twice.

Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D47199

Details

Provenance
christosAuthored on Thu, Oct 24, 11:37 AM
Reviewer
dev_submerge.ch
Differential Revision
D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion
Parents
rGa4111e9dc722: sound: Change PCMDIR_* numbering
Branches
Unknown
Tags
Unknown