summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorEldad Zack <eldad@fogrefinery.com>2013-04-23 01:00:41 +0200
committerTakashi Iwai <tiwai@suse.de>2013-04-29 13:36:15 +0200
commit74c34ca1cc12884703c70d34ed333517d978c2e7 (patch)
tree6d06b76a9fbe829f2427899aa708d682167420c0 /include/sound
parent754813473c1a8b7711802313125f0fafc60141f8 (diff)
ALSA: pcm_format_to_bits strong-typed conversion
Add a function to handle conversion from snd_pcm_format_t to bitwise with proper typing. Change such conversions to use this function and silence sparse warnings. Signed-off-by: Eldad Zack <eldad@fogrefinery.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/pcm.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 1b0c6484e71a..5357ecbecc48 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -1133,4 +1133,10 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
unsigned long private_value,
struct snd_pcm_chmap **info_ret);
+/* Strong-typed conversion of pcm_format to bitwise */
+static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
+{
+ return 1ULL << (__force int) pcm_format;
+}
+
#endif /* __SOUND_PCM_H */