Merge tag 'asoc-v5.7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[linux-block.git] / include / sound / pcm.h
index f7a95b7111007e81f2659fbf29402293bc5127fa..2ba5df2c9e235737726cc14f13d9bffa2c3e6555 100644 (file)
@@ -1427,6 +1427,15 @@ static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
        return 1ULL << (__force int) pcm_format;
 }
 
+/**
+ * pcm_for_each_format - helper to iterate for each format type
+ * @f: the iterator variable in snd_pcm_format_t type
+ */
+#define pcm_for_each_format(f)                                         \
+       for ((f) = SNDRV_PCM_FORMAT_FIRST;                              \
+            (__force int)(f) <= (__force int)SNDRV_PCM_FORMAT_LAST;    \
+            (f) = (__force snd_pcm_format_t)((__force int)(f) + 1))
+
 /* printk helpers */
 #define pcm_err(pcm, fmt, args...) \
        dev_err((pcm)->card->dev, fmt, ##args)