From: Jean-Francois Moine <moinejf@free.fr>
To: Mark Brown <broonie@kernel.org>, lgirdwood@gmail.com
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
kuninori.morimoto.gx@renesas.com,
Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH v2 5/8] ASoC: simple-card: simplify code
Date: Wed, 15 Jan 2014 16:51:48 +0100 [thread overview]
Message-ID: <20140115165148.2e0e19f3@armhf> (raw)
In-Reply-To: <20140115113551.0eb13409@armhf>
The CPU and CODEC DAI names are still copied to the user info structure.
Put them directly in the DAI links.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
sound/soc/generic/simple-card.c | 28 ++++++++++++----------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 797696f..9068ab4 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -60,7 +60,8 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
static int
asoc_simple_card_sub_parse_of(struct device_node *np,
struct asoc_simple_dai *dai,
- const struct device_node **p_node)
+ const struct device_node **p_node,
+ const char **name)
{
struct device_node *node;
struct clk *clk;
@@ -76,7 +77,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
*p_node = node;
/* get dai->name */
- ret = snd_soc_of_get_dai_name(np, &dai->name);
+ ret = snd_soc_of_get_dai_name(np, name);
if (ret < 0)
goto parse_error;
@@ -146,7 +147,8 @@ static int asoc_simple_card_parse_of(struct device_node *node,
if (np)
ret = asoc_simple_card_sub_parse_of(np,
&info->cpu_dai,
- &dai_link->cpu_of_node);
+ &dai_link->cpu_of_node,
+ &dai_link->cpu_dai_name);
if (ret < 0)
return ret;
@@ -156,19 +158,21 @@ static int asoc_simple_card_parse_of(struct device_node *node,
if (np)
ret = asoc_simple_card_sub_parse_of(np,
&info->codec_dai,
- &dai_link->codec_of_node);
+ &dai_link->codec_of_node,
+ &dai_link->codec_dai_name);
if (ret < 0)
return ret;
- if (!info->cpu_dai.name || !info->codec_dai.name)
+ if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name)
return -EINVAL;
/* card name is created from CPU/CODEC dai name */
name = devm_kzalloc(dev,
- strlen(info->cpu_dai.name) +
- strlen(info->codec_dai.name) + 2,
+ strlen(dai_link->cpu_dai_name) +
+ strlen(dai_link->codec_dai_name) + 2,
GFP_KERNEL);
- sprintf(name, "%s-%s", info->cpu_dai.name, info->codec_dai.name);
+ sprintf(name, "%s-%s", dai_link->cpu_dai_name,
+ dai_link->codec_dai_name);
info->snd_card.name = name;
dai_link->name = dai_link->stream_name = name;
@@ -178,11 +182,11 @@ static int asoc_simple_card_parse_of(struct device_node *node,
dev_dbg(dev, "card-name : %s\n", name);
dev_dbg(dev, "platform : %04x\n", info->daifmt);
dev_dbg(dev, "cpu : %s / %04x / %d\n",
- info->cpu_dai.name,
+ dai_link->cpu_dai_name,
info->cpu_dai.fmt,
info->cpu_dai.sysclk);
dev_dbg(dev, "codec : %s / %04x / %d\n",
- info->codec_dai.name,
+ dai_link->codec_dai_name,
info->codec_dai.fmt,
info->codec_dai.sysclk);
@@ -240,13 +244,13 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
dai_link->stream_name = cinfo->name;
dai_link->platform_name = cinfo->platform;
dai_link->codec_name = cinfo->codec;
+ dai_link->cpu_dai_name = cinfo->cpu_dai.name;
+ dai_link->codec_dai_name = cinfo->codec_dai.name;
}
/*
* init snd_soc_dai_link
*/
- dai_link->cpu_dai_name = cinfo->cpu_dai.name;
- dai_link->codec_dai_name = cinfo->codec_dai.name;
dai_link->init = asoc_simple_card_dai_init;
snd_soc_card_set_drvdata(&cinfo->snd_card, cinfo);
--
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
next prev parent reply other threads:[~2014-01-15 15:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140115113551.0eb13409@armhf>
2014-01-15 15:51 ` [PATCH v2 1/8] ASoC: simple-card: simplify code Jean-Francois Moine
2014-01-22 19:04 ` Mark Brown
2014-01-15 15:51 ` [PATCH v2 2/8] " Jean-Francois Moine
2014-01-22 19:06 ` Mark Brown
2014-01-15 15:51 ` [PATCH v2 3/8] " Jean-Francois Moine
2014-01-22 19:25 ` Mark Brown
2014-01-15 15:51 ` [PATCH v2 4/8] " Jean-Francois Moine
2014-01-22 19:26 ` Mark Brown
2014-01-15 15:51 ` Jean-Francois Moine [this message]
2014-01-22 19:42 ` [PATCH v2 5/8] " Mark Brown
2014-01-15 15:51 ` [PATCH v2 6/8] " Jean-Francois Moine
2014-01-22 20:05 ` Mark Brown
2014-01-15 15:51 ` [PATCH v2 7/8] " Jean-Francois Moine
2014-01-22 20:06 ` Mark Brown
2014-01-15 15:52 ` [PATCH v2 8/8] " Jean-Francois Moine
2014-01-22 20:06 ` Mark Brown
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=20140115165148.2e0e19f3@armhf \
--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=lgirdwood@gmail.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