diff options
author | Jaroslav Kysela <perex@perex.cz> | 2008-06-26 08:51:31 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-06-26 08:53:05 +0200 |
commit | eabe3228a80728a21f871ccc86c72c170ca1a2dc (patch) | |
tree | 60bdd85120b507f163471604b14de693a6eb7d2a /include/sound/pcm.h | |
parent | ALSA: hda - Fix digital converter proc output (diff) | |
download | linux-eabe3228a80728a21f871ccc86c72c170ca1a2dc.tar.xz linux-eabe3228a80728a21f871ccc86c72c170ca1a2dc.zip |
[ALSA] Revert "alsa: add annotations to bitwise type snd_pcm_hw_param_t"
This reverts commit 36b34d2437104f323e09d7c6af6451d3c0b9c0cd.
From: Al Viro <viro@ZenIV.linux.org.uk>
WIW, *all* this stuff is not bitwise at all. For crying out loud, half
of these types are routinely used as array indices and loop variables...
If anything, we want a different set of allowed operations - subtraction
between elements of type (yielding integer), addition/subtraction of
integer types not bigger than ours (yielding our type), comparisons,
assignments (=, +=, -=, passing to function as argument, return from
function, initializers) and second/third arguments in ?:. With 0 *not*
being allowed as a constant of such type.
It's not bitwise; we may use the same infrastructure in sparse, but it
should be a separate class of types (__attribute__((affine))).
dma_addr_t is another candidate for the same treatment, but there we'll
need helpers for conversions to hw-acceptable form (dma_to_le32(), etc.)
and gradual conversion of drivers.
ALSA ones and pm mess are absolutely straightforward cases, though.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to '')
-rw-r--r-- | include/sound/pcm.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 5315b53f9b07..51d58ccda2d8 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -209,10 +209,10 @@ struct snd_pcm_hw_rule { }; struct snd_pcm_hw_constraints { - struct snd_mask masks[ - SNDRV_PCM_HW_PARAM_MASK_INDEX(SNDRV_PCM_HW_PARAM_LAST_MASK) + 1]; - struct snd_interval intervals[ - SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(SNDRV_PCM_HW_PARAM_LAST_INTERVAL) + 1]; + struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - + SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; + struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - + SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; unsigned int rules_num; unsigned int rules_all; struct snd_pcm_hw_rule *rules; @@ -221,13 +221,13 @@ struct snd_pcm_hw_constraints { static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs, snd_pcm_hw_param_t var) { - return &constrs->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)]; + return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs, snd_pcm_hw_param_t var) { - return &constrs->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)]; + return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; } struct snd_ratnum { @@ -761,40 +761,40 @@ static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, substream->runtime->trigger_master = master; } -static inline int hw_is_mask(snd_pcm_hw_param_t var) +static inline int hw_is_mask(int var) { - return (__force int)var >= (__force int)SNDRV_PCM_HW_PARAM_FIRST_MASK && - (__force int)var <= (__force int)SNDRV_PCM_HW_PARAM_LAST_MASK; + return var >= SNDRV_PCM_HW_PARAM_FIRST_MASK && + var <= SNDRV_PCM_HW_PARAM_LAST_MASK; } -static inline int hw_is_interval(snd_pcm_hw_param_t var) +static inline int hw_is_interval(int var) { - return (__force int)var >= (__force int)SNDRV_PCM_HW_PARAM_FIRST_INTERVAL && - (__force int)var <= (__force int)SNDRV_PCM_HW_PARAM_LAST_INTERVAL; + return var >= SNDRV_PCM_HW_PARAM_FIRST_INTERVAL && + var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; } static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var) { - return ¶ms->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)]; + return ¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var) { - return ¶ms->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)]; + return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; } static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var) { - return ¶ms->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)]; + return ¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var) { - return ¶ms->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)]; + return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; } #define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) |