diff options
Diffstat (limited to 'sys/dev/sound/midi/midi.c')
| -rw-r--r-- | sys/dev/sound/midi/midi.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index b39288675ea6..cca7b93abf5f 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -32,34 +32,29 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/queue.h> +#include <sys/conf.h> +#include <sys/fcntl.h> #include <sys/kernel.h> +#include <sys/kobj.h> #include <sys/lock.h> +#include <sys/module.h> #include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/signalvar.h> -#include <sys/conf.h> +#include <sys/poll.h> +#include <sys/queue.h> #include <sys/selinfo.h> -#include <sys/sysctl.h> -#include <sys/malloc.h> #include <sys/sx.h> -#include <sys/proc.h> -#include <sys/fcntl.h> -#include <sys/types.h> +#include <sys/sysctl.h> #include <sys/uio.h> -#include <sys/poll.h> -#include <sys/sbuf.h> -#include <sys/kobj.h> -#include <sys/module.h> #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_snd.h" #endif #include <dev/sound/midi/midi.h> +#include <dev/sound/midi/midiq.h> + #include "mpu_if.h" -#include <dev/sound/midi/midiq.h> MALLOC_DEFINE(M_MIDI, "midi buffers", "Midi data allocation area"); #define MIDI_NAMELEN 16 @@ -663,21 +658,19 @@ midi_poll(struct cdev *i_dev, int events, struct thread *td) mtx_lock(&m->lock); mtx_lock(&m->qlock); - if (events & (POLLIN | POLLRDNORM)) + if (events & (POLLIN | POLLRDNORM)) { if (!MIDIQ_EMPTY(m->inq)) - events |= events & (POLLIN | POLLRDNORM); - - if (events & (POLLOUT | POLLWRNORM)) - if (MIDIQ_AVAIL(m->outq) < m->hiwat) - events |= events & (POLLOUT | POLLWRNORM); - - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) + revents |= events & (POLLIN | POLLRDNORM); + else selrecord(td, &m->rsel); - - if (events & (POLLOUT | POLLWRNORM)) + } + if (events & (POLLOUT | POLLWRNORM)) { + if (MIDIQ_AVAIL(m->outq) < m->hiwat) + revents |= events & (POLLOUT | POLLWRNORM); + else selrecord(td, &m->wsel); } + mtx_unlock(&m->lock); mtx_unlock(&m->qlock); |
