/* copy an event to input queue: return zero if enqueued  */
int snd_seq_oss_readq_put_event(struct seq_oss_readq *q, union evrec *ev)
/* copy an event to input queue: return zero if enqueued  */
int snd_seq_oss_readq_put_event(struct seq_oss_readq *q, union evrec *ev)
{
	unsigned long flags;
	spin_lock_irqsave(&q->lock, flags);
	if (q->qlen >= q->maxlen - 1) {
		spin_unlock_irqrestore(&q->lock, flags);
		return -ENOMEM;
	}
	memcpy(&q->q[q->tail], ev, sizeof(*ev));
	q->tail = (q->tail + 1) % q->maxlen;
	q->qlen++;
	if (waitqueue_active(&q->midi_sleep))
		wake_up(&q->midi_sleep);
	spin_unlock_irqrestore(&q->lock, flags);
	return 0;
}