From: Takashi Iwai <tiwai@suse.de>
To: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
patches@opensource.wolfsonmicro.com,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Lars-Peter Clausen <lars@metafoo.de>,
Daniel Mack <daniel@zonque.org>, Wolfram Sang <wsa@the-dreams.de>,
Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
Matt Reimer <mreimer@sdgsystems.com>
Subject: Re: [PATCH] ASoC: codecs: use SNDRV_PCM_FMTBIT_* for format bitmask
Date: Tue, 26 May 2015 07:29:57 +0200 [thread overview]
Message-ID: <s5h382j29ey.wl-tiwai@suse.de> (raw)
In-Reply-To: <5560AB9D.1010807@maciej.szmigiero.name>
At Sat, 23 May 2015 18:32:29 +0200,
Maciej S. Szmigiero wrote:
>
> snd_soc_pcm_stream.formats is a bitmask of SNDRV_PCM_FMTBIT_*,
> not of SNDRV_PCM_FORMAT_* (which are sequential integers),
> however some of ASoC CODEC drivers use these values instead.
>
> Found out by sparse on 0-day kernel tester.
>
> Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
Wow, that made me wonder how these drivers could actually work.
BTW, how did you detect it? Any static analyzer like sparse or
smatch? sparse didn't detect it at the last time I tried, IIRC...
thanks,
Takashi
>
> diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
> index ee31fa7..38b3dad 100644
> --- a/sound/soc/codecs/88pm860x-codec.c
> +++ b/sound/soc/codecs/88pm860x-codec.c
> @@ -1186,16 +1186,16 @@ static struct snd_soc_dai_driver pm860x_dai[] = {
> .channels_min = 2,
> .channels_max = 2,
> .rates = PM860X_RATES,
> - .formats = SNDRV_PCM_FORMAT_S16_LE | \
> - SNDRV_PCM_FORMAT_S18_3LE,
> + .formats = SNDRV_PCM_FMTBIT_S16_LE | \
> + SNDRV_PCM_FMTBIT_S18_3LE,
> },
> .capture = {
> .stream_name = "PCM Capture",
> .channels_min = 2,
> .channels_max = 2,
> .rates = PM860X_RATES,
> - .formats = SNDRV_PCM_FORMAT_S16_LE | \
> - SNDRV_PCM_FORMAT_S18_3LE,
> + .formats = SNDRV_PCM_FMTBIT_S16_LE | \
> + SNDRV_PCM_FMTBIT_S18_3LE,
> },
> .ops = &pm860x_pcm_dai_ops,
> }, {
> @@ -1207,16 +1207,16 @@ static struct snd_soc_dai_driver pm860x_dai[] = {
> .channels_min = 2,
> .channels_max = 2,
> .rates = SNDRV_PCM_RATE_8000_48000,
> - .formats = SNDRV_PCM_FORMAT_S16_LE | \
> - SNDRV_PCM_FORMAT_S18_3LE,
> + .formats = SNDRV_PCM_FMTBIT_S16_LE | \
> + SNDRV_PCM_FMTBIT_S18_3LE,
> },
> .capture = {
> .stream_name = "I2S Capture",
> .channels_min = 2,
> .channels_max = 2,
> .rates = SNDRV_PCM_RATE_8000_48000,
> - .formats = SNDRV_PCM_FORMAT_S16_LE | \
> - SNDRV_PCM_FORMAT_S18_3LE,
> + .formats = SNDRV_PCM_FMTBIT_S16_LE | \
> + SNDRV_PCM_FMTBIT_S18_3LE,
> },
> .ops = &pm860x_i2s_dai_ops,
> },
> diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
> index 2341e8e..ed4cca7 100644
> --- a/sound/soc/codecs/stac9766.c
> +++ b/sound/soc/codecs/stac9766.c
> @@ -320,7 +320,7 @@ static struct snd_soc_dai_driver stac9766_dai[] = {
> .channels_max = 2,
> .rates = SNDRV_PCM_RATE_32000 | \
> SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000,
> - .formats = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE,
> + .formats = SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE,
> },
> /* alsa ops */
> .ops = &stac9766_dai_ops_digital,
> diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
> index e7d2ecd..493faf5 100644
> --- a/sound/soc/codecs/wm8900.c
> +++ b/sound/soc/codecs/wm8900.c
> @@ -998,8 +998,8 @@ static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute)
> SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
>
> #define WM8900_PCM_FORMATS \
> - (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \
> - SNDRV_PCM_FORMAT_S24_LE)
> + (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
> + SNDRV_PCM_FMTBIT_S24_LE)
>
> static const struct snd_soc_dai_ops wm8900_dai_ops = {
> .hw_params = wm8900_hw_params,
> diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
> index 9d18a0e..89cd2d6 100644
> --- a/sound/soc/codecs/wm9713.c
> +++ b/sound/soc/codecs/wm9713.c
> @@ -1054,8 +1054,8 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
> SNDRV_PCM_RATE_48000)
>
> #define WM9713_PCM_FORMATS \
> - (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \
> - SNDRV_PCM_FORMAT_S24_LE)
> + (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
> + SNDRV_PCM_FMTBIT_S24_LE)
>
> static const struct snd_soc_dai_ops wm9713_dai_ops_hifi = {
> .prepare = ac97_hifi_prepare,
>
next prev parent reply other threads:[~2015-05-26 5:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-23 16:32 [PATCH] ASoC: codecs: use SNDRV_PCM_FMTBIT_* for format bitmask Maciej S. Szmigiero
2015-05-25 8:49 ` Charles Keepax
2015-05-25 12:00 ` Mark Brown
2015-05-26 5:29 ` Takashi Iwai [this message]
2015-05-26 9:44 ` Mark Brown
2015-05-26 14:03 ` Maciej S. Szmigiero
2015-05-26 14:09 ` Takashi Iwai
2015-05-27 12:04 ` Maciej S. Szmigiero
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h382j29ey.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.wolfsonmicro.com \
--cc=daniel@zonque.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@maciej.szmigiero.name \
--cc=mreimer@sdgsystems.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=perex@perex.cz \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox