public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Takashi Iwai <tiwai@suse.de>, Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: alsa-devel@alsa-project.org, vinod.koul@intel.com,
	nsekhar@ti.com, Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, joelf@ti.com,
	Mark Brown <broonie@kernel.org>,
	dmaengine@vger.kernel.org, dan.j.williams@intel.com
Subject: Re: [alsa-devel] [PATCH v2 3/5] ASoC: generic-dmaengine-pcm: Prepare formats mask for valid physical sample sizes
Date: Wed, 02 Jul 2014 16:10:09 +0200	[thread overview]
Message-ID: <53B412C1.20406@metafoo.de> (raw)
In-Reply-To: <s5h61jf6fec.wl%tiwai@suse.de>

On 07/02/2014 03:47 PM, Takashi Iwai wrote:
[...]
>> +	/*
>> +	 * Prepare formats mask for valid/allowed sample types. If the dma does
>> +	 * not have support for the given physical word size, it needs to be
>> +	 * masked out so user space can not use the format which produces
>> +	 * corrupted audio.
>> +	 * In case the dma driver does not implement the slave_caps the default
>> +	 * assumption is that it supports 1, 2 and 4 bytes widths.
>> +	 */
>> +	for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
>> +		int bits = snd_pcm_format_physical_width(i);
>
> Better to add a negative value check.  Some formats return -EINVAL.
>

So what should we do with those formats? Not support them?

>> +
>> +		/* Enable only samples with DMA supported physical widths */
>> +		if (addr_widths & BIT(bits / 8))
>
> Just nitpicking: Using BIT() for 32bit int isn't always a wise choice
> since BIT() is defined as unsigned long.  This is a generic problem,
> though, as we see many codes using BIT() wrongly (and thus get
> compiler warnings on 64bit machines).  We should introduce a new macro
> for 32bit int...

  reply	other threads:[~2014-07-02 14:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02 13:29 [PATCH v2 0/5] ALSA/ASoC/dmaengine: Fix 3 bytes physical sample support Peter Ujfalusi
2014-07-02 13:29 ` [PATCH v2 1/5] dma: Support for 3 bytes word size Peter Ujfalusi
2014-07-02 13:29 ` [PATCH v2 2/5] ALSA: pcm_dmaengine: Use the available wrapper to get physical width Peter Ujfalusi
2014-07-02 13:29 ` [PATCH v2 3/5] ASoC: generic-dmaengine-pcm: Prepare formats mask for valid physical sample sizes Peter Ujfalusi
2014-07-02 13:47   ` Takashi Iwai
2014-07-02 14:10     ` Lars-Peter Clausen [this message]
2014-07-02 14:12       ` [alsa-devel] " Takashi Iwai
2014-07-02 14:13         ` Lars-Peter Clausen
2014-07-02 14:24           ` [alsa-devel] " Takashi Iwai
2014-07-02 13:29 ` [PATCH v2 4/5] ALSA: pcm_dmaengine: Correct support for 24bits physical sample widths Peter Ujfalusi
2014-07-02 13:29 ` [PATCH v2 5/5] dma: edma: Declare DMA_SLAVE_BUSWIDTH_3_BYTES as supported buswidth Peter Ujfalusi

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=53B412C1.20406@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=joelf@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=peter.ujfalusi@ti.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /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