[alsa-devel] [PATCH 1/4] ASoC: fsl-asoc-card: Use 'snd_pcm_format_t' type when appropriate

Fabio Estevam festevam at gmail.com
Sun Feb 11 22:53:18 CET 2018


From: Fabio Estevam <fabio.estevam at nxp.com>

A better suited type for 'sample_format' and 'asrc_format' is
'snd_pcm_format_t'.

Change the type so that the following build warnings with W=1 are gone:

sound/soc/fsl/fsl-asoc-card.c:153:29: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl-asoc-card.c:153:29:    expected unsigned int [unsigned] [usertype] sample_format
sound/soc/fsl/fsl-asoc-card.c:153:29:    got restricted snd_pcm_format_t
sound/soc/fsl/fsl-asoc-card.c:258:44: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl-asoc-card.c:525:29: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl-asoc-card.c:525:29:    expected unsigned int [unsigned] [usertype] sample_format
sound/soc/fsl/fsl-asoc-card.c:525:29:    got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/fsl/fsl-asoc-card.c:680:43: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl-asoc-card.c:680:43:    expected unsigned int [unsigned] [usertype] asrc_format
sound/soc/fsl/fsl-asoc-card.c:680:43:    got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/fsl/fsl-asoc-card.c:682:43: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl-asoc-card.c:682:43:    expected unsigned int [unsigned] [usertype] asrc_format
sound/soc/fsl/fsl-asoc-card.c:682:43:    got restricted snd_pcm_format_t [usertype] <noident>

Signed-off-by: Fabio Estevam <fabio.estevam at nxp.com>
---
 sound/soc/fsl/fsl-asoc-card.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 989be51..4a6750a 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -91,9 +91,9 @@ struct fsl_asoc_card_priv {
 	struct cpu_priv cpu_priv;
 	struct snd_soc_card card;
 	u32 sample_rate;
-	u32 sample_format;
+	snd_pcm_format_t sample_format;
 	u32 asrc_rate;
-	u32 asrc_format;
+	snd_pcm_format_t asrc_format;
 	u32 dai_fmt;
 	char name[32];
 };
@@ -199,7 +199,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 
 	mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
 	snd_mask_none(mask);
-	snd_mask_set(mask, priv->asrc_format);
+	snd_mask_set(mask, (__force int)priv->asrc_format);
 
 	return 0;
 }
-- 
2.7.4



More information about the Alsa-devel mailing list