Module Name: src
Committed By: pgoyette
Date: Sat Jun 4 03:31:10 UTC 2022
Modified Files:
src/sys/dev: files.audio files.dev midi.c sequencer.c
src/sys/modules: Makefile
src/sys/modules/midi: Makefile
src/sys/modules/sequencer: Makefile
Added Files:
src/sys/dev: midi_mod.c midi_seq_mod.c sequencer_mod.c
src/sys/modules/midi_seq: Makefile midi_seq.ioconf
Removed Files:
src/sys/modules/midi: midi.ioconf
src/sys/modules/sequencer: sequencer.ioconf
Log Message:
Combine the midi and sequencer modules into a single midi_seq module
to avoid a circular dependency as noted in kern/56772. Retain minimal
modules of the original names to accomodate auto-loading upon access
to the /dev/xxx nodes.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/files.audio
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/files.dev
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/midi.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/midi_mod.c src/sys/dev/midi_seq_mod.c \
src/sys/dev/sequencer_mod.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/sequencer.c
cvs rdiff -u -r1.265 -r1.266 src/sys/modules/Makefile
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/midi/Makefile
cvs rdiff -u -r1.1 -r0 src/sys/modules/midi/midi.ioconf
cvs rdiff -u -r0 -r1.1 src/sys/modules/midi_seq/Makefile \
src/sys/modules/midi_seq/midi_seq.ioconf
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/sequencer/Makefile
cvs rdiff -u -r1.1 -r0 src/sys/modules/sequencer/sequencer.ioconf
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/files.audio
diff -u src/sys/dev/files.audio:1.14 src/sys/dev/files.audio:1.15
--- src/sys/dev/files.audio:1.14 Sat Jan 25 19:22:05 2020
+++ src/sys/dev/files.audio Sat Jun 4 03:31:10 2022
@@ -1,4 +1,4 @@
-# $NetBSD: files.audio,v 1.14 2020/01/25 19:22:05 jmcneill Exp $
+# $NetBSD: files.audio,v 1.15 2022/06/04 03:31:10 pgoyette Exp $
defparam opt_audio.h AUDIO_BLK_MS
@@ -23,7 +23,11 @@ file dev/audio/linear.c audio
file dev/audio/audio.c audio needs-flag
file dev/audio/audiobell.c spkr_audio needs-flag
file dev/audio/mulaw.c audio
-file dev/midi.c midi needs-flag
+file dev/midi.c midi | sequencer needs-flag
+file dev/midi_mod.c midi | sequencer needs-flag
+file dev/midi_seq_mod.c midi | sequencer needs-flag
file dev/midictl.c midisyn
file dev/midisyn.c midisyn
+file dev/sequencer.c midi | sequencer needs-flag
+file dev/sequencer_mod.c midi | sequencer needs-flag
file dev/spkr_audio.c spkr_audio needs-flag
Index: src/sys/dev/files.dev
diff -u src/sys/dev/files.dev:1.8 src/sys/dev/files.dev:1.9
--- src/sys/dev/files.dev:1.8 Sun Oct 10 13:03:09 2021
+++ src/sys/dev/files.dev Sat Jun 4 03:31:10 2022
@@ -1,4 +1,4 @@
-# $NetBSD: files.dev,v 1.8 2021/10/10 13:03:09 jmcneill Exp $
+# $NetBSD: files.dev,v 1.9 2022/06/04 03:31:10 pgoyette Exp $
file dev/bio.c bio needs-flag
file dev/ccd.c ccd
@@ -22,7 +22,6 @@ file dev/mm.c kern # XXX
file dev/nullcons_subr.c nullcons needs-flag
file dev/radio.c radio needs-flag
file dev/random.c rnd needs-flag
-file dev/sequencer.c sequencer needs-flag
file dev/video.c video needs-flag
file dev/vnd.c vnd
file dev/ipmi.c ipmi needs-flag
Index: src/sys/dev/midi.c
diff -u src/sys/dev/midi.c:1.97 src/sys/dev/midi.c:1.98
--- src/sys/dev/midi.c:1.97 Sun May 22 11:27:35 2022
+++ src/sys/dev/midi.c Sat Jun 4 03:31:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: midi.c,v 1.97 2022/05/22 11:27:35 andvar Exp $ */
+/* $NetBSD: midi.c,v 1.98 2022/06/04 03:31:10 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -31,11 +31,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.97 2022/05/22 11:27:35 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.98 2022/06/04 03:31:10 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "midi.h"
-#include "sequencer.h"
#endif
#include <sys/param.h>
@@ -1900,45 +1899,3 @@ midi_attach_mi(const struct midi_hw_if *
}
#endif /* NMIDI > 0 || NMIDIBUS > 0 */
-
-#ifdef _MODULE
-#include "ioconf.c"
-
-devmajor_t midi_bmajor = -1, midi_cmajor = -1;
-#endif
-
-MODULE(MODULE_CLASS_DRIVER, midi, "audio");
-
-static int
-midi_modcmd(modcmd_t cmd, void *arg)
-{
- int error = 0;
-
-#ifdef _MODULE
- switch (cmd) {
- case MODULE_CMD_INIT:
- error = devsw_attach(midi_cd.cd_name, NULL, &midi_bmajor,
- &midi_cdevsw, &midi_cmajor);
- if (error)
- break;
-
- error = config_init_component(cfdriver_ioconf_midi,
- cfattach_ioconf_midi, cfdata_ioconf_midi);
- if (error) {
- devsw_detach(NULL, &midi_cdevsw);
- }
- break;
- case MODULE_CMD_FINI:
- error = config_fini_component(cfdriver_ioconf_midi,
- cfattach_ioconf_midi, cfdata_ioconf_midi);
- if (error == 0)
- devsw_detach(NULL, &midi_cdevsw);
- break;
- default:
- error = ENOTTY;
- break;
- }
-#endif
-
- return error;
-}
Index: src/sys/dev/sequencer.c
diff -u src/sys/dev/sequencer.c:1.79 src/sys/dev/sequencer.c:1.80
--- src/sys/dev/sequencer.c:1.79 Sat Apr 16 11:13:10 2022
+++ src/sys/dev/sequencer.c Sat Jun 4 03:31:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: sequencer.c,v 1.79 2022/04/16 11:13:10 riastradh Exp $ */
+/* $NetBSD: sequencer.c,v 1.80 2022/06/04 03:31:10 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,10 +55,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.79 2022/04/16 11:13:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.80 2022/06/04 03:31:10 pgoyette Exp $");
#ifdef _KERNEL_OPT
-#include "sequencer.h"
#include "midi.h"
#endif
@@ -76,7 +75,6 @@ __KERNEL_RCSID(0, "$NetBSD: sequencer.c,
#include <sys/kernel.h>
#include <sys/kmem.h>
#include <sys/midiio.h>
-#include <sys/module.h>
#include <sys/pcq.h>
#include <sys/poll.h>
#include <sys/proc.h>
@@ -1656,21 +1654,6 @@ midiseq_loadpatch(struct midi_dev *md,
static dev_type_open(midiopen);
static dev_type_close(midiclose);
-const struct cdevsw midi_cdevsw = {
- .d_open = midiopen,
- .d_close = midiclose,
- .d_read = noread,
- .d_write = nowrite,
- .d_ioctl = noioctl,
- .d_stop = nostop,
- .d_tty = notty,
- .d_poll = nopoll,
- .d_mmap = nommap,
- .d_kqfilter = nokqfilter,
- .d_discard = nodiscard,
- .d_flag = D_OTHER | D_MPSAFE
-};
-
/*
* If someone has a sequencer, but no midi devices there will
* be unresolved references, so we provide little stubs.
@@ -1688,8 +1671,6 @@ midiopen(dev_t dev, int flags, int ifmt,
return ENXIO;
}
-struct cfdriver midi_cd;
-
void
midi_getinfo(dev_t dev, struct midi_info *mi)
{
@@ -1709,46 +1690,3 @@ midi_writebytes(int unit, u_char *bf, in
return ENXIO;
}
#endif /* NMIDI == 0 */
-
-#ifdef _MODULE
-#include "ioconf.c"
-
-devmajor_t sequencer_bmajor = -1, sequencer_cmajor = -1;
-#endif
-
-MODULE(MODULE_CLASS_DRIVER, sequencer, "midi");
-
-static int
-sequencer_modcmd(modcmd_t cmd, void *arg)
-{
- int error = 0;
-
-#ifdef _MODULE
- switch (cmd) {
- case MODULE_CMD_INIT:
- error = devsw_attach(sequencer_cd.cd_name,
- NULL, &sequencer_bmajor,
- &sequencer_cdevsw, &sequencer_cmajor);
- if (error)
- break;
-
- error = config_init_component(cfdriver_ioconf_sequencer,
- cfattach_ioconf_sequencer, cfdata_ioconf_sequencer);
- if (error) {
- devsw_detach(NULL, &sequencer_cdevsw);
- }
- break;
- case MODULE_CMD_FINI:
- error = config_fini_component(cfdriver_ioconf_sequencer,
- cfattach_ioconf_sequencer, cfdata_ioconf_sequencer);
- if (error == 0)
- devsw_detach(NULL, &sequencer_cdevsw);
- break;
- default:
- error = ENOTTY;
- break;
- }
-#endif
-
- return error;
-}
Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.265 src/sys/modules/Makefile:1.266
--- src/sys/modules/Makefile:1.265 Thu Apr 14 16:50:26 2022
+++ src/sys/modules/Makefile Sat Jun 4 03:31:10 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.265 2022/04/14 16:50:26 pgoyette Exp $
+# $NetBSD: Makefile,v 1.266 2022/06/04 03:31:10 pgoyette Exp $
.include <bsd.own.mk>
@@ -115,6 +115,7 @@ SUBDIR+= luasystm
SUBDIR+= luapmf
SUBDIR+= mfs
SUBDIR+= midi
+SUBDIR+= midi_seq
SUBDIR+= miiverbose
SUBDIR+= miniroot
SUBDIR+= mqueue
Index: src/sys/modules/midi/Makefile
diff -u src/sys/modules/midi/Makefile:1.2 src/sys/modules/midi/Makefile:1.3
--- src/sys/modules/midi/Makefile:1.2 Sun Feb 17 04:05:54 2019
+++ src/sys/modules/midi/Makefile Sat Jun 4 03:31:10 2022
@@ -1,20 +1,12 @@
-# $NetBSD: Makefile,v 1.2 2019/02/17 04:05:54 rin Exp $
+# $NetBSD: Makefile,v 1.3 2022/06/04 03:31:10 pgoyette Exp $ */
.include "../Makefile.inc"
.PATH: ${S}/dev
KMOD= midi
-IOCONF= midi.ioconf
-SRCS= midi.c \
- midictl.c \
- midisyn.c
+SRCS= midi_mod.c
CPPFLAGS+= -DNMIDI=1 -DNSEQUENCER=1
-# Rather than our usual WARNS=5, we need to use 3, since there are a
-# lot of signed-vs-unsigned compares
-
-WARNS= 3
-
.include <bsd.kmodule.mk>
Index: src/sys/modules/sequencer/Makefile
diff -u src/sys/modules/sequencer/Makefile:1.2 src/sys/modules/sequencer/Makefile:1.3
--- src/sys/modules/sequencer/Makefile:1.2 Sun Feb 17 04:05:57 2019
+++ src/sys/modules/sequencer/Makefile Sat Jun 4 03:31:10 2022
@@ -1,18 +1,12 @@
-# $NetBSD: Makefile,v 1.2 2019/02/17 04:05:57 rin Exp $
+# $NetBSD: Makefile,v 1.3 2022/06/04 03:31:10 pgoyette Exp $
.include "../Makefile.inc"
.PATH: ${S}/dev
KMOD= sequencer
-IOCONF= sequencer.ioconf
-SRCS= sequencer.c
+SRCS= sequencer_mod.c
CPPFLAGS+= -DNSEQUENCER=1 -DNMIDI=1
-# Rather than our usual WARNS=5, we need to use 3, since there are a
-# lot of signed-vs-unsigned compares
-
-WARNS= 3
-
.include <bsd.kmodule.mk>
Added files:
Index: src/sys/dev/midi_mod.c
diff -u /dev/null src/sys/dev/midi_mod.c:1.1
--- /dev/null Sat Jun 4 03:31:11 2022
+++ src/sys/dev/midi_mod.c Sat Jun 4 03:31:10 2022
@@ -0,0 +1,63 @@
+/* $NetBSD: midi_mod.c,v 1.1 2022/06/04 03:31:10 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: midi_mod.c,v 1.1 2022/06/04 03:31:10 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+/*
+ * The midi module itself doesn't do anything. It exists only to
+ * ensure that the combo-module for midi-plus-sequencer is loaded.
+ * This allows us to have both midi and sequencer code to refer
+ * to each other, avoiding a circular module dependency.
+ */
+
+MODULE(MODULE_CLASS_DRIVER, midi, "midi_seq");
+
+static int
+midi_modcmd(modcmd_t cmd, void *arg)
+{
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ case MODULE_CMD_FINI:
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
Index: src/sys/dev/midi_seq_mod.c
diff -u /dev/null src/sys/dev/midi_seq_mod.c:1.1
--- /dev/null Sat Jun 4 03:31:11 2022
+++ src/sys/dev/midi_seq_mod.c Sat Jun 4 03:31:10 2022
@@ -0,0 +1,123 @@
+/* $NetBSD: midi_seq_mod.c,v 1.1 2022/06/04 03:31:10 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson ([email protected]), (MIDI FST and Active
+ * Sense handling) Chapman Flack ([email protected]), and Andrew Doran.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: midi_seq_mod.c,v 1.1 2022/06/04 03:31:10 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "midi.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/fcntl.h>
+#include <sys/vnode.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/callout.h>
+#include <sys/syslog.h>
+#include <sys/kernel.h>
+#include <sys/signalvar.h>
+#include <sys/conf.h>
+#include <sys/audioio.h>
+#include <sys/midiio.h>
+#include <sys/device.h>
+#include <sys/intr.h>
+#include <sys/module.h>
+
+#include <dev/audio/audio_if.h>
+#include <dev/midi_if.h>
+#include <dev/midivar.h>
+
+#include "ioconf.h"
+
+extern struct cfdriver sequencer_cd;
+extern struct cdevsw midi_cdevsw;
+extern struct cdevsw sequencer_cdevsw;
+
+#ifdef _MODULE
+#include "ioconf.c"
+
+CFDRIVER_DECL(sequencer, DV_DULL, NULL);
+
+devmajor_t midi_bmajor = -1, midi_cmajor = -1;
+devmajor_t sequencer_bmajor = -1, sequencer_cmajor = -1;
+#endif
+
+MODULE(MODULE_CLASS_DRIVER, midi_seq, "audio");
+
+static int
+midi_seq_modcmd(modcmd_t cmd, void *arg)
+{
+ int error = 0;
+
+#ifdef _MODULE
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = devsw_attach(midi_cd.cd_name, NULL, &midi_bmajor,
+ &midi_cdevsw, &midi_cmajor);
+ if (error)
+ break;
+
+ error = devsw_attach(sequencer_cd.cd_name,
+ NULL, &sequencer_bmajor,
+ &sequencer_cdevsw, &sequencer_cmajor);
+ if (error) {
+ devsw_detach(NULL, &midi_cdevsw);
+ break;
+ }
+
+ error = config_init_component(cfdriver_ioconf_midi_seq,
+ cfattach_ioconf_midi_seq, cfdata_ioconf_midi_seq);
+ if (error) {
+ devsw_detach(NULL, &sequencer_cdevsw);
+ devsw_detach(NULL, &midi_cdevsw);
+ }
+ break;
+ case MODULE_CMD_FINI:
+ error = config_fini_component(cfdriver_ioconf_midi_seq,
+ cfattach_ioconf_midi_seq, cfdata_ioconf_midi_seq);
+ if (error == 0) {
+ devsw_detach(NULL, &sequencer_cdevsw);
+ devsw_detach(NULL, &midi_cdevsw);
+ }
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
+#endif
+
+ return error;
+}
Index: src/sys/dev/sequencer_mod.c
diff -u /dev/null src/sys/dev/sequencer_mod.c:1.1
--- /dev/null Sat Jun 4 03:31:11 2022
+++ src/sys/dev/sequencer_mod.c Sat Jun 4 03:31:10 2022
@@ -0,0 +1,63 @@
+/* $NetBSD: sequencer_mod.c,v 1.1 2022/06/04 03:31:10 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: sequencer_mod.c,v 1.1 2022/06/04 03:31:10 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+/*
+ * The sequencer module itself doesn't do anything. It exists only to
+ * ensure that the combo-module for midi-plus-sequencer is loaded. This
+ * allows us to have both midi and sequencer code to refer to each other,
+ * avoiding a circular module dependency.
+ */
+
+MODULE(MODULE_CLASS_DRIVER, sequencer, "midi_seq");
+
+static int
+sequencer_modcmd(modcmd_t cmd, void *arg)
+{
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ case MODULE_CMD_FINI:
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
Index: src/sys/modules/midi_seq/Makefile
diff -u /dev/null src/sys/modules/midi_seq/Makefile:1.1
--- /dev/null Sat Jun 4 03:31:11 2022
+++ src/sys/modules/midi_seq/Makefile Sat Jun 4 03:31:10 2022
@@ -0,0 +1,23 @@
+# $NetBSD: Makefile,v 1.1 2022/06/04 03:31:10 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/dev
+
+KMOD= midi_seq
+IOCONF= midi_seq.ioconf
+
+SRCS= midi_seq_mod.c
+SRCS+= midi.c \
+ midictl.c \
+ midisyn.c
+SRCS+= sequencer.c
+
+CPPFLAGS+= -DNMIDI=1 -DNSEQUENCER=1
+
+# Rather than our usual WARNS=5, we need to use 3, since there are a
+# lot of signed-vs-unsigned compares
+
+WARNS= 3
+
+.include <bsd.kmodule.mk>
Index: src/sys/modules/midi_seq/midi_seq.ioconf
diff -u /dev/null src/sys/modules/midi_seq/midi_seq.ioconf:1.1
--- /dev/null Sat Jun 4 03:31:11 2022
+++ src/sys/modules/midi_seq/midi_seq.ioconf Sat Jun 4 03:31:10 2022
@@ -0,0 +1,11 @@
+# $NetBSD: midi_seq.ioconf,v 1.1 2022/06/04 03:31:10 pgoyette Exp $
+
+ioconf midi_seq
+
+include "conf/files"
+
+pseudo-root midibus*
+
+midi* at midibus?
+
+pseudo-device sequencer