[Alsa-devel] [RFC 2/7] snd-aoa: add aoa core
Takashi Iwai
tiwai at suse.de
Mon May 29 20:57:18 EST 2006
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 <johannes at sipsolutions.net>
> + *
> + * GPL v2, can be found in COPYING.
> + */
> +#include <linux/module.h>
> +#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
More information about the Linuxppc-dev
mailing list