ALSA: Fix prototype for snd_soc_dai_link.init() function pointer
Subsystems (4)
PATCH 1/1 ALSA: Fix prototype for snd_soc_dai_link.init() function pointer
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.
---
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(-)
include/sound/soc.h +1 -1
@@ -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 */
sound/soc/at91/eti_b1_wm8731.c +2 -1
@@ -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" );
sound/soc/pxa/corgi.c +2 -1
@@ -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 );
sound/soc/pxa/poodle.c +2 -1
@@ -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 );
sound/soc/pxa/spitz.c +2 -1
@@ -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 );
sound/soc/pxa/tosa.c +2 -1
@@ -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 );
sound/soc/soc-core.c +1 -1
@@ -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);
Signature · 1 line
1.5.0.2.260.g2eb065
At Fri, 1 Jun 2007 17:44:57 -0500,
Quoted 7 lines · Timur Tabi
Change the
snd_soc_dai_link.init()function to take a pointer to the correspondingsnd_soc_dai_linkstructure, instead of a pointer to asnd_soc_codecstructure. This allows the initialization function to initialize its own structure.Signed-off-by Timur Tabi <[email protected]>
Liam, is this change OK for you?
If yes, I'll add this to HG tree after 1.0.14 release.
thanks,
Takashi
Quoted 130 lines
---
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(-)include/sound/soc.h +1
-1@@ -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 */ sound/soc/at91/eti_b1_wm8731.c +2
-1@@ -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" );sound/soc/pxa/corgi.c +2
-1@@ -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 );sound/soc/pxa/poodle.c +2
-1@@ -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 );sound/soc/pxa/spitz.c +2
-1@@ -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 );sound/soc/pxa/tosa.c +2
-1@@ -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 );sound/soc/soc-core.c +1
-1@@ -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);Signature · 6 lines
1.5.0.2.260.g2eb065 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 11 lines · Takashi Iwai
At Fri, 1 Jun 2007 17:44:57 -0500,
Quoted 6 lines · Timur Tabi
Change the
snd_soc_dai_link.init()function to take a pointer to the correspondingsnd_soc_dai_linkstructure, instead of a pointer to asnd_soc_codecstructure. This allows the initialization function to initialize its own structure.Signed-off-by Timur Tabi <[email protected]>Liam, is this change OK for you?
If yes, I'll add this to HG tree after 1.0.14 release.
Please note my comment in the patch. I have not compiled all the code that I changed, so I don't know if this patch is good. I would like someone to test this patch.
This patch is just a refactoring - no new features have been added, so after applying this patch, everything should still compile and run exactly the same.
The key code changes are:
struct snd_soc_codec *codec = dai->codec_dai->codec;
I'm hoping that 'codec' contains the same value that it did before the patch, and
err = socdev->machine->dai_link[i].init(&machine->dai_link[i]);
I hope this passes the correct snd_soc_dai_link pointer.
Signature · 2 lines
Timur Tabi Linux Kernel Developer @ Freescale