Skip to content

Commit

Permalink
ASoC: imx-card: use snd_pcm_format_t type for asrc_format
Browse files Browse the repository at this point in the history
Fix sparse warning:
sound/soc/fsl/imx-card.c:653:59: sparse: warning: incorrect type in assignment (different base types)
sound/soc/fsl/imx-card.c:653:59: sparse:    expected unsigned int [usertype] asrc_format
sound/soc/fsl/imx-card.c:653:59: sparse:    got restricted snd_pcm_format_t [usertype]
sound/soc/fsl/imx-card.c:655:59: sparse: warning: incorrect type in assignment (different base types)
sound/soc/fsl/imx-card.c:655:59: sparse:    expected unsigned int [usertype] asrc_format
sound/soc/fsl/imx-card.c:655:59: sparse:    got restricted snd_pcm_format_t [usertype]

Fixes: aa73670 ("ASoC: imx-card: Add imx-card machine driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1658399393-28777-6-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
TE-N-ShengjiuWang authored and broonie committed Jul 21, 2022
1 parent de27216 commit 409a865
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sound/soc/fsl/imx-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct imx_card_data {
struct snd_soc_card card;
int num_dapm_routes;
u32 asrc_rate;
u32 asrc_format;
snd_pcm_format_t asrc_format;
};

static struct imx_akcodec_fs_mul ak4458_fs_mul[] = {
Expand Down Expand Up @@ -474,7 +474,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, data->asrc_format);
snd_mask_set(mask, (__force unsigned int)data->asrc_format);

return 0;
}
Expand All @@ -493,6 +493,7 @@ static int imx_card_parse_of(struct imx_card_data *data)
struct dai_link_data *link_data;
struct of_phandle_args args;
int ret, num_links;
u32 asrc_fmt = 0;
u32 width;

ret = snd_soc_of_parse_card_name(card, "model");
Expand Down Expand Up @@ -639,7 +640,8 @@ static int imx_card_parse_of(struct imx_card_data *data)
goto err;
}

ret = of_property_read_u32(args.np, "fsl,asrc-format", &data->asrc_format);
ret = of_property_read_u32(args.np, "fsl,asrc-format", &asrc_fmt);
data->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
if (ret) {
/* Fallback to old binding; translate to asrc_format */
ret = of_property_read_u32(args.np, "fsl,asrc-width", &width);
Expand Down

0 comments on commit 409a865

Please sign in to comment.