aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/speakers.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-09-04 22:15:44 +0200
committerClemens Ladisch <clemens@ladisch.de>2013-10-20 22:07:57 +0200
commit20b65dd040ce38e2bc0fa3cae13b954c865b61fe (patch)
tree27b8ae49b43b2b6b4e6635128936ebfcfd20d75c /sound/firewire/speakers.c
parentALSA: dice: clear device lock when closing hwdep device (diff)
downloadlinux-dev-20b65dd040ce38e2bc0fa3cae13b954c865b61fe.tar.xz
linux-dev-20b65dd040ce38e2bc0fa3cae13b954c865b61fe.zip
ALSA: firewire: introduce amdtp_out_stream_running()
Introduce the helper function amdtp_out_stream_running(). This makes many checks in amdtp.c clearer and frees the device drivers from having to track this with a separate variable. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/firewire/speakers.c')
-rw-r--r--sound/firewire/speakers.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c
index 2c6386503940..0ac56304baff 100644
--- a/sound/firewire/speakers.c
+++ b/sound/firewire/speakers.c
@@ -53,7 +53,6 @@ struct fwspk {
struct mutex mutex;
struct cmp_connection connection;
struct amdtp_out_stream stream;
- bool stream_running;
bool mute;
s16 volume[6];
s16 volume_min;
@@ -189,10 +188,9 @@ static int fwspk_close(struct snd_pcm_substream *substream)
static void fwspk_stop_stream(struct fwspk *fwspk)
{
- if (fwspk->stream_running) {
+ if (amdtp_out_stream_running(&fwspk->stream)) {
amdtp_out_stream_stop(&fwspk->stream);
cmp_connection_break(&fwspk->connection);
- fwspk->stream_running = false;
}
}
@@ -286,7 +284,7 @@ static int fwspk_prepare(struct snd_pcm_substream *substream)
if (amdtp_out_streaming_error(&fwspk->stream))
fwspk_stop_stream(fwspk);
- if (!fwspk->stream_running) {
+ if (!amdtp_out_stream_running(&fwspk->stream)) {
err = cmp_connection_establish(&fwspk->connection,
amdtp_out_stream_get_max_payload(&fwspk->stream));
if (err < 0)
@@ -297,8 +295,6 @@ static int fwspk_prepare(struct snd_pcm_substream *substream)
fwspk->connection.speed);
if (err < 0)
goto err_connection;
-
- fwspk->stream_running = true;
}
mutex_unlock(&fwspk->mutex);