X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fdrivers%2Fmpu401%2Fmpu401_uart.c;h=8687ae3c66b8c54bf156e2424c0a9ecf6d8e4c9a;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=b49a45cbf67a09aa9faf39ae75671dd0f7cad1bf;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index b49a45cbf..8687ae3c6 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -183,8 +183,7 @@ static void snd_mpu401_uart_remove_timer (struct snd_mpu401 *mpu, int input) */ -static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, - int ack) +static void snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, int ack) { unsigned long flags; int timeout, ok; @@ -219,11 +218,9 @@ static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, ok = 1; } spin_unlock_irqrestore(&mpu->input_lock, flags); - if (!ok) { + if (! ok) snd_printk("cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)\n", cmd, mpu->port, mpu->read(mpu, MPU401C(mpu)), mpu->read(mpu, MPU401D(mpu))); - return 1; - } - return 0; + // snd_printk("cmd: 0x%x at 0x%lx (status = 0x%x, data = 0x%x)\n", cmd, mpu->port, mpu->read(mpu, MPU401C(mpu)), mpu->read(mpu, MPU401D(mpu))); } /* @@ -238,19 +235,12 @@ static int snd_mpu401_uart_input_open(struct snd_rawmidi_substream *substream) if (mpu->open_input && (err = mpu->open_input(mpu)) < 0) return err; if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) { - if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1)) - goto error_out; - if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1)) - goto error_out; + snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1); + snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1); } mpu->substream_input = substream; set_bit(MPU401_MODE_BIT_INPUT, &mpu->mode); return 0; - -error_out: - if (mpu->open_input && mpu->close_input) - mpu->close_input(mpu); - return -EIO; } static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream) @@ -262,52 +252,39 @@ static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream) if (mpu->open_output && (err = mpu->open_output(mpu)) < 0) return err; if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) { - if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1)) - goto error_out; - if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1)) - goto error_out; + snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1); + snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1); } mpu->substream_output = substream; set_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode); return 0; - -error_out: - if (mpu->open_output && mpu->close_output) - mpu->close_output(mpu); - return -EIO; } static int snd_mpu401_uart_input_close(struct snd_rawmidi_substream *substream) { struct snd_mpu401 *mpu; - int err = 0; 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)) - err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); + snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); if (mpu->close_input) mpu->close_input(mpu); - if (err) - return -EIO; 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); + snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); if (mpu->close_output) mpu->close_output(mpu); - if (err) - return -EIO; return 0; } @@ -339,7 +316,6 @@ static void snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substrea snd_mpu401_uart_remove_timer(mpu, 1); clear_bit(MPU401_MODE_BIT_INPUT_TRIGGER, &mpu->mode); } - } /*