git: 181a31d83490 - main - sound: Move sndstat_register() call to pcm_setstatus()

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Sun, 03 Nov 2024 19:04:09 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=181a31d8349088cbcead8dcbff8d62ee8af6c913

commit 181a31d8349088cbcead8dcbff8d62ee8af6c913
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-11-03 19:02:37 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-11-03 19:02:37 +0000

    sound: Move sndstat_register() call to pcm_setstatus()
    
    The d->status string is populated in pcm_setstatus() anyway, so call
    sndstat_register() after we populate it, and are closer to finalizing
    the device creation.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    dev_submerge.ch, markj
    Differential Revision:  https://reviews.freebsd.org/D47323
---
 sys/dev/sound/pcm/sound.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 5ca38ca622c9..3c4fb38fa4f5 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -293,6 +293,7 @@ pcm_setstatus(device_t dev, char *str)
 	vchan_setmaxauto(d, snd_maxautovchans);
 
 	strlcpy(d->status, str, SND_STATUSLEN);
+	sndstat_register(dev, d->status);
 
 	PCM_LOCK(d);
 
@@ -509,8 +510,6 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
 	if (numplay > 0 || numrec > 0)
 		d->flags |= SD_F_AUTOVCHAN;
 
-	sndstat_register(dev, d->status);
-
 	return (0);
 }