alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: lg@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org
Cc: Timur Tabi <timur@freescale.com>
Subject: [PATCH] ALSA: Fix prototype for snd_soc_dai_link.init() function pointer
Date: Fri,  1 Jun 2007 17:44:57 -0500	[thread overview]
Message-ID: <11807378971701-git-send-email-timur@freescale.com> (raw)

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@freescale.com>
---

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

             reply	other threads:[~2007-06-01 22:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-01 22:44 Timur Tabi [this message]
2007-06-04 10:31 ` [PATCH] ALSA: Fix prototype for snd_soc_dai_link.init() function pointer Takashi Iwai
2007-06-04 16:44   ` Timur Tabi

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=11807378971701-git-send-email-timur@freescale.com \
    --to=timur@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lg@opensource.wolfsonmicro.com \
    /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).