linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Takashi Iwai <tiwai@suse.de>
Cc: linuxppc-dev@ozlabs.org, alsa-devel@alsa-project.org
Subject: Re: [Alsa-devel] [RFC 4/7] snd-aoa: add codecs
Date: Tue, 30 May 2006 14:43:16 +0200	[thread overview]
Message-ID: <1148992996.3102.8.camel@johannes> (raw)
In-Reply-To: <s5h8xol9gom.wl%tiwai@suse.de>

[-- Attachment #1: Type: text/plain, Size: 2268 bytes --]

On Mon, 2006-05-29 at 14:08 +0200, Takashi Iwai wrote:
> > +	if (reg != ONYX_REG_CONTROL) {
> > +		*value = onyx->cache[reg-FIRSTREGISTER];
> > +		return 0;
> > +	}
> > +	v = i2c_smbus_read_byte_data(&onyx->i2c, reg);
> > +	if (v < 0)
> > +		return -1;
> > +	*value = (u8)v;
> > +	onyx->cache[ONYX_REG_CONTROL-FIRSTREGISTER] = *value;
> 
> Isn't it "reg - FIRSTREGISTER" ?

Nah, look at the first line I quoted :)


> I'd define a constant for 128.

#define OFFSET_BECAUSE_ALSA_USERSPACE_PROGRAMS_SUCK 128
;)

Just kidding, will do.

> Fold lines to fit with 80 columns (heh, blaming other one's code is
> easy :)

Heh. I thought I'd Lindent'ed most of it.

> > +	/* FIXME: we could be checking if anything changed */
> > +	mutex_unlock(&onyx->mutex);
> > +
> > +	return 1;
> 
> The put callback is supposed to return 0 if the values are unchanged
> (although most apps ignore the return value).

Does it have to? This way there's an event, but...

> > +static u8 initial_values[] = {
> 
> Should have ARRAY_SIZE(register_map) since this size must be identical
> with register_map.

Good point.

> > +#define ADDCTL(n)							\
> > +	do {								\
> > +		ctl = snd_ctl_new1(&n, onyx);				\
> > +		if (ctl) {						\
> > +			ctl->id.device =				\
> > +				onyx->codec.soundbus_dev->pcm->device;	\
> > +			aoa_snd_ctl_add(ctl);				\
> 
> No error check?

Hmm, yeah, I guess it should have error checks. Will revisit that.

> Use strlcpy, or MAX_CODEC_NAME_LEN-1.  Similar lines are found in
> tas driver too.

Right.

> Looks a bit too hacky.  IMO, it's better to define a struct

Maybe I'll just get rid of it completely, it's never hooked up as far as
I know. But yeah, I guess you're right.

> > +static int tas_snd_capture_source_info(struct snd_kcontrol *kcontrol,
> > +	struct snd_ctl_elem_info *uinfo)
> > +{
> > +	static char* texts[] = { "Line-In", "Microphone" };
> 
> char *texts[]

Any particular reason?

> > +/* I need help here!
> 
> Use ifdef.  Nested comments are bad.

I know. Temporary code, probably going away completely.

> > +	aoa_snd_ctl_add(snd_ctl_new1(&volume_control, tas));
> 
> Error checks please.

What should it do on such errors?

Thanks,
johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

  reply	other threads:[~2006-05-30 12:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-28 19:00 [RFC 0/7] snd-aoa: add snd-aoa Johannes Berg
2006-05-28 19:00 ` [RFC 1/7] snd-aoa: add aoa header files Johannes Berg
2006-05-28 19:00 ` [RFC 2/7] snd-aoa: add aoa core Johannes Berg
2006-05-29 10:57   ` [Alsa-devel] " Takashi Iwai
2006-05-30 12:44     ` Johannes Berg
2006-05-30 13:20       ` Takashi Iwai
2006-05-28 19:00 ` [RFC 3/7] snd-aoa: add soundbus and i2sbus Johannes Berg
2006-05-28 19:00 ` [RFC 4/7] snd-aoa: add codecs Johannes Berg
2006-05-29 12:08   ` [Alsa-devel] " Takashi Iwai
2006-05-30 12:43     ` Johannes Berg [this message]
2006-05-30 13:19       ` Takashi Iwai
2006-05-30 13:26         ` Johannes Berg
2006-05-30 13:35           ` Takashi Iwai
2006-05-30 13:39             ` Johannes Berg
2006-05-30 13:48               ` Takashi Iwai
2006-05-30 13:53                 ` Johannes Berg
2006-05-30 13:56                   ` Takashi Iwai
2006-05-28 19:00 ` [RFC 5/7] snd-aoa: add layout-id fabric Johannes Berg
2006-05-29 12:14   ` [Alsa-devel] " Takashi Iwai
2006-05-30 12:37     ` Johannes Berg
2006-05-28 19:00 ` [RFC 6/7] snd-aoa: add Kconfig and Makefile Johannes Berg
2006-05-28 19:00 ` [RFC 7/7] snd-aoa: wire up aoa in sound/ Johannes Berg

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=1148992996.3102.8.camel@johannes \
    --to=johannes@sipsolutions.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=linuxppc-dev@ozlabs.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).