git: 276e696108a6 - main - sound/midi: Retire M_RXEN

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Thu, 12 Nov 2026 16:38:14 UTC
The branch main has been updated by christos:

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

commit 276e696108a682579f528ece65c695a546ecc63b
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-12 09:50:09 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-12 16:35:49 +0000

    sound/midi: Retire M_RXEN
    
    It was always set and cleared together with M_RX and never tested on its
    own, so it was redundant. The only thing that read it was midi_close()'s
    check for whether the flags had changed, which can be reduced to a plain
    FREAD test.
    
    No functional change intended.
    
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/dev/sound/midi/midi.c | 9 +++------
 sys/dev/sound/midi/midi.h | 5 ++---
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index 03add9adea23..678695349765 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -316,7 +316,7 @@ midi_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
 	m->wchan = 0;
 
 	if (flags & FREAD) {
-		m->flags |= M_RX | M_RXEN;
+		m->flags |= M_RX;
 		/*
 	         * Only clear the inq, the outq might still have data to drain
 	         * from a previous session
@@ -339,7 +339,6 @@ midi_close(struct cdev *i_dev, int flags, int mode, struct thread *td)
 {
 	struct snd_midi *m = i_dev->si_drv1;
 	int retval = 0;
-	int oldflags;
 
 	if (m == NULL)
 		return ENXIO;
@@ -352,14 +351,12 @@ midi_close(struct cdev *i_dev, int flags, int mode, struct thread *td)
 		goto err;
 	}
 
-	oldflags = m->flags;
-
 	if (flags & FREAD)
-		m->flags &= ~(M_RX | M_RXEN);
+		m->flags &= ~M_RX;
 	if (flags & FWRITE)
 		m->flags &= ~M_TX;
 
-	if ((m->flags & (M_TXEN | M_RXEN)) != (oldflags & (M_RXEN | M_TXEN)))
+	if (flags & FREAD)
 		MPU_CALLBACK(m, m->cookie, m->flags);
 
 err:
diff --git a/sys/dev/sound/midi/midi.h b/sys/dev/sound/midi/midi.h
index c012a9d96da6..10e2b4382ccd 100644
--- a/sys/dev/sound/midi/midi.h
+++ b/sys/dev/sound/midi/midi.h
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2003 Mathew Kanner
  * All rights reserved.
- * Copyright (c) 2025 The FreeBSD Foundation
+ * Copyright (c) 2025-2026 The FreeBSD Foundation
  *
  * Portions of this software were developed by Christos Margiolis
  * <christos@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
@@ -40,8 +40,7 @@ MALLOC_DECLARE(M_MIDI);
 
 #define M_RX		0x01
 #define M_TX		0x02
-#define M_RXEN		0x04
-#define M_TXEN		0x08
+#define M_TXEN		0x04
 
 struct snd_midi;