示例#1
0
static int snd_mpu401_uart_input_close(snd_rawmidi_substream_t * substream)
{
    mpu401_t *mpu;

    mpu = substream->rmidi->private_data;
    clear_bit(MPU401_MODE_BIT_INPUT, &mpu->mode);
    mpu->substream_input = NULL;
    if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode))
        snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0);
    if (mpu->close_input)
        mpu->close_input(mpu);
    return 0;
}
static int snd_mpu401_uart_output_close(struct snd_rawmidi_substream *substream)
{
	struct snd_mpu401 *mpu;
	int err = 0;

	mpu = substream->rmidi->private_data;
	clear_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode);
	mpu->substream_output = NULL;
	if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode))
		err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0);
	if (mpu->close_output)
		mpu->close_output(mpu);
	if (err)
		return -EIO;
	return 0;
}