ALSA: Make pcm.h self-contained
Move the macros depending on snd_mask_min() and co out of pcm.h into pcm_params.h. Otherwise using some params_*() macros will give comiple errors without inclusion of pcm_params.h. Also use hw_param_interval_c() and hw_param_mask_c() for const pointer. Reported-by: Tim Blechmann <tim@klingt.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
					parent
					
						
							
								4d7fbdbcb1
							
						
					
				
			
			
				commit
				
					
						b51beb756a
					
				
			
		
					 2 changed files with 27 additions and 12 deletions
				
			
		| 
						 | 
					@ -761,17 +761,18 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc
 | 
				
			||||||
	return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
 | 
						return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define params_access(p) ((__force snd_pcm_access_t)snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)))
 | 
					#define params_channels(p) \
 | 
				
			||||||
#define params_format(p) ((__force snd_pcm_format_t)snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)))
 | 
						(hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min)
 | 
				
			||||||
#define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT))
 | 
					#define params_rate(p) \
 | 
				
			||||||
#define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min
 | 
						(hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_RATE)->min)
 | 
				
			||||||
#define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min
 | 
					#define params_period_size(p) \
 | 
				
			||||||
#define params_period_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min
 | 
						(hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min)
 | 
				
			||||||
#define params_period_bytes(p) ((params_period_size(p)*snd_pcm_format_physical_width(params_format(p))*params_channels(p))/8)
 | 
					#define params_periods(p) \
 | 
				
			||||||
#define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min
 | 
						(hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_PERIODS)->min)
 | 
				
			||||||
#define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min
 | 
					#define params_buffer_size(p) \
 | 
				
			||||||
#define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min
 | 
						(hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min)
 | 
				
			||||||
 | 
					#define params_buffer_bytes(p) \
 | 
				
			||||||
 | 
						(hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
 | 
					int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
 | 
				
			||||||
void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
 | 
					void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -337,5 +337,19 @@ static inline unsigned int sub(unsigned int a, unsigned int b)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __SOUND_PCM_PARAMS_H */
 | 
					#define params_access(p) ((__force snd_pcm_access_t)\
 | 
				
			||||||
 | 
							snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_ACCESS)))
 | 
				
			||||||
 | 
					#define params_format(p) ((__force snd_pcm_format_t)\
 | 
				
			||||||
 | 
							snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_FORMAT)))
 | 
				
			||||||
 | 
					#define params_subformat(p) \
 | 
				
			||||||
 | 
						snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_SUBFORMAT))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline unsigned int
 | 
				
			||||||
 | 
					params_period_bytes(const struct snd_pcm_hw_params *p)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return (params_period_size(p) *
 | 
				
			||||||
 | 
							snd_pcm_format_physical_width(params_format(p)) *
 | 
				
			||||||
 | 
							params_channels(p)) / 8;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __SOUND_PCM_PARAMS_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue