[alsa-devel] [PATCH] ALSA: Fix prototype for snd_soc_dai_link.init() function pointer
Takashi Iwai
tiwai at suse.de
Mon Jun 4 12:31:50 CEST 2007
At Fri, 1 Jun 2007 17:44:57 -0500,
Timur Tabi wrote:
>
> Change the snd_soc_dai_link.init() function to take a pointer to the
> corresponding snd_soc_dai_link structure, instead of a pointer to a
> snd_soc_codec structure. This allows the initialization function to initialize
> its own structure.
>
> Signed-off-by: Timur Tabi <timur at freescale.com>
Liam, is this change OK for you?
If yes, I'll add this to HG tree after 1.0.14 release.
thanks,
Takashi
> ---
>
> This is a fix for ALSA bug 3135
> (https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3135). Since I
> don't have an ARM cross-compiler, and currently all ASoC drivers are for ARM
> platforms only, I'm not sure if this fix is correct.
>
> include/sound/soc.h | 2 +-
> sound/soc/at91/eti_b1_wm8731.c | 3 ++-
> sound/soc/pxa/corgi.c | 3 ++-
> sound/soc/pxa/poodle.c | 3 ++-
> sound/soc/pxa/spitz.c | 3 ++-
> sound/soc/pxa/tosa.c | 3 ++-
> sound/soc/soc-core.c | 2 +-
> 7 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/include/sound/soc.h b/include/sound/soc.h
> index db6edba..86e1b1d 100644
> --- a/include/sound/soc.h
> +++ b/include/sound/soc.h
> @@ -410,7 +410,7 @@ struct snd_soc_dai_link {
> struct snd_soc_ops *ops;
>
> /* codec/machine specific init - e.g. add machine controls */
> - int (*init)(struct snd_soc_codec *codec);
> + int (*init)(struct snd_soc_dai_link *codec);
> };
>
> /* SoC machine */
> diff --git a/sound/soc/at91/eti_b1_wm8731.c b/sound/soc/at91/eti_b1_wm8731.c
> index 820a676..a4f5a99 100644
> --- a/sound/soc/at91/eti_b1_wm8731.c
> +++ b/sound/soc/at91/eti_b1_wm8731.c
> @@ -216,9 +216,10 @@ static const char *intercon[][3] = {
> /*
> * Logic for a wm8731 as connected on a Endrelia ETI-B1 board.
> */
> -static int eti_b1_wm8731_init(struct snd_soc_codec *codec)
> +static int eti_b1_wm8731_init(struct snd_soc_dai_link *dai)
> {
> int i;
> + struct snd_soc_codec *codec = dai->codec_dai->codec;
>
> DBG("eti_b1_wm8731_init() called\n");
>
> diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
> index 5ee51a9..43237f9 100644
> --- a/sound/soc/pxa/corgi.c
> +++ b/sound/soc/pxa/corgi.c
> @@ -286,9 +286,10 @@ static const struct snd_kcontrol_new wm8731_corgi_controls[] = {
> /*
> * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device
> */
> -static int corgi_wm8731_init(struct snd_soc_codec *codec)
> +static int corgi_wm8731_init(struct snd_soc_dai_link *dai)
> {
> int i, err;
> + struct snd_soc_codec *codec = dai->codec_dai->codec;
>
> snd_soc_dapm_set_endpoint(codec, "LLINEIN", 0);
> snd_soc_dapm_set_endpoint(codec, "RLINEIN", 0);
> diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
> index 0915cf7..5e8cb76 100644
> --- a/sound/soc/pxa/poodle.c
> +++ b/sound/soc/pxa/poodle.c
> @@ -246,9 +246,10 @@ static const snd_kcontrol_new_t wm8731_poodle_controls[] = {
> /*
> * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device
> */
> -static int poodle_wm8731_init(struct snd_soc_codec *codec)
> +static int poodle_wm8731_init(struct snd_soc_dai_link *dai)
> {
> int i, err;
> + struct snd_soc_codec *codec = dai->codec_dai->codec;
>
> snd_soc_dapm_set_endpoint(codec, "LLINEIN", 0);
> snd_soc_dapm_set_endpoint(codec, "RLINEIN", 0);
> diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
> index 80e8210..95dcaa4 100644
> --- a/sound/soc/pxa/spitz.c
> +++ b/sound/soc/pxa/spitz.c
> @@ -292,9 +292,10 @@ static const struct snd_kcontrol_new wm8750_spitz_controls[] = {
> /*
> * Logic for a wm8750 as connected on a Sharp SL-Cxx00 Device
> */
> -static int spitz_wm8750_init(struct snd_soc_codec *codec)
> +static int spitz_wm8750_init(struct snd_soc_dai_link *dai)
> {
> int i, err;
> + struct snd_soc_codec *codec = dai->codec_dai->codec;
>
> /* NC codec pins */
> snd_soc_dapm_set_endpoint(codec, "RINPUT1", 0);
> diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
> index 5504e30..b438349 100644
> --- a/sound/soc/pxa/tosa.c
> +++ b/sound/soc/pxa/tosa.c
> @@ -192,9 +192,10 @@ static const struct snd_kcontrol_new tosa_controls[] = {
> tosa_set_spk),
> };
>
> -static int tosa_ac97_init(struct snd_soc_codec *codec)
> +static int tosa_ac97_init(struct snd_soc_dai_link *dai)
> {
> int i, err;
> + struct snd_soc_codec *codec = dai->codec_dai->codec;
>
> snd_soc_dapm_set_endpoint(codec, "OUT3", 0);
> snd_soc_dapm_set_endpoint(codec, "MONOOUT", 0);
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 92d5d91..654a517 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1093,7 +1093,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
> mutex_lock(&codec->mutex);
> for(i = 0; i < machine->num_links; i++) {
> if (socdev->machine->dai_link[i].init) {
> - err = socdev->machine->dai_link[i].init(codec);
> + err = socdev->machine->dai_link[i].init(&machine->dai_link[i]);
> if (err < 0) {
> printk(KERN_ERR "asoc: failed to init %s\n",
> socdev->machine->dai_link[i].stream_name);
> --
> 1.5.0.2.260.g2eb065
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
More information about the Alsa-devel
mailing list