summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2014-01-15 16:51:48 +0100
committerDarren Etheridge <detheridge@ti.com>2014-06-20 15:15:05 -0500
commit243225929bfbaad1cb87052d82878006806f7335 (patch)
treee534875f4ac06bb106dc8e547019228358fa1553 /sound
parentf78d2c246072666a2224e5125c7b5d688ebeb8fe (diff)
ASoC: simple-card: simplify code
[ Upstream commit b367a3252b365fd545fc589a40cad3976e73d7d7 45fce59496cbabd46761e6980c05c82d94d08eaa ca65b492c7a265b220f763fd68bf87391213248f 520084729267ac8df1651ad2f118a1d4a631a10a 5ca8ba4180a6f629d51dba699b4a6428cc5eeba7 201a0eac7fe5e7a8fa33f0742304f885bc344d0d 2bee991460a838ee3c8064a6d880c4e7bc41717a 7722f830a45f7fbb8f2f7b23265793980bdf3397 ] 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> Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Darren Etheridge <detheridge@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 797696fc6f1..9068ab474ab 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);