Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Barry Song <21cnbao@gmail.com>
Cc: uclinux-dist-devel@blackfin.uclinux.org,
	alsa-devel@alsa-project.org, Barry Song <Barry.Song@analog.com>,
	lrg@slimlogic.co.uk
Subject: Re: [PATCH] use set_channel_map api to reorder channels for AD1938 and AD1836
Date: Mon, 14 Sep 2009 11:24:30 +0100	[thread overview]
Message-ID: <20090914102429.GA1260@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1252908787-32078-1-git-send-email-21cnbao@gmail.com>

On Mon, Sep 14, 2009 at 02:13:07PM +0800, Barry Song wrote:

> +	unsigned int channel_map[8] = {0, 4, 1, 5, 2, 6, 3, 7};

As a coding style thing it would be better to use [] here and let the
arrray size be figured out by the compiler and also...

> +	/* set cpu DAI channel mapping */
> +	ret = snd_soc_dai_set_channel_map(cpu_dai, 8, channel_map,
> +			8, channel_map);

...use ARRAY_SIZE() here.

> +	if ((tx_num > MAX_TDM_SLOTS) || (rx_num > MAX_TDM_SLOTS))
> +		return -EINVAL;
> +
> +	for (i = 0; i < tx_num; i++)
> +		bf5xx_tdm.tx_map[i] = tx_slot[i];

It'd be good if the function also recorded the number of slots that were
mapped to provide some error checking in case someone tries to use more
channels than were mapped.

> +#define MAX_TDM_SLOTS 8

This define needs to be namespaced - it's visible outside the driver and
is very likely to collide with something a CODEC driver wants to set up.

      reply	other threads:[~2009-09-14 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14  6:13 [PATCH] use set_channel_map api to reorder channels for AD1938 and AD1836 Barry Song
2009-09-14 10:24 ` Mark Brown [this message]

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=20090914102429.GA1260@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=21cnbao@gmail.com \
    --cc=Barry.Song@analog.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    /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