[alsa-devel] [RFC] [PATCH 1/2] ASoC sound support for SMDK2440 boards: UDA1341 driver

Takashi Iwai tiwai at suse.de
Thu May 24 19:13:01 CEST 2007


At Thu, 24 May 2007 16:36:53 +0200,
Zoltan Devai wrote:
> 
> ASoC Support for the UDA1341 codec.
> Please note that until there is a final L3-bus driver, this patch won't work.

Thanks for the patch.

So, how is the status of L3-bus driver?
Is it supposed to be merged to the next (2.6.23) kernel (e.g. already
in mm tree)?  Or, should we keep your driver code in alsa-driver tree
for _not_ merging to 2.6.23?


Anyway, some quick reviews below...

> +/* In-data addresses are hard-coded into the reg-cache values */
> +static const char uda1341_reg[UDA1341_REGS_NUM] = {

You should use unsigned char because the default sign of char is
undefined.

> +static int uda1341_write(struct snd_soc_codec *codec, unsigned int reg,
> +	unsigned int value)
> +{
> +	int ret;
> +	int addr;
> +	u8 data = value;
> +
> +	DBG("reg: %02X, value:%02X", reg, value);
> +
> +	if (reg >= UDA1341_REGS_NUM) {
> +		DBG("Unkown register: reg: %d", reg);
> +		return -EINVAL;
> +	}
> +	
> +	uda1341_write_reg_cache(codec, reg, value);
> +
> +	switch (reg) {
> +		case UDA1341_STATUS0:
> +		case UDA1341_STATUS1:

Indent 'case' in the same level as 'switch'.


> +static int uda1341_add_controls(struct snd_soc_codec *codec)
> +{
> +	int err, i;
> +
> +	for (i = 0; i < ARRAY_SIZE(uda1341_snd_controls); i++) {
> +		if ((err = snd_ctl_add(codec->card,
> +		snd_soc_cnew(&uda1341_snd_controls[i],codec, NULL))) < 0)

Avoid the style:
	if ((err = foo()) < 0)
		...
split them, instead:
	err = foo();
	if (err < 0)
		...


Takashi


More information about the Alsa-devel mailing list