Skip to content

Commit 5c0eac0

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-card: add snd_soc_card_late_probe()
Card related function should be implemented at soc-card now. This patch adds it. card has "card->probe" and "card->late_probe" callbacks, and "late_probe" callback is called after "probe". This means, we can set "card->probed" flag afer "late_probe" for all cases. Signed-off-by: Kuninori Morimoto <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 73de4b0 commit 5c0eac0

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

include/sound/soc-card.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ int snd_soc_card_resume_pre(struct snd_soc_card *card);
2525
int snd_soc_card_resume_post(struct snd_soc_card *card);
2626

2727
int snd_soc_card_probe(struct snd_soc_card *card);
28+
int snd_soc_card_late_probe(struct snd_soc_card *card);
2829

2930
/* device driver data */
3031
static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,

sound/soc/soc-card.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,27 @@ int snd_soc_card_probe(struct snd_soc_card *card)
142142

143143
return 0;
144144
}
145+
146+
int snd_soc_card_late_probe(struct snd_soc_card *card)
147+
{
148+
if (card->late_probe) {
149+
int ret = card->late_probe(card);
150+
151+
if (ret < 0)
152+
return soc_card_ret(card, ret);
153+
}
154+
155+
/*
156+
* It has "card->probe" and "card->late_probe" callbacks,
157+
* and "late_probe" callback is called after "probe".
158+
* This means, we can set "card->probed" flag afer "late_probe"
159+
* for all cases.
160+
*
161+
* see
162+
* snd_soc_bind_card()
163+
* snd_soc_card_probe()
164+
*/
165+
card->probed = 1;
166+
167+
return 0;
168+
}

sound/soc/soc-core.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,15 +1910,9 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
19101910
}
19111911
}
19121912

1913-
if (card->late_probe) {
1914-
ret = card->late_probe(card);
1915-
if (ret < 0) {
1916-
dev_err(card->dev, "ASoC: %s late_probe() failed: %d\n",
1917-
card->name, ret);
1918-
goto probe_end;
1919-
}
1920-
}
1921-
card->probed = 1;
1913+
ret = snd_soc_card_late_probe(card);
1914+
if (ret < 0)
1915+
goto probe_end;
19221916

19231917
snd_soc_dapm_new_widgets(card);
19241918

0 commit comments

Comments
 (0)