diff options
author | tanimura <tanimura@FreeBSD.org> | 2001-02-18 15:58:56 +0000 |
---|---|---|
committer | tanimura <tanimura@FreeBSD.org> | 2001-02-18 15:58:56 +0000 |
commit | 548e16646ad1b2c4238bf0ca29ed5c33e1efff74 (patch) | |
tree | 5bc45e68b007a71e18767b83c5849c71b745ecdb /sys/dev/sound/isa/mpu.c | |
parent | 18d474781ff1acbc67429e2db4fa0cf9a0d3c51e (diff) | |
download | FreeBSD-src-548e16646ad1b2c4238bf0ca29ed5c33e1efff74.zip FreeBSD-src-548e16646ad1b2c4238bf0ca29ed5c33e1efff74.tar.gz |
Encapselate midi_info, nmidi and nsynth into midi.c.
Diffstat (limited to 'sys/dev/sound/isa/mpu.c')
-rw-r--r-- | sys/dev/sound/isa/mpu.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/dev/sound/isa/mpu.c b/sys/dev/sound/isa/mpu.c index 2ed93c1..4adb80d 100644 --- a/sys/dev/sound/isa/mpu.c +++ b/sys/dev/sound/isa/mpu.c @@ -379,7 +379,7 @@ mpu_attach(device_t dev) /* Fill the softc. */ scp->dev = dev; - scp->devinfo = devinfo = &midi_info[unit]; + scp->devinfo = devinfo = create_mididev_info_unit(&unit, MDT_MIDI); callout_handle_init(&scp->dh); /* Fill the midi info. */ @@ -399,9 +399,6 @@ mpu_attach(device_t dev) midibuf_init(&devinfo->midi_dbuf_in); midibuf_init(&devinfo->midi_dbuf_out); - /* Increase the number of midi devices. */ - nmidi++; - /* Now we can handle the interrupts. */ if (scp->irq != NULL) bus_setup_intr(dev, scp->irq, INTR_TYPE_TTY, mpu_intr, scp, @@ -437,11 +434,6 @@ mpu_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) unit = MIDIUNIT(i_dev); - if (unit >= nmidi + nsynth) { - DEB(printf("mpu_ioctl: unit %d does not exist.\n", unit)); - return (ENXIO); - } - devinfo = get_mididev_info(i_dev, &unit); if (devinfo == NULL) { DEB(printf("mpu_ioctl: unit %d is not configured.\n", unit)); @@ -452,7 +444,7 @@ mpu_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) switch (cmd) { case SNDCTL_SYNTH_INFO: synthinfo = (struct synth_info *)arg; - if (synthinfo->device > nmidi + nsynth || synthinfo->device != unit) + if (synthinfo->device != unit) return (ENXIO); bcopy(&mpu_synthinfo, synthinfo, sizeof(mpu_synthinfo)); synthinfo->device = unit; @@ -460,7 +452,7 @@ mpu_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) break; case SNDCTL_MIDI_INFO: midiinfo = (struct midi_info *)arg; - if (midiinfo->device > nmidi + nsynth || midiinfo->device != unit) + if (midiinfo->device != unit) return (ENXIO); bcopy(&mpu_midiinfo, midiinfo, sizeof(mpu_midiinfo)); midiinfo->device = unit; |