[alsa-devel] [PATCH 1/1] [ASOC]: AD1980 audio codec ASOC driver

Takashi Iwai tiwai at suse.de
Tue May 13 12:59:26 CEST 2008


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


More information about the Alsa-devel mailing list