git: 839da868a5f9 - stable/15 - sound: Merge PCM_ALIVE() with PCM_REGISTERED()

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Fri, 28 Nov 2025 14:35:29 UTC
The branch stable/15 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=839da868a5f9eb8bddd20d44f1cd0f293c5685cd

commit 839da868a5f9eb8bddd20d44f1cd0f293c5685cd
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-11-21 16:14:24 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-11-28 14:34:41 +0000

    sound: Merge PCM_ALIVE() with PCM_REGISTERED()
    
    PCM_ALIVE() is used only in pcm_unregister(), but it does not hurt to
    use PCM_REGISTERED(), which uses PCM_ALIVE() internally. In fact, it's
    more robust this way.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    
    (cherry picked from commit 3107b952f534813846e4f58afdb57624a81618d8)
---
 sys/dev/sound/pcm/sound.c | 2 +-
 sys/dev/sound/pcm/sound.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index cb510d526fa8..60236eb4c69c 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -467,7 +467,7 @@ pcm_unregister(device_t dev)
 
 	d = device_get_softc(dev);
 
-	if (!PCM_ALIVE(d)) {
+	if (!PCM_REGISTERED(d)) {
 		device_printf(dev, "unregister: device not configured\n");
 		return (0);
 	}
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index 8542a96ccb14..c03ac2c8ee58 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -133,8 +133,8 @@ struct snd_mixer;
 				"\015PVCHANS"				\
 				"\016RVCHANS"
 
-#define PCM_ALIVE(x)		((x) != NULL && (x)->lock != NULL)
-#define PCM_REGISTERED(x)	(PCM_ALIVE(x) && ((x)->flags & SD_F_REGISTERED))
+#define PCM_REGISTERED(x)	\
+	((x) != NULL && (x)->lock != NULL && ((x)->flags & SD_F_REGISTERED))
 
 #define	PCM_MAXCHANS		10000
 #define	PCM_CHANCOUNT(d)	\