Re: [PATCH 1/1] [ASOC]: AD1980 audio codec ASOC driver

From: Takashi Iwai
Date: Tue May 13 2008 - 06:59:38 EST


At Mon, 12 May 2008 18:45:12 +0800,
Bryan Wu wrote:
> diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c
(snip)
> +static int ad1980_add_controls(struct snd_soc_codec *codec)
> +{
> + int err, i;
> +
> + for (i = 0; i < ARRAY_SIZE(ad1980_snd_ac97_controls); i++) {
> + err = snd_ctl_add(codec->card, snd_soc_cnew( \

The backslash isn't needed.

> +static unsigned int ac97_read(struct snd_soc_codec *codec,
> + unsigned int reg)
> +{
> + u16 *cache = codec->reg_cache;
> +
> + if (reg == AC97_RESET || reg == AC97_INT_PAGING || \
> + reg == AC97_POWERDOWN || reg == AC97_EXTENDED_STATUS \
> + || reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2)

Ditto. Maybe a switch is a better choice here.

> + return soc_ac97_ops.read(codec->ac97, reg);
> + else {
> + reg = reg >> 1;
> +
> + if (reg > (ARRAY_SIZE(ad1980_reg)))

Isn't it reg >= ARRAY_SIZE(ad1980_reg) ??

> +static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
> + unsigned int val)
> +{
> + u16 *cache = codec->reg_cache;
> +
> + soc_ac97_ops.write(codec->ac97, reg, val);
> + reg = reg >> 1;
> + if (reg <= (ARRAY_SIZE(ad1980_reg)))

And reg < ARRAY_SIZE(ad1980_reg)


thanks,

Takashi
--
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/