All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Peter Hsiang <Peter.Hsiang@maxim-ic.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Takashi Iwai <tiwai@suse.de>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH] ASoC: Add max98095 CODEC driver
Date: Thu, 24 Mar 2011 11:42:11 +0000	[thread overview]
Message-ID: <20110324114211.GA26636@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <B2150E1E4418E1438554A300EA5040E40DAC511079@ITSVLEX06.it.maxim-ic.internal>

On Wed, Mar 23, 2011 at 08:57:41PM -0700, Peter Hsiang wrote:
> +static inline int rate_value(int rate, u8 *value)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(rate_table); i++) {
> +		if (rate_table[i].rate >= rate) {
> +			*value = rate_table[i].sr;
> +			return 0;
> +		}
> +	}
> +	*value = rate_table[0].sr;
> +	return -EINVAL;
> +}

Not too clear as to why this is an inline function?

> +static int max98095_probe(struct snd_soc_codec *codec)
> +{
> +	struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
> +	struct max98095_cdata *cdata;
> +	int ret = 0;
> +
> +	codec->cache_sync = 1;
> +	memcpy(codec->reg_cache, max98095_reg, sizeof(max98095_reg));

Keeping your own copy of the cache is rather deprecated.  As Mark
mentioned, you can let the ASoC cache manage your register cache as well
as use snd_soc_cache_sync() for syncing.

Thanks,
Dimitris

WARNING: multiple messages have this Message-ID (diff)
From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Peter Hsiang <Peter.Hsiang@maxim-ic.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Jarkko Nikula <jhnikula@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [alsa-devel] [PATCH] ASoC: Add max98095 CODEC driver
Date: Thu, 24 Mar 2011 11:42:11 +0000	[thread overview]
Message-ID: <20110324114211.GA26636@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <B2150E1E4418E1438554A300EA5040E40DAC511079@ITSVLEX06.it.maxim-ic.internal>

On Wed, Mar 23, 2011 at 08:57:41PM -0700, Peter Hsiang wrote:
> +static inline int rate_value(int rate, u8 *value)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(rate_table); i++) {
> +		if (rate_table[i].rate >= rate) {
> +			*value = rate_table[i].sr;
> +			return 0;
> +		}
> +	}
> +	*value = rate_table[0].sr;
> +	return -EINVAL;
> +}

Not too clear as to why this is an inline function?

> +static int max98095_probe(struct snd_soc_codec *codec)
> +{
> +	struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
> +	struct max98095_cdata *cdata;
> +	int ret = 0;
> +
> +	codec->cache_sync = 1;
> +	memcpy(codec->reg_cache, max98095_reg, sizeof(max98095_reg));

Keeping your own copy of the cache is rather deprecated.  As Mark
mentioned, you can let the ASoC cache manage your register cache as well
as use snd_soc_cache_sync() for syncing.

Thanks,
Dimitris

  parent reply	other threads:[~2011-03-24 11:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24  3:57 [PATCH] ASoC: Add max98095 CODEC driver Peter Hsiang
2011-03-24 10:15 ` Mark Brown
2011-03-24 10:15   ` Mark Brown
2011-03-24 11:42 ` Dimitris Papastamos [this message]
2011-03-24 11:42   ` [alsa-devel] " Dimitris Papastamos
  -- strict thread matches above, loose matches on Subject: below --
2011-03-24  3:57 Peter Hsiang
2011-04-05  2:35 Peter Hsiang
2011-04-06 14:15 ` Mark Brown
2011-04-06 14:15   ` Mark Brown
2011-04-05  2:35 Peter Hsiang

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=20110324114211.GA26636@opensource.wolfsonmicro.com \
    --to=dp@opensource.wolfsonmicro.com \
    --cc=Peter.Hsiang@maxim-ic.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.