summaryrefslogtreecommitdiff
path: root/include/sound/asound.h
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-06-19 00:45:13 +0400
committerJaroslav Kysela <perex@perex.cz>2008-06-19 12:33:02 +0400
commit28bb171169247754bae47bad0609208333e7a34b (patch)
tree842752dbe1a2a63959d2d71fada368a05acd4750 /include/sound/asound.h
parent1301a964cef2759d46b4ce366eeeee1f869731f9 (diff)
downloadlinux-28bb171169247754bae47bad0609208333e7a34b.tar.xz
alsa: add annotations to bitwise type snd_pcm_hw_param_t
Fully half of all alsa sparse warnings are from snd_pcm_hw_param_t degrading to integer type, this goes a long way towards eliminating them. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound/asound.h')
-rw-r--r--include/sound/asound.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 3eaf155b850d..0309da2f11d3 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -302,6 +302,8 @@ typedef int __bitwise snd_pcm_hw_param_t;
#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */
#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
+#define SNDRV_PCM_HW_PARAM_MASK_INDEX(var) \
+ ((__force int)(var) - (__force int)SNDRV_PCM_HW_PARAM_FIRST_MASK)
#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */
#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */
@@ -317,6 +319,8 @@ typedef int __bitwise snd_pcm_hw_param_t;
#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */
#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
+#define SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var) \
+ ((__force int)(var) - (__force int)SNDRV_PCM_HW_PARAM_FIRST_INTERVAL)
#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
@@ -336,11 +340,11 @@ struct snd_mask {
struct snd_pcm_hw_params {
unsigned int flags;
- struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
- SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
+ struct snd_mask masks[
+ SNDRV_PCM_HW_PARAM_MASK_INDEX(SNDRV_PCM_HW_PARAM_LAST_MASK) + 1];
struct snd_mask mres[5]; /* reserved masks */
- struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
- SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
+ struct snd_interval intervals[
+ SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(SNDRV_PCM_HW_PARAM_LAST_INTERVAL) + 1];
struct snd_interval ires[9]; /* reserved intervals */
unsigned int rmask; /* W: requested masks */
unsigned int cmask; /* R: changed masks */