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

Mark Brown broonie at kernel.org
Wed May 9 10:34:12 CEST 2018


On Sun, May 06, 2018 at 12:47:44PM -0300, 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.

Adding Peter.

> 
> 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)) {
>  			uint sbits = snd_pcm_format_width(i);
>  			int ppm;
> -- 
> 2.7.4
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20180509/dd354a22/attachment.sig>


More information about the Alsa-devel mailing list