alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Francois Moine <moinejf@free.fr>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	linux-kernel@vger.kernel.org, Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH v2 2/4] ASoC: simple-card: dynamically allocate the DAI link array
Date: Tue, 11 Mar 2014 10:21:17 +0100	[thread overview]
Message-ID: <c245a56ec60c816d1b9c5b23179de66389998f88.1394533640.git.moinejf@free.fr> (raw)
In-Reply-To: <cover.1394533640.git.moinejf@free.fr>

The DAI link array is hard-coded as a single CPU / CODEC link.

This patch allocates this array with the card definition and facilitates
handling more DAI links.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
 sound/soc/generic/simple-card.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index dcf37fb..2710b52 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -23,7 +23,7 @@ struct simple_card_data {
 	unsigned int daifmt;
 	struct asoc_simple_dai cpu_dai;
 	struct asoc_simple_dai codec_dai;
-	struct snd_soc_dai_link snd_link;
+	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
 };
 
 static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
@@ -276,7 +276,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	int ret;
 
-	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	priv = devm_kzalloc(dev,
+			sizeof(*priv) + sizeof(*dai_link),
+			GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
@@ -285,7 +287,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	 */
 	priv->snd_card.owner = THIS_MODULE;
 	priv->snd_card.dev = dev;
-	dai_link = &priv->snd_link;
+	dai_link = priv->dai_link;
 	priv->snd_card.dai_link = dai_link;
 	priv->snd_card.num_links = 1;
 
-- 
1.9.0

  parent reply	other threads:[~2014-03-11  9:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 10:27 [PATCH v2 0/4] ASoC: simple-card: DT fix and multi DAI links extension Jean-Francois Moine
2014-03-11  9:03 ` [PATCH v2 1/4] ASoC: simple-card: Fix the reference count of device nodes Jean-Francois Moine
2014-03-14 19:57   ` Mark Brown
2014-03-11  9:21 ` Jean-Francois Moine [this message]
2014-03-11  9:36 ` [PATCH v2 3/4] ASoC: simple-card: accept many DAI links Jean-Francois Moine
2014-03-12  5:20   ` Li.Xiubo
2014-03-14 18:58     ` [alsa-devel] " Jean-Francois Moine
2014-03-14 11:16   ` Jyri Sarha
2014-03-14 18:40     ` Jean-Francois Moine
2014-03-15  9:14       ` Jyri Sarha
2014-03-17 16:19         ` Mark Brown
2014-03-11  9:58 ` [PATCH v2 4/4] ASoC: simple-card: Add DT documentation for multi-DAI links Jean-Francois Moine

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=c245a56ec60c816d1b9c5b23179de66389998f88.1394533640.git.moinejf@free.fr \
    --to=moinejf@free.fr \
    --cc=Li.Xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    /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).