diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2011-09-04 22:15:44 +0200 |
---|---|---|
committer | Clemens Ladisch <clemens@ladisch.de> | 2013-10-20 22:07:57 +0200 |
commit | 20b65dd040ce38e2bc0fa3cae13b954c865b61fe (patch) | |
tree | 27b8ae49b43b2b6b4e6635128936ebfcfd20d75c /sound/firewire/dice.c | |
parent | 9dd81e3143b57d1bf7e8377ab29b86090baa55a8 (diff) | |
download | blackbird-op-linux-20b65dd040ce38e2bc0fa3cae13b954c865b61fe.tar.gz blackbird-op-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/dice.c')
-rw-r--r-- | sound/firewire/dice.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c index ef04089bde7f..3591aebd1bb7 100644 --- a/sound/firewire/dice.c +++ b/sound/firewire/dice.c @@ -246,7 +246,6 @@ struct dice { int dev_lock_count; /* > 0 driver, < 0 userspace */ bool dev_lock_changed; bool global_enabled; - bool stream_running; wait_queue_head_t hwdep_wait; u32 notification_bits; struct snd_pcm_substream *pcm; @@ -654,7 +653,7 @@ static int dice_stream_start_packets(struct dice *dice) { int err; - if (dice->stream_running) + if (amdtp_out_stream_running(&dice->stream)) return 0; err = amdtp_out_stream_start(&dice->stream, dice->resources.channel, @@ -668,8 +667,6 @@ static int dice_stream_start_packets(struct dice *dice) return err; } - dice->stream_running = true; - return 0; } @@ -712,14 +709,10 @@ error: static void dice_stream_stop_packets(struct dice *dice) { - if (!dice->stream_running) - return; - - dice_enable_clear(dice); - - amdtp_out_stream_stop(&dice->stream); - - dice->stream_running = false; + if (amdtp_out_stream_running(&dice->stream)) { + dice_enable_clear(dice); + amdtp_out_stream_stop(&dice->stream); + } } static void dice_stream_stop(struct dice *dice) |