From 74c34ca1cc12884703c70d34ed333517d978c2e7 Mon Sep 17 00:00:00 2001 From: Eldad Zack Date: Tue, 23 Apr 2013 01:00:41 +0200 Subject: 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 Signed-off-by: Takashi Iwai --- include/sound/pcm.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/sound/pcm.h') 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 */ -- cgit v1.2.3