Include sequencer code conditionally. Fixes build for sparc and sparc64

(and anything else that has a midi but no sequencer).
This commit is contained in:
pgoyette 2022-06-04 20:12:10 +00:00
parent c1b2d682cf
commit a352468a15
2 changed files with 21 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.audio,v 1.15 2022/06/04 03:31:10 pgoyette Exp $
# $NetBSD: files.audio,v 1.16 2022/06/04 20:12:10 pgoyette Exp $
defparam opt_audio.h AUDIO_BLK_MS
@ -28,6 +28,6 @@ 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/sequencer.c sequencer needs-flag
file dev/sequencer_mod.c sequencer needs-flag
file dev/spkr_audio.c spkr_audio needs-flag

View File

@ -1,4 +1,4 @@
/* $NetBSD: midi_seq_mod.c,v 1.1 2022/06/04 03:31:10 pgoyette Exp $ */
/* $NetBSD: midi_seq_mod.c,v 1.2 2022/06/04 20:12:10 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: midi_seq_mod.c,v 1.1 2022/06/04 03:31:10 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: midi_seq_mod.c,v 1.2 2022/06/04 20:12:10 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "midi.h"
@ -85,32 +85,48 @@ midi_seq_modcmd(modcmd_t cmd, void *arg)
#ifdef _MODULE
switch (cmd) {
case MODULE_CMD_INIT:
#if NMIDI > 0
error = devsw_attach(midi_cd.cd_name, NULL, &midi_bmajor,
&midi_cdevsw, &midi_cmajor);
if (error)
break;
#endif
#if NSEQUENCER > 0
error = devsw_attach(sequencer_cd.cd_name,
NULL, &sequencer_bmajor,
&sequencer_cdevsw, &sequencer_cmajor);
if (error) {
#if NMIDI > 0
devsw_detach(NULL, &midi_cdevsw);
#endif
break;
}
#endif
#if NMIDI > 0
error = config_init_component(cfdriver_ioconf_midi_seq,
cfattach_ioconf_midi_seq, cfdata_ioconf_midi_seq);
if (error) {
#if NSEQUENCER > 0
devsw_detach(NULL, &sequencer_cdevsw);
#endif
devsw_detach(NULL, &midi_cdevsw);
#endif
}
break;
case MODULE_CMD_FINI:
#if NMIDI > 0
error = config_fini_component(cfdriver_ioconf_midi_seq,
cfattach_ioconf_midi_seq, cfdata_ioconf_midi_seq);
if (error == 0) {
#endif
#if NSEQUENCER > 0
devsw_detach(NULL, &sequencer_cdevsw);
#endif
#if NMIDI > 0
devsw_detach(NULL, &midi_cdevsw);
#endif
}
break;
default: