From: Takashi Iwai Subject: Re: [RFC 2/7] snd-aoa: add aoa core Date: Mon, 29 May 2006 12:57:18 +0200 Message-ID: References: <20060528190026.754474000@johannes.berg> <20060528190124.579130000@johannes.berg> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa.jcu.cz (ALSA's E-mail Delivery System) with ESMTP id 889E5167 for ; Mon, 29 May 2006 12:57:19 +0200 (MEST) In-Reply-To: <20060528190124.579130000@johannes.berg> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@lists.sourceforge.net Errors-To: alsa-devel-bounces@lists.sourceforge.net To: Johannes Berg Cc: linuxppc-dev@ozlabs.org, alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Sun, 28 May 2006 21:00:28 +0200, Johannes Berg wrote: > --- /dev/null > +++ b/sound/aoa/core/snd-aoa-alsa.c > @@ -0,0 +1,91 @@ > +/* > + * Apple Onboard Audio Alsa helpers > + * > + * Copyright 2006 Johannes Berg > + * > + * GPL v2, can be found in COPYING. > + */ > +#include > +#include "snd-aoa-alsa.h" > + > +static struct aoa_card *aoa_card; > + > +int aoa_alsa_init(char *name, struct module *mod) > +{ > + struct snd_card *alsa_card; > + int err; > + > + if (aoa_card) > + /* cannot be EEXIST due to usage in aoa_fabric_register */ > + return -EBUSY; > + > + alsa_card = snd_card_new(-1, name, mod, sizeof(struct aoa_card)); Usually the first argument here is the index module option so that user may specify the card order (e.g. secondary card) independent from the order of module loading. > + if (!alsa_card) > + return -ENOMEM; > + aoa_card = alsa_card->private_data; > + aoa_card->alsa_card = alsa_card; > + strncpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver)); > + strncpy(alsa_card->shortname, name, sizeof(alsa_card->shortname)); > + strncpy(alsa_card->longname, name, sizeof(alsa_card->longname)); > + strncpy(alsa_card->mixername, name, sizeof(alsa_card->mixername)); strlcpy is safer. Also, longname usually contains more verbose info. > --- /dev/null > +++ b/sound/aoa/core/snd-aoa-core.c (snip) > + err = aoa_alsa_init(new_fabric->name, new_fabric->owner); > + if (err) { > + return err; > + } Remove braces. Takashi