aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/amdtp.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-09-04 16:15:44 -0400
committerClemens Ladisch <clemens@ladisch.de>2013-10-20 16:07:57 -0400
commit20b65dd040ce38e2bc0fa3cae13b954c865b61fe (patch)
tree27b8ae49b43b2b6b4e6635128936ebfcfd20d75c /sound/firewire/amdtp.c
parent9dd81e3143b57d1bf7e8377ab29b86090baa55a8 (diff)
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);
59 */ 59 */
60void amdtp_out_stream_destroy(struct amdtp_out_stream *s) 60void amdtp_out_stream_destroy(struct amdtp_out_stream *s)
61{ 61{
62 WARN_ON(!IS_ERR(s->context)); 62 WARN_ON(amdtp_out_stream_running(s));
63 mutex_destroy(&s->mutex); 63 mutex_destroy(&s->mutex);
64 fw_unit_put(s->unit); 64 fw_unit_put(s->unit);
65} 65}
@@ -89,7 +89,7 @@ void amdtp_out_stream_set_rate(struct amdtp_out_stream *s, unsigned int rate)
89 }; 89 };
90 unsigned int sfc; 90 unsigned int sfc;
91 91
92 if (WARN_ON(!IS_ERR(s->context))) 92 if (WARN_ON(amdtp_out_stream_running(s)))
93 return; 93 return;
94 94
95 for (sfc = 0; sfc < ARRAY_SIZE(rate_info); ++sfc) 95 for (sfc = 0; sfc < ARRAY_SIZE(rate_info); ++sfc)
@@ -145,7 +145,7 @@ static void amdtp_write_s32(struct amdtp_out_stream *s,
145void amdtp_out_stream_set_pcm_format(struct amdtp_out_stream *s, 145void amdtp_out_stream_set_pcm_format(struct amdtp_out_stream *s,
146 snd_pcm_format_t format) 146 snd_pcm_format_t format)
147{ 147{
148 if (WARN_ON(!IS_ERR(s->context))) 148 if (WARN_ON(amdtp_out_stream_running(s)))
149 return; 149 return;
150 150
151 switch (format) { 151 switch (format) {
@@ -481,7 +481,7 @@ int amdtp_out_stream_start(struct amdtp_out_stream *s, int channel, int speed)
481 481
482 mutex_lock(&s->mutex); 482 mutex_lock(&s->mutex);
483 483
484 if (WARN_ON(!IS_ERR(s->context) || 484 if (WARN_ON(amdtp_out_stream_running(s) ||
485 (!s->pcm_channels && !s->midi_ports))) { 485 (!s->pcm_channels && !s->midi_ports))) {
486 err = -EBADFD; 486 err = -EBADFD;
487 goto err_unlock; 487 goto err_unlock;
@@ -577,7 +577,7 @@ void amdtp_out_stream_stop(struct amdtp_out_stream *s)
577{ 577{
578 mutex_lock(&s->mutex); 578 mutex_lock(&s->mutex);
579 579
580 if (IS_ERR(s->context)) { 580 if (!amdtp_out_stream_running(s)) {
581 mutex_unlock(&s->mutex); 581 mutex_unlock(&s->mutex);
582 return; 582 return;
583 } 583 }