]> Pileus Git - ~andy/linux/blobdiff - sound/firewire/dice.c
ALSA: firewire: introduce amdtp_out_stream_running()
[~andy/linux] / sound / firewire / dice.c
index ef04089bde7f88c4a915ef3320fee56f0d0ba4ba..3591aebd1bb71a9424e39ea20aa9673e8e94b47b 100644 (file)
@@ -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)