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