Commit b9af3fb7 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: soc.h: small cleanups" from Kuninori Morimoto...

Merge series "ASoC: soc.h: small cleanups" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These are small cleanups for soc.h

Kuninori Morimoto (3):
  ASoC: soc.h: add asoc_link_to_cpu/codec/platform() macro
  ASoC: soc.h: fixup return timing for snd_soc_fixup_dai_links_platform_name()
  ASoC: soc.h: return error if multi platform at snd_soc_fixup_dai_links_platform_name()

 include/sound/soc.h | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

--
2.25.1

Thank you for your help !!

Best regards
---
Kuninori Morimoto
parents 99067c07 d908b922
......@@ -716,20 +716,38 @@ struct snd_soc_dai_link {
struct snd_soc_dobj dobj; /* For topology */
#endif
};
static inline struct snd_soc_dai_link_component*
asoc_link_to_cpu(struct snd_soc_dai_link *link, int n) {
return &(link)->cpus[n];
}
static inline struct snd_soc_dai_link_component*
asoc_link_to_codec(struct snd_soc_dai_link *link, int n) {
return &(link)->codecs[n];
}
static inline struct snd_soc_dai_link_component*
asoc_link_to_platform(struct snd_soc_dai_link *link, int n) {
return &(link)->platforms[n];
}
#define for_each_link_codecs(link, i, codec) \
for ((i) = 0; \
((i) < link->num_codecs) && ((codec) = &link->codecs[i]); \
((i) < link->num_codecs) && \
((codec) = asoc_link_to_codec(link, i)); \
(i)++)
#define for_each_link_platforms(link, i, platform) \
for ((i) = 0; \
((i) < link->num_platforms) && \
((platform) = &link->platforms[i]); \
((platform) = asoc_link_to_platform(link, i)); \
(i)++)
#define for_each_link_cpus(link, i, cpu) \
for ((i) = 0; \
((i) < link->num_cpus) && ((cpu) = &link->cpus[i]); \
((i) < link->num_cpus) && \
((cpu) = asoc_link_to_cpu(link, i)); \
(i)++)
/*
......@@ -1262,13 +1280,17 @@ int snd_soc_fixup_dai_links_platform_name(struct snd_soc_card *card,
/* set platform name for each dailink */
for_each_card_prelinks(card, i, dai_link) {
name = devm_kstrdup(card->dev, platform_name, GFP_KERNEL);
if (!name)
return -ENOMEM;
/* only single platform is supported for now */
if (dai_link->num_platforms != 1)
return -EINVAL;
if (!dai_link->platforms)
return -EINVAL;
name = devm_kstrdup(card->dev, platform_name, GFP_KERNEL);
if (!name)
return -ENOMEM;
/* only single platform is supported for now */
dai_link->platforms->name = name;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment