diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-12-29 13:41:41 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-12-30 10:41:54 -0500 |
commit | 744c2ad2f98965473880ef85cac2f8a8ca95959f (patch) | |
tree | 7861a2b3fe409a45310f6e4ce32c0932e07d40bd | |
parent | b3a8c862cd33b97c920122248ed9931af546de54 (diff) |
ALSA: pcm: Convert params_* mask helpers to static inline functions
Use static inline functions instead of macros for the remaining params_*()
helpers that have not been converted yet. This is slightly cleaner and
offers better type safety.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/sound/pcm_params.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 15760f5f98ee..bf51f2285c49 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h | |||
@@ -325,12 +325,24 @@ static inline int snd_interval_eq(const struct snd_interval *i1, const struct sn | |||
325 | i1->max == i2->max && i1->openmax == i2->openmax; | 325 | i1->max == i2->max && i1->openmax == i2->openmax; |
326 | } | 326 | } |
327 | 327 | ||
328 | #define params_access(p) ((__force snd_pcm_access_t)\ | 328 | static inline snd_pcm_access_t params_access(const struct snd_pcm_hw_params *p) |
329 | snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_ACCESS))) | 329 | { |
330 | #define params_format(p) ((__force snd_pcm_format_t)\ | 330 | return (__force snd_pcm_access_t)snd_mask_min(hw_param_mask_c(p, |
331 | snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_FORMAT))) | 331 | SNDRV_PCM_HW_PARAM_ACCESS)); |
332 | #define params_subformat(p) \ | 332 | } |
333 | snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) | 333 | |
334 | static inline snd_pcm_format_t params_format(const struct snd_pcm_hw_params *p) | ||
335 | { | ||
336 | return (__force snd_pcm_format_t)snd_mask_min(hw_param_mask_c(p, | ||
337 | SNDRV_PCM_HW_PARAM_FORMAT)); | ||
338 | } | ||
339 | |||
340 | static inline snd_pcm_subformat_t | ||
341 | params_subformat(const struct snd_pcm_hw_params *p) | ||
342 | { | ||
343 | return (__force snd_pcm_subformat_t)snd_mask_min(hw_param_mask_c(p, | ||
344 | SNDRV_PCM_HW_PARAM_SUBFORMAT)); | ||
345 | } | ||
334 | 346 | ||
335 | static inline unsigned int | 347 | static inline unsigned int |
336 | params_period_bytes(const struct snd_pcm_hw_params *p) | 348 | params_period_bytes(const struct snd_pcm_hw_params *p) |