diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2014-01-15 10:51:37 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-02-03 07:45:33 -0500 |
commit | 2bee991460a838ee3c8064a6d880c4e7bc41717a (patch) | |
tree | 04b440fb99fa1eb30eda494d81fdae56388bc9cc /sound/soc/generic | |
parent | 7722f830a45f7fbb8f2f7b23265793980bdf3397 (diff) |
ASoC: simple-card: simplify code
The DT values are copied to the non-DT structure before being moved to
the card structure.
Set directly the DT values in the card and move the non-DT copy to the
non-DT sequence.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/generic')
-rw-r--r-- | sound/soc/generic/simple-card.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index f0784ca4d3c8..7c5dc7336c0b 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -169,12 +169,13 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
169 | strlen(info->codec_dai.name) + 2, | 169 | strlen(info->codec_dai.name) + 2, |
170 | GFP_KERNEL); | 170 | GFP_KERNEL); |
171 | sprintf(name, "%s-%s", info->cpu_dai.name, info->codec_dai.name); | 171 | sprintf(name, "%s-%s", info->cpu_dai.name, info->codec_dai.name); |
172 | info->name = info->card = name; | 172 | info->snd_card.name = name; |
173 | info->snd_link.name = info->snd_link.stream_name = name; | ||
173 | 174 | ||
174 | /* simple-card assumes platform == cpu */ | 175 | /* simple-card assumes platform == cpu */ |
175 | *of_platform = *of_cpu; | 176 | *of_platform = *of_cpu; |
176 | 177 | ||
177 | dev_dbg(dev, "card-name : %s\n", info->card); | 178 | dev_dbg(dev, "card-name : %s\n", name); |
178 | dev_dbg(dev, "platform : %04x\n", info->daifmt); | 179 | dev_dbg(dev, "platform : %04x\n", info->daifmt); |
179 | dev_dbg(dev, "cpu : %s / %04x / %d\n", | 180 | dev_dbg(dev, "cpu : %s / %04x / %d\n", |
180 | info->cpu_dai.name, | 181 | info->cpu_dai.name, |
@@ -217,6 +218,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev) | |||
217 | dev_err(dev, "parse error %d\n", ret); | 218 | dev_err(dev, "parse error %d\n", ret); |
218 | return ret; | 219 | return ret; |
219 | } | 220 | } |
221 | cinfo->snd_link.cpu_of_node = of_cpu; | ||
222 | cinfo->snd_link.codec_of_node = of_codec; | ||
223 | cinfo->snd_link.platform_of_node = of_platform; | ||
220 | } else { | 224 | } else { |
221 | if (!dev->platform_data) { | 225 | if (!dev->platform_data) { |
222 | dev_err(dev, "no info for asoc-simple-card\n"); | 226 | dev_err(dev, "no info for asoc-simple-card\n"); |
@@ -235,26 +239,24 @@ static int asoc_simple_card_probe(struct platform_device *pdev) | |||
235 | dev_err(dev, "insufficient asoc_simple_card_info settings\n"); | 239 | dev_err(dev, "insufficient asoc_simple_card_info settings\n"); |
236 | return -EINVAL; | 240 | return -EINVAL; |
237 | } | 241 | } |
242 | |||
243 | cinfo->snd_card.name = cinfo->card; | ||
244 | cinfo->snd_link.name = cinfo->name; | ||
245 | cinfo->snd_link.stream_name = cinfo->name; | ||
246 | cinfo->snd_link.platform_name = cinfo->platform; | ||
247 | cinfo->snd_link.codec_name = cinfo->codec; | ||
238 | } | 248 | } |
239 | 249 | ||
240 | /* | 250 | /* |
241 | * init snd_soc_dai_link | 251 | * init snd_soc_dai_link |
242 | */ | 252 | */ |
243 | cinfo->snd_link.name = cinfo->name; | ||
244 | cinfo->snd_link.stream_name = cinfo->name; | ||
245 | cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai.name; | 253 | cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai.name; |
246 | cinfo->snd_link.platform_name = cinfo->platform; | ||
247 | cinfo->snd_link.codec_name = cinfo->codec; | ||
248 | cinfo->snd_link.codec_dai_name = cinfo->codec_dai.name; | 254 | cinfo->snd_link.codec_dai_name = cinfo->codec_dai.name; |
249 | cinfo->snd_link.cpu_of_node = of_cpu; | ||
250 | cinfo->snd_link.codec_of_node = of_codec; | ||
251 | cinfo->snd_link.platform_of_node = of_platform; | ||
252 | cinfo->snd_link.init = asoc_simple_card_dai_init; | 255 | cinfo->snd_link.init = asoc_simple_card_dai_init; |
253 | 256 | ||
254 | /* | 257 | /* |
255 | * init snd_soc_card | 258 | * init snd_soc_card |
256 | */ | 259 | */ |
257 | cinfo->snd_card.name = cinfo->card; | ||
258 | cinfo->snd_card.owner = THIS_MODULE; | 260 | cinfo->snd_card.owner = THIS_MODULE; |
259 | cinfo->snd_card.dai_link = &cinfo->snd_link; | 261 | cinfo->snd_card.dai_link = &cinfo->snd_link; |
260 | cinfo->snd_card.num_links = 1; | 262 | cinfo->snd_card.num_links = 1; |