git: b1e9512cba83 - stable/15 - sound: Fix revents in midi_poll()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 28 Nov 2025 14:35:31 UTC
The branch stable/15 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=b1e9512cba837df02879427a77bc3acdc1658dfc
commit b1e9512cba837df02879427a77bc3acdc1658dfc
Author: Nicolas Provost <dev@nicolas-provost.fr>
AuthorDate: 2025-11-24 13:35:08 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-11-28 14:35:00 +0000
sound: Fix revents in midi_poll()
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: christos
Pull Request: https://github.com/freebsd/freebsd-src/pull/1887
(cherry picked from commit 8f8b8e4af91d4e158caf6ba4b728482311bfc7c3)
---
sys/dev/sound/midi/midi.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index e14a28557406..cca7b93abf5f 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -658,21 +658,19 @@ midi_poll(struct cdev *i_dev, int events, struct thread *td)
mtx_lock(&m->lock);
mtx_lock(&m->qlock);
- if (events & (POLLIN | POLLRDNORM))
+ if (events & (POLLIN | POLLRDNORM)) {
if (!MIDIQ_EMPTY(m->inq))
- events |= events & (POLLIN | POLLRDNORM);
-
- if (events & (POLLOUT | POLLWRNORM))
- if (MIDIQ_AVAIL(m->outq) < m->hiwat)
- events |= events & (POLLOUT | POLLWRNORM);
-
- if (revents == 0) {
- if (events & (POLLIN | POLLRDNORM))
+ revents |= events & (POLLIN | POLLRDNORM);
+ else
selrecord(td, &m->rsel);
-
- if (events & (POLLOUT | POLLWRNORM))
+ }
+ if (events & (POLLOUT | POLLWRNORM)) {
+ if (MIDIQ_AVAIL(m->outq) < m->hiwat)
+ revents |= events & (POLLOUT | POLLWRNORM);
+ else
selrecord(td, &m->wsel);
}
+
mtx_unlock(&m->lock);
mtx_unlock(&m->qlock);