[alsa-devel] [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type

Peter Ujfalusi peter.ujfalusi at ti.com
Wed May 9 22:49:34 CEST 2018


Hi,

On 05/06/2018 06:47 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam at nxp.com>
> 
> 'snd_pcm_format_t' type is better suited for iterating through the
> SNDRV_PCM_FORMAT members.
> 
> Also, use SNDRV_PCM_FORMAT_FIRST for the first element.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam at nxp.com>
> ---
>  sound/soc/davinci/davinci-mcasp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
> index 03ba218..bde2252 100644
> --- a/sound/soc/davinci/davinci-mcasp.c
> +++ b/sound/soc/davinci/davinci-mcasp.c
> @@ -1214,11 +1214,12 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params,
>  	struct snd_mask nfmt;
>  	int rate = params_rate(params);
>  	int slots = rd->mcasp->tdm_slots;
> -	int i, count = 0;
> +	snd_pcm_format_t i;
> +	int count = 0;
>  
>  	snd_mask_none(&nfmt);
>  
> -	for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
> +	for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) {
>  		if (snd_mask_test(fmt, i)) {

snd_mask_test(fmt, (__force unsigned int)i)

and the same for the snd_mask_set()

>  			uint sbits = snd_pcm_format_width(i);
>  			int ppm;
> 

Please CC me for davinci patches, I would have missed this patch if Mark did
not CCd me.

-- 
Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


More information about the Alsa-devel mailing list