From b9c7d41087bc1755e01f9584f0bdbce0bb8b195d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 6 Feb 2020 17:39:39 +0100 Subject: ALSA: pcm: More helper macros for reducing snd_pcm_format_t cast snd_pcm_format_t is a strong-typed integer and requires the explicit cast with __force if converted or compared with a normal integer value. Since most of use cases do iterate over all formats and test / set the mask, provide a couple of new helper macros that do the explicit cast. Link: https://lore.kernel.org/r/20200206163945.6797-3-tiwai@suse.de Signed-off-by: Takashi Iwai --- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/sound/pcm_params.h') diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 661450a2095b..36f94735d23d 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -133,6 +133,13 @@ static inline int snd_mask_test(const struct snd_mask *mask, unsigned int val) return mask->bits[MASK_OFS(val)] & MASK_BIT(val); } +/* Most of drivers need only this one */ +static inline int snd_mask_test_format(const struct snd_mask *mask, + snd_pcm_format_t format) +{ + return snd_mask_test(mask, (__force unsigned int)format); +} + static inline int snd_mask_single(const struct snd_mask *mask) { int i, c = 0; -- cgit v1.2.3