git: a0ff4e0f3e02 - releng/14.1 - sound: Fix oss_sysinfo->numcards
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 May 2024 13:23:15 UTC
The branch releng/14.1 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=a0ff4e0f3e02d31e01844295f216ec87826130de commit a0ff4e0f3e02d31e01844295f216ec87826130de Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2024-05-09 19:08:01 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2024-05-22 13:21:36 +0000 sound: Fix oss_sysinfo->numcards According to the OSS manual, oss_sysinfo->numcards holds the number of detected audio devices in the system, while the current ncards variable, whose value is assigned to oss_sysinfo->numcards, holds the number of currently registered devices only. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dev_submerge.ch, emaste Differential Revision: https://reviews.freebsd.org/D45136 (cherry picked from commit 59d98edae3e1a6fffd292e4393c49862d624f25f) (cherry picked from commit 2b3698288771f6d236212f80b1a259aa86e09fa8) Approved by: re (cperciva) --- sys/dev/sound/pcm/sound.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 2057c7572ad6..78a2312e56eb 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -1107,9 +1107,7 @@ sound_oss_sysinfo(oss_sysinfo *si) struct snddev_info *d; struct pcm_channel *c; - int i, j, ncards; - - ncards = 0; + int i, j; strlcpy(si->product, si_product, sizeof(si->product)); strlcpy(si->version, si_version, sizeof(si->version)); @@ -1118,7 +1116,7 @@ sound_oss_sysinfo(oss_sysinfo *si) /* * Iterate over PCM devices and their channels, gathering up data - * for the numaudios, ncards, and openedaudio fields. + * for the numaudios and openedaudio fields. */ si->numaudios = 0; bzero((void *)&si->openedaudio, sizeof(si->openedaudio)); @@ -1138,7 +1136,6 @@ sound_oss_sysinfo(oss_sysinfo *si) PCM_LOCK(d); si->numaudios += d->devcount; - ++ncards; CHN_FOREACH(c, d, channels.pcm) { CHN_UNLOCKASSERT(c); @@ -1169,7 +1166,7 @@ sound_oss_sysinfo(oss_sysinfo *si) si->nummidis = 0; si->numtimers = 0; si->nummixers = mixer_count; - si->numcards = ncards; + si->numcards = devclass_get_maxunit(pcm_devclass); /* OSSv4 docs: Intended only for test apps; API doesn't really have much of a concept of cards. Shouldn't be used by applications. */