]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ASoC: fsl_easrc: use snd_pcm_format_t type for sample_format
authorShengjiu Wang <shengjiu.wang@nxp.com>
Thu, 21 Jul 2022 10:29:52 +0000 (18:29 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 21 Jul 2022 12:38:51 +0000 (13:38 +0100)
Fix sparse warning:
sound/soc/fsl/fsl_easrc.c:562:33: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl_easrc.c:563:34: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl_easrc.c:565:38: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl_easrc.c:566:39: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl_easrc.c:608:33: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl_easrc.c:609:34: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl_easrc.c:615:40: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl_easrc.c:616:41: sparse: warning: restricted snd_pcm_format_t degrades to integer

sound/soc/fsl/fsl_easrc.c:1465:51: sparse: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl_easrc.c:1465:51: sparse:    expected unsigned int sample_format
sound/soc/fsl/fsl_easrc.c:1465:51: sparse:    got restricted snd_pcm_format_t [usertype] format
sound/soc/fsl/fsl_easrc.c:1467:52: sparse: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl_easrc.c:1467:52: sparse:    expected unsigned int sample_format
sound/soc/fsl/fsl_easrc.c:1467:52: sparse:    got restricted snd_pcm_format_t [usertype] asrc_format
sound/soc/fsl/fsl_easrc.c:1470:52: sparse: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl_easrc.c:1470:52: sparse:    expected unsigned int sample_format
sound/soc/fsl/fsl_easrc.c:1470:52: sparse:    got restricted snd_pcm_format_t [usertype] format
sound/soc/fsl/fsl_easrc.c:1472:51: sparse: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl_easrc.c:1472:51: sparse:    expected unsigned int sample_format
sound/soc/fsl/fsl_easrc.c:1472:51: sparse:    got restricted snd_pcm_format_t [usertype] asrc_format
sound/soc/fsl/fsl_easrc.c:1484:41: sparse: warning: incorrect type in argument 2 (different base types)
sound/soc/fsl/fsl_easrc.c:1484:41: sparse:    expected restricted snd_pcm_format_t [usertype] *in_raw_format
sound/soc/fsl/fsl_easrc.c:1484:41: sparse:    got unsigned int *
sound/soc/fsl/fsl_easrc.c:1485:41: sparse: warning: incorrect type in argument 3 (different base types)
sound/soc/fsl/fsl_easrc.c:1485:41: sparse:    expected restricted snd_pcm_format_t [usertype] *out_raw_format
sound/soc/fsl/fsl_easrc.c:1485:41: sparse:    got unsigned int *
sound/soc/fsl/fsl_easrc.c:1937:60: sparse: warning: incorrect type in argument 3 (different base types)
sound/soc/fsl/fsl_easrc.c:1937:60: sparse:    expected unsigned int [usertype] *out_value
sound/soc/fsl/fsl_easrc.c:1937:60: sparse:    got restricted snd_pcm_format_t *
sound/soc/fsl/fsl_easrc.c:1943:49: sparse: warning: restricted snd_pcm_format_t degrades to integer

Fixes: bf14c853dfac ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1658399393-28777-5-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_easrc.c
sound/soc/fsl/fsl_easrc.h

index ea96b0fb6b202c475e7c5157e848797f00831035..3153d19136b29957df92d37eb8fdaed75b55fd5d 100644 (file)
@@ -476,7 +476,8 @@ static int fsl_easrc_prefilter_config(struct fsl_asrc *easrc,
        struct fsl_asrc_pair *ctx;
        struct device *dev;
        u32 inrate, outrate, offset = 0;
-       u32 in_s_rate, out_s_rate, in_s_fmt, out_s_fmt;
+       u32 in_s_rate, out_s_rate;
+       snd_pcm_format_t in_s_fmt, out_s_fmt;
        int ret, i;
 
        if (!easrc)
@@ -1874,6 +1875,7 @@ static int fsl_easrc_probe(struct platform_device *pdev)
        struct resource *res;
        struct device_node *np;
        void __iomem *regs;
+       u32 asrc_fmt = 0;
        int ret, irq;
 
        easrc = devm_kzalloc(dev, sizeof(*easrc), GFP_KERNEL);
@@ -1934,13 +1936,14 @@ static int fsl_easrc_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = of_property_read_u32(np, "fsl,asrc-format", &easrc->asrc_format);
+       ret = of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt);
+       easrc->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
        if (ret) {
                dev_err(dev, "failed to asrc format\n");
                return ret;
        }
 
-       if (!(FSL_EASRC_FORMATS & (1ULL << easrc->asrc_format))) {
+       if (!(FSL_EASRC_FORMATS & (pcm_format_to_bits(easrc->asrc_format)))) {
                dev_warn(dev, "unsupported format, switching to S24_LE\n");
                easrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
        }
index 86d5c360d4f53de17b7ca596465991d6f7988715..7c70dac52713772eb82db13b6ce6c568362ebd45 100644 (file)
@@ -569,7 +569,7 @@ struct fsl_easrc_io_params {
        unsigned int access_len;
        unsigned int fifo_wtmk;
        unsigned int sample_rate;
-       unsigned int sample_format;
+       snd_pcm_format_t sample_format;
        unsigned int norm_rate;
 };