git: d30ca39517c5 - main - sound: Retire pcm_channel->sleeping
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Nov 2026 10:24:31 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=d30ca39517c5d23eb16d544d827a19aacd57a999
commit d30ca39517c5d23eb16d544d827a19aacd57a999
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-18 10:17:54 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-18 10:17:54 +0000
sound: Retire pcm_channel->sleeping
This field and the pause_sbt() in pcm_shutdownchans() are redundant now,
because pcm_shutdownchans() (previously part of pcm_killchans()) is now
only responsible for waking up and stopping the channel, and
destroy_dev() will not return until the threads have returned from their
cdev methods.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D60121
---
sys/dev/sound/pcm/channel.c | 2 --
sys/dev/sound/pcm/channel.h | 2 --
sys/dev/sound/pcm/sound.c | 33 +++++++++------------------------
3 files changed, 9 insertions(+), 28 deletions(-)
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 63e4788d91ee..11aaa59ebd1c 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -342,9 +342,7 @@ chn_sleep(struct pcm_channel *c, int timeout)
if (c->flags & CHN_F_DEAD)
return (EINVAL);
- c->sleeping++;
ret = cv_timedwait_sig(&c->intr_cv, &c->lock, timeout);
- c->sleeping--;
return ((c->flags & CHN_F_DEAD) ? EINVAL : ret);
}
diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h
index 32508dab581d..3e50f2714ee8 100644
--- a/sys/dev/sound/pcm/channel.h
+++ b/sys/dev/sound/pcm/channel.h
@@ -122,8 +122,6 @@ struct pcm_channel {
* lock.
*/
unsigned int inprog;
- /* Incrememnt/decrement around cv_timedwait_sig() in chn_sleep(). */
- unsigned int sleeping;
/**
* Special channel operations should examine @c inprog after acquiring
* lock. If zero, operations may continue. Else, thread should
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index a1595dd448f4..6f2d23aed1e7 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -151,37 +151,22 @@ static void
pcm_shutdownchans(struct snddev_info *d)
{
struct pcm_channel *ch;
- bool again;
PCM_BUSYASSERT(d);
KASSERT(!PCM_REGISTERED(d), ("%s(): still registered", __func__));
- for (;;) {
- again = false;
- /* Make sure all channels are woken up and stopped. */
- CHN_FOREACH(ch, d, channels.pcm) {
- CHN_LOCK(ch);
- chn_shutdown(ch);
- if (ch->inprog == 0 && ch->sleeping == 0 &&
- CHN_STOPPED(ch)) {
- CHN_UNLOCK(ch);
- continue;
- }
- if (ch->direction == PCMDIR_PLAY)
- chn_flush(ch);
- else
- chn_abort(ch);
+ CHN_FOREACH(ch, d, channels.pcm) {
+ CHN_LOCK(ch);
+ chn_shutdown(ch);
+ if (ch->inprog == 0 && CHN_STOPPED(ch)) {
CHN_UNLOCK(ch);
- again = true;
+ continue;
}
- /*
- * Some channels are still active. Sleep for a bit and try
- * again.
- */
- if (again)
- pause_sbt("pcmshutdownchans", mstosbt(5), 0, 0);
+ if (ch->direction == PCMDIR_PLAY)
+ chn_flush(ch);
else
- break;
+ chn_abort(ch);
+ CHN_UNLOCK(ch);
}
}