git: ffcefe5310e0 - main - sound: Make CHN_REMOVE_SAFE() the default

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 21 Jan 2025 12:03:59 UTC
The branch main has been updated by christos:

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

commit ffcefe5310e084415a2f292a00f4637d4059c40f
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-01-21 12:00:17 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-01-21 12:02:55 +0000

    sound: Make CHN_REMOVE_SAFE() the default
    
    Commit 27b932e32fab ("sound: Safely remove channel from list in one
    pass") optimized CHN_REMOVE_SAFE() to perform almost equally to
    CHN_REMOVE(), so we can turn CHN_REMOVE_SAFE() into CHN_REMOVE() without
    fears of performance regressions, while also being more robust.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    dev_submerge.ch
    Differential Revision:  https://reviews.freebsd.org/D48249
---
 sys/dev/sound/pcm/channel.c | 2 +-
 sys/dev/sound/pcm/channel.h | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 925a82bb170f..4b0ca128391b 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -2291,7 +2291,7 @@ chn_trigger(struct pcm_channel *c, int go)
 		break;
 	case PCMTRIG_STOP:
 	case PCMTRIG_ABORT:
-		CHN_REMOVE_SAFE(d, c, channels.pcm.busy);
+		CHN_REMOVE(d, c, channels.pcm.busy);
 		PCM_UNLOCK(d);
 		break;
 	default:
diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h
index 58fedd284ecb..6eaad8cc2c0b 100644
--- a/sys/dev/sound/pcm/channel.h
+++ b/sys/dev/sound/pcm/channel.h
@@ -189,9 +189,6 @@ struct pcm_channel {
 #define CHN_INSERT_AFTER(x, y, z)					\
 	SLIST_INSERT_AFTER(x, y, CHN_LINK(z))
 
-#define CHN_REMOVE(holder, elm, list)					\
-	SLIST_REMOVE(CHN_HEAD(holder, list), elm, pcm_channel, CHN_LINK(list))
-
 #define CHN_INSERT_HEAD_SAFE(x, y, z)		do {			\
 	struct pcm_channel *t = NULL;					\
 	CHN_FOREACH(t, x, z) {						\
@@ -212,7 +209,7 @@ struct pcm_channel {
 		CHN_INSERT_AFTER(x, y, z);				\
 } while (0)
 
-#define CHN_REMOVE_SAFE(holder, elm, list)	do {			\
+#define CHN_REMOVE(holder, elm, list)		do {			\
 	if (CHN_FIRST(holder, list) == (elm)) {				\
 		SLIST_REMOVE_HEAD(CHN_HEAD(holder, list), CHN_LINK(list)); \
 	} else {							\