Re: [alsa-devel] [PATCH] ASoC: Add max98095 CODEC driver

From: Dimitris Papastamos
Date: Thu Mar 24 2011 - 07:42:18 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/