diff options
author | Takashi Iwai <tiwai@suse.de> | 2021-02-06 21:36:56 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-02-08 16:01:01 +0100 |
commit | 8d19b4e0b377e226b98f26ded5f0c6463976e4fb (patch) | |
tree | 2018d108a523f8c192748d4181a0aea31192010d /sound/core/pcm_local.h | |
parent | ALSA: pcm: Don't call sync_stop if it hasn't been stopped (diff) | |
download | linux-8d19b4e0b377e226b98f26ded5f0c6463976e4fb.tar.xz linux-8d19b4e0b377e226b98f26ded5f0c6463976e4fb.zip |
ALSA: pcm: Use for_each_pcm_substream() macro
There are a few places doing the same loop iterating all PCM
substreams belonging to the PCM object. Introduce a local helper
macro, for_each_pcm_substream(), to simplify the code.
Link: https://lore.kernel.org/r/20210206203656.15959-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_local.h')
-rw-r--r-- | sound/core/pcm_local.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/core/pcm_local.h b/sound/core/pcm_local.h index b3e8be5aeafb..e3b3558aeab6 100644 --- a/sound/core/pcm_local.h +++ b/sound/core/pcm_local.h @@ -72,4 +72,10 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) +/* loop over all PCM substreams */ +#define for_each_pcm_substream(pcm, str, subs) \ + for ((str) = 0; (str) < 2; (str)++) \ + for ((subs) = (pcm)->streams[str].substream; (subs); \ + (subs) = (subs)->next) + #endif /* __SOUND_CORE_PCM_LOCAL_H */ |