Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142083767
D54192.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54192.diff
View Options
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -97,8 +97,6 @@
.d_name = "rmidi",
};
-static int midi_destroy(struct snd_midi *, int);
-
struct unrhdr *dev_unr = NULL;
struct unrhdr *chn_unr = NULL;
@@ -186,21 +184,15 @@
return NULL;
}
-/*
- * midi_uninit does not call MIDI_UNINIT, as since this is the implementors
- * entry point. midi_uninit if fact, does not send any methods. A call to
- * midi_uninit is a defacto promise that you won't manipulate ch anymore
- */
int
midi_uninit(struct snd_midi *m)
{
- int err;
-
- err = EBUSY;
mtx_lock(&m->lock);
if (m->busy) {
- if (!(m->rchan || m->wchan))
- goto err;
+ if (!(m->rchan || m->wchan)) {
+ mtx_unlock(&m->lock);
+ return (EBUSY);
+ }
if (m->rchan) {
wakeup(&m->rchan);
@@ -211,14 +203,17 @@
m->wchan = 0;
}
}
- err = midi_destroy(m, 0);
- if (!err)
- goto exit;
-
-err:
mtx_unlock(&m->lock);
-exit:
- return err;
+ MPU_UNINIT(m, m->cookie);
+ destroy_dev(m->dev);
+ free_unr(dev_unr, m->unit);
+ free_unr(chn_unr, m->channel);
+ free(MIDIQ_BUF(m->inq), M_MIDI);
+ free(MIDIQ_BUF(m->outq), M_MIDI);
+ mtx_destroy(&m->lock);
+ free(m, M_MIDI);
+
+ return (0);
}
#ifdef notdef
@@ -601,30 +596,6 @@
return (revents);
}
-/*
- * Single point of midi destructions.
- */
-static int
-midi_destroy(struct snd_midi *m, int midiuninit)
-{
- mtx_assert(&m->lock, MA_OWNED);
-
- MIDI_DEBUG(3, printf("midi_destroy\n"));
- m->dev->si_drv1 = NULL;
- mtx_unlock(&m->lock); /* XXX */
- destroy_dev(m->dev);
- /* XXX */
- if (midiuninit)
- MPU_UNINIT(m, m->cookie);
- free_unr(dev_unr, m->unit);
- free_unr(chn_unr, m->channel);
- free(MIDIQ_BUF(m->inq), M_MIDI);
- free(MIDIQ_BUF(m->outq), M_MIDI);
- mtx_destroy(&m->lock);
- free(m, M_MIDI);
- return 0;
-}
-
static void
midi_sysinit(void *data __unused)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 16, 9:36 PM (9 m, 51 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27473884
Default Alt Text
D54192.diff (1 KB)
Attached To
Mode
D54192: sound: Merge midi_destroy() with midi_uninit()
Attached
Detach File
Event Timeline
Log In to Comment