The branch main has been updated by christos:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=59d98edae3e1a6fffd292e4393c49862d624f25f

commit 59d98edae3e1a6fffd292e4393c49862d624f25f
Author:     Christos Margiolis <chris...@freebsd.org>
AuthorDate: 2024-05-09 19:08:01 +0000
Commit:     Christos Margiolis <chris...@freebsd.org>
CommitDate: 2024-05-09 19:08:01 +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
---
 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 17a7138519ac..3e95fd0e0ea4 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -708,11 +708,9 @@ sound_oss_sysinfo(oss_sysinfo *si)
 
        struct snddev_info *d;
        struct pcm_channel *c;
-       int j, ncards;
+       int j;
        size_t i;
 
-       ncards = 0;
-
        strlcpy(si->product, si_product, sizeof(si->product));
        strlcpy(si->version, si_version, sizeof(si->version));
        si->versionnum = SOUND_VERSION;
@@ -720,7 +718,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));
@@ -740,7 +738,6 @@ sound_oss_sysinfo(oss_sysinfo *si)
                PCM_LOCK(d);
 
                si->numaudios += PCM_CHANCOUNT(d);
-               ++ncards;
 
                CHN_FOREACH(c, d, channels.pcm) {
                        CHN_UNLOCKASSERT(c);
@@ -771,7 +768,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. */

Reply via email to