oxfw-midi.c (05588d340a128ff5c7b768c517150e31842a78aa) | oxfw-midi.c (8985f4ac1c42bd25799f294f4e87fa73064673c7) |
---|---|
1/* 2 * oxfw_midi.c - a part of driver for OXFW970/971 based devices 3 * 4 * Copyright (c) 2014 Takashi Sakamoto 5 * 6 * Licensed under the terms of the GNU General Public License, version 2. 7 */ 8 9#include "oxfw.h" 10 11static int midi_capture_open(struct snd_rawmidi_substream *substream) 12{ 13 struct snd_oxfw *oxfw = substream->rmidi->private_data; 14 int err; 15 | 1/* 2 * oxfw_midi.c - a part of driver for OXFW970/971 based devices 3 * 4 * Copyright (c) 2014 Takashi Sakamoto 5 * 6 * Licensed under the terms of the GNU General Public License, version 2. 7 */ 8 9#include "oxfw.h" 10 11static int midi_capture_open(struct snd_rawmidi_substream *substream) 12{ 13 struct snd_oxfw *oxfw = substream->rmidi->private_data; 14 int err; 15 |
16 err = snd_oxfw_stream_lock_try(oxfw); 17 if (err < 0) 18 return err; 19 |
|
16 mutex_lock(&oxfw->mutex); 17 18 oxfw->capture_substreams++; 19 err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->tx_stream, 0, 0); 20 21 mutex_unlock(&oxfw->mutex); 22 | 20 mutex_lock(&oxfw->mutex); 21 22 oxfw->capture_substreams++; 23 err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->tx_stream, 0, 0); 24 25 mutex_unlock(&oxfw->mutex); 26 |
27 if (err < 0) 28 snd_oxfw_stream_lock_release(oxfw); 29 |
|
23 return err; 24} 25 26static int midi_playback_open(struct snd_rawmidi_substream *substream) 27{ 28 struct snd_oxfw *oxfw = substream->rmidi->private_data; 29 int err; 30 | 30 return err; 31} 32 33static int midi_playback_open(struct snd_rawmidi_substream *substream) 34{ 35 struct snd_oxfw *oxfw = substream->rmidi->private_data; 36 int err; 37 |
38 err = snd_oxfw_stream_lock_try(oxfw); 39 if (err < 0) 40 return err; 41 |
|
31 mutex_lock(&oxfw->mutex); 32 33 oxfw->playback_substreams++; 34 err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->rx_stream, 0, 0); 35 36 mutex_unlock(&oxfw->mutex); 37 | 42 mutex_lock(&oxfw->mutex); 43 44 oxfw->playback_substreams++; 45 err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->rx_stream, 0, 0); 46 47 mutex_unlock(&oxfw->mutex); 48 |
49 if (err < 0) 50 snd_oxfw_stream_lock_release(oxfw); 51 |
|
38 return err; 39} 40 41static int midi_capture_close(struct snd_rawmidi_substream *substream) 42{ 43 struct snd_oxfw *oxfw = substream->rmidi->private_data; 44 45 mutex_lock(&oxfw->mutex); 46 47 oxfw->capture_substreams--; 48 snd_oxfw_stream_stop_simplex(oxfw, &oxfw->tx_stream); 49 50 mutex_unlock(&oxfw->mutex); 51 | 52 return err; 53} 54 55static int midi_capture_close(struct snd_rawmidi_substream *substream) 56{ 57 struct snd_oxfw *oxfw = substream->rmidi->private_data; 58 59 mutex_lock(&oxfw->mutex); 60 61 oxfw->capture_substreams--; 62 snd_oxfw_stream_stop_simplex(oxfw, &oxfw->tx_stream); 63 64 mutex_unlock(&oxfw->mutex); 65 |
66 snd_oxfw_stream_lock_release(oxfw); |
|
52 return 0; 53} 54 55static int midi_playback_close(struct snd_rawmidi_substream *substream) 56{ 57 struct snd_oxfw *oxfw = substream->rmidi->private_data; 58 59 mutex_lock(&oxfw->mutex); 60 61 oxfw->playback_substreams--; 62 snd_oxfw_stream_stop_simplex(oxfw, &oxfw->rx_stream); 63 64 mutex_unlock(&oxfw->mutex); 65 | 67 return 0; 68} 69 70static int midi_playback_close(struct snd_rawmidi_substream *substream) 71{ 72 struct snd_oxfw *oxfw = substream->rmidi->private_data; 73 74 mutex_lock(&oxfw->mutex); 75 76 oxfw->playback_substreams--; 77 snd_oxfw_stream_stop_simplex(oxfw, &oxfw->rx_stream); 78 79 mutex_unlock(&oxfw->mutex); 80 |
81 snd_oxfw_stream_lock_release(oxfw); |
|
66 return 0; 67} 68 69static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up) 70{ 71 struct snd_oxfw *oxfw = substrm->rmidi->private_data; 72 unsigned long flags; 73 --- 118 unchanged lines hidden --- | 82 return 0; 83} 84 85static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up) 86{ 87 struct snd_oxfw *oxfw = substrm->rmidi->private_data; 88 unsigned long flags; 89 --- 118 unchanged lines hidden --- |