/* The DSP channel can be used either for input or output. Variable 'sb_irq_mode' will be set when the program calls read or write first time after open. Current version doesn't support mode changes without closing and reopening the device. Support for this feature may be implemented in a future version of this driver.  */
static int v_midi_open(int dev, int mode, void(*input)(int dev, unsigned char data), void(*output)(int dev))
/* The DSP channel can be used either for input or output. Variable 'sb_irq_mode' will be set when the program calls read or write first time after open. Current version doesn't support mode changes without closing and reopening the device. Support for this feature may be implemented in a future version of this driver.  */
static int v_midi_open(int dev, int mode, void(*input)(int dev, unsigned char data), void(*output)(int dev))
{
	vmidi_devc *devc = midi_devs[dev]->devc;
	unsigned long flags;
	if (devc == NULL)
		return -(ENXIO);
	spin_lock_irqsave(&devc->lock,flags);
	if (devc->opened)
	{
		spin_unlock_irqrestore(&devc->lock,flags);
		return -(EBUSY);
	}
	devc->opened = 1;
	spin_unlock_irqrestore(&devc->lock,flags);
	devc->intr_active = 1;
	if (mode & OPEN_READ)
	{
		devc->input_opened = 1;
		devc->midi_input_intr = input;
	}
	return 0;
}