summaryrefslogtreecommitdiffstats
path: root/sound/firewire/amdtp.c
diff options
context:
space:
mode:
authorClemens Ladisch2011-09-04 22:15:44 +0200
committerClemens Ladisch2013-10-20 22:07:57 +0200
commit20b65dd040ce38e2bc0fa3cae13b954c865b61fe (patch)
tree27b8ae49b43b2b6b4e6635128936ebfcfd20d75c /sound/firewire/amdtp.c
parentALSA: dice: clear device lock when closing hwdep device (diff)
downloadkernel-qcow2-linux-20b65dd040ce38e2bc0fa3cae13b954c865b61fe.tar.gz
kernel-qcow2-linux-20b65dd040ce38e2bc0fa3cae13b954c865b61fe.tar.xz
kernel-qcow2-linux-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/amdtp.c')
-rw-r--r--sound/firewire/amdtp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c
index efb2e2947ce7..d56b8e736b7d 100644
--- a/sound/firewire/amdtp.c
+++ b/sound/firewire/amdtp.c
@@ -59,7 +59,7 @@ EXPORT_SYMBOL(amdtp_out_stream_init);
*/
void amdtp_out_stream_destroy(struct amdtp_out_stream *s)
{
- WARN_ON(!IS_ERR(s->context));
+ WARN_ON(amdtp_out_stream_running(s));
mutex_destroy(&s->mutex);
fw_unit_put(s->unit);
}
@@ -89,7 +89,7 @@ void amdtp_out_stream_set_rate(struct amdtp_out_stream *s, unsigned int rate)
};
unsigned int sfc;
- if (WARN_ON(!IS_ERR(s->context)))
+ if (WARN_ON(amdtp_out_stream_running(s)))
return;
for (sfc = 0; sfc < ARRAY_SIZE(rate_info); ++sfc)
@@ -145,7 +145,7 @@ static void amdtp_write_s32(struct amdtp_out_stream *s,
void amdtp_out_stream_set_pcm_format(struct amdtp_out_stream *s,
snd_pcm_format_t format)
{
- if (WARN_ON(!IS_ERR(s->context)))
+ if (WARN_ON(amdtp_out_stream_running(s)))
return;
switch (format) {
@@ -481,7 +481,7 @@ int amdtp_out_stream_start(struct amdtp_out_stream *s, int channel, int speed)
mutex_lock(&s->mutex);
- if (WARN_ON(!IS_ERR(s->context) ||
+ if (WARN_ON(amdtp_out_stream_running(s) ||
(!s->pcm_channels && !s->midi_ports))) {
err = -EBADFD;
goto err_unlock;
@@ -577,7 +577,7 @@ void amdtp_out_stream_stop(struct amdtp_out_stream *s)
{
mutex_lock(&s->mutex);
- if (IS_ERR(s->context)) {
+ if (!amdtp_out_stream_running(s)) {
mutex_unlock(&s->mutex);
return;
}