ASoC: add for_each_card_prelinks() macro

To be more readable code, this patch adds
new for_each_card_prelinks() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto
2018-09-18 01:28:49 +00:00
committed by Mark Brown
parent 6d11b12879
commit 7fe072b4df
16 changed files with 73 additions and 66 deletions

View File

@@ -25,13 +25,12 @@ static int apq8096_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
static void apq8096_add_be_ops(struct snd_soc_card *card)
{
struct snd_soc_dai_link *link = card->dai_link;
int i, num_links = card->num_links;
struct snd_soc_dai_link *link;
int i;
for (i = 0; i < num_links; i++) {
for_each_card_prelinks(card, i, link) {
if (link->no_pcm == 1)
link->be_hw_params_fixup = apq8096_be_hw_params_fixup;
link++;
}
}

View File

@@ -195,15 +195,14 @@ static int sdm845_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
static void sdm845_add_be_ops(struct snd_soc_card *card)
{
struct snd_soc_dai_link *link = card->dai_link;
int i, num_links = card->num_links;
struct snd_soc_dai_link *link;
int i;
for (i = 0; i < num_links; i++) {
for_each_card_prelinks(card, i, link) {
if (link->no_pcm == 1) {
link->ops = &sdm845_be_ops;
link->be_hw_params_fixup = sdm845_be_hw_params_fixup;
}
link++;
}
}