summaryrefslogtreecommitdiff
path: root/sound/firewire/bebob/bebob_midi.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-04-25 22:45:20 +0900
committerTakashi Iwai <tiwai@suse.de>2014-05-26 14:31:03 +0200
commit618eabeae711c56d376daa147c6a684116d68705 (patch)
tree5c3aae69f57c84a57437645d40bcd7c0f1b18e67 /sound/firewire/bebob/bebob_midi.c
parentfbbebd2c40795e87f1280ca4d963f7cbe1c83168 (diff)
downloadlinux-next-618eabeae711c56d376daa147c6a684116d68705.tar.gz
ALSA: bebob: Add hwdep interface
This interface is designed for mixer/control application. By using hwdep interface, the application can get information about firewire node, can lock/unlock kernel streaming and can get notification at starting/stopping kernel streaming. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/bebob/bebob_midi.c')
-rw-r--r--sound/firewire/bebob/bebob_midi.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sound/firewire/bebob/bebob_midi.c b/sound/firewire/bebob/bebob_midi.c
index 120a61b90c59..c04cea2c19a6 100644
--- a/sound/firewire/bebob/bebob_midi.c
+++ b/sound/firewire/bebob/bebob_midi.c
@@ -11,17 +11,35 @@
static int midi_capture_open(struct snd_rawmidi_substream *substream)
{
struct snd_bebob *bebob = substream->rmidi->private_data;
+ int err;
+
+ err = snd_bebob_stream_lock_try(bebob);
+ if (err < 0)
+ goto end;
atomic_inc(&bebob->capture_substreams);
- return snd_bebob_stream_start_duplex(bebob, 0);
+ err = snd_bebob_stream_start_duplex(bebob, 0);
+ if (err < 0)
+ snd_bebob_stream_lock_release(bebob);
+end:
+ return err;
}
static int midi_playback_open(struct snd_rawmidi_substream *substream)
{
struct snd_bebob *bebob = substream->rmidi->private_data;
+ int err;
+
+ err = snd_bebob_stream_lock_try(bebob);
+ if (err < 0)
+ goto end;
atomic_inc(&bebob->playback_substreams);
- return snd_bebob_stream_start_duplex(bebob, 0);
+ err = snd_bebob_stream_start_duplex(bebob, 0);
+ if (err < 0)
+ snd_bebob_stream_lock_release(bebob);
+end:
+ return err;
}
static int midi_capture_close(struct snd_rawmidi_substream *substream)
@@ -31,6 +49,7 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream)
atomic_dec(&bebob->capture_substreams);
snd_bebob_stream_stop_duplex(bebob);
+ snd_bebob_stream_lock_release(bebob);
return 0;
}
@@ -41,6 +60,7 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream)
atomic_dec(&bebob->playback_substreams);
snd_bebob_stream_stop_duplex(bebob);
+ snd_bebob_stream_lock_release(bebob);
return 0;
}