ASoC: sof: sof-audio: use for_each_pcm_streams() macro
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 17 Feb 2020 08:28:47 +0000 (17:28 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 18 Feb 2020 23:37:12 +0000 (23:37 +0000)
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87tv3paa8i.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/sof-audio.c

index 75f2ef2..fc4ed2a 100644 (file)
@@ -23,7 +23,7 @@ bool snd_sof_dsp_only_d0i3_compatible_stream_active(struct snd_sof_dev *sdev)
        int dir;
 
        list_for_each_entry(spcm, &sdev->pcm_list, list) {
-               for (dir = 0; dir <= SNDRV_PCM_STREAM_CAPTURE; dir++) {
+               for_each_pcm_streams(dir) {
                        substream = spcm->stream[dir].substream;
                        if (!substream || !substream->runtime)
                                continue;
@@ -71,7 +71,7 @@ int sof_set_hw_params_upon_resume(struct device *dev)
         * have been suspended.
         */
        list_for_each_entry(spcm, &sdev->pcm_list, list) {
-               for (dir = 0; dir <= SNDRV_PCM_STREAM_CAPTURE; dir++) {
+               for_each_pcm_streams(dir) {
                        /*
                         * do not reset hw_params upon resume for streams that
                         * were kept running during suspend
@@ -319,16 +319,11 @@ struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_soc_component *scomp,
        int dir;
 
        list_for_each_entry(spcm, &sdev->pcm_list, list) {
-               dir = SNDRV_PCM_STREAM_PLAYBACK;
-               if (spcm->stream[dir].comp_id == comp_id) {
-                       *direction = dir;
-                       return spcm;
-               }
-
-               dir = SNDRV_PCM_STREAM_CAPTURE;
-               if (spcm->stream[dir].comp_id == comp_id) {
-                       *direction = dir;
-                       return spcm;
+               for_each_pcm_streams(dir) {
+                       if (spcm->stream[dir].comp_id == comp_id) {
+                               *direction = dir;
+                               return spcm;
+                       }
                }
        }