aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-07-01 16:13:46 -0400
committerMark Brown <broonie@linaro.org>2014-07-02 16:24:07 -0400
commit48f466d112c9ca735ee765d8f5148d07a8c7bb1d (patch)
tree6a2bb9238d2135d40719df44ea686da1a1fee299
parentb8257be5fff447681af8c8b72f1380e8a9c04286 (diff)
ASoC: core: Replace soc_find_matching_codec() with soc_find_codec()
soc_find_matching_codec() works in the same way as soc_find_codec() except that it only works for auxdevs. It can easily be replaced by the generic soc_find_codec(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/soc-core.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 0cd36b781f4d..c8bdac2db377 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1649,32 +1649,13 @@ static void soc_unregister_ac97_dai_link(struct snd_soc_pcm_runtime *rtd)
1649} 1649}
1650#endif 1650#endif
1651 1651
1652static struct snd_soc_codec *soc_find_matching_codec(struct snd_soc_card *card,
1653 int num)
1654{
1655 struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
1656 struct snd_soc_codec *codec;
1657
1658 /* find CODEC from registered CODECs */
1659 list_for_each_entry(codec, &codec_list, list) {
1660 if (aux_dev->codec_of_node &&
1661 (codec->dev->of_node != aux_dev->codec_of_node))
1662 continue;
1663 if (aux_dev->codec_name &&
1664 strcmp(codec->component.name, aux_dev->codec_name))
1665 continue;
1666 return codec;
1667 }
1668
1669 return NULL;
1670}
1671
1672static int soc_check_aux_dev(struct snd_soc_card *card, int num) 1652static int soc_check_aux_dev(struct snd_soc_card *card, int num)
1673{ 1653{
1674 struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num]; 1654 struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
1675 const char *codecname = aux_dev->codec_name; 1655 const char *codecname = aux_dev->codec_name;
1676 struct snd_soc_codec *codec = soc_find_matching_codec(card, num); 1656 struct snd_soc_codec *codec;
1677 1657
1658 codec = soc_find_codec(aux_dev->codec_of_node, aux_dev->codec_name);
1678 if (codec) 1659 if (codec)
1679 return 0; 1660 return 0;
1680 if (aux_dev->codec_of_node) 1661 if (aux_dev->codec_of_node)
@@ -1689,8 +1670,9 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
1689 struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num]; 1670 struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
1690 const char *codecname = aux_dev->codec_name; 1671 const char *codecname = aux_dev->codec_name;
1691 int ret = -ENODEV; 1672 int ret = -ENODEV;
1692 struct snd_soc_codec *codec = soc_find_matching_codec(card, num); 1673 struct snd_soc_codec *codec;
1693 1674
1675 codec = soc_find_codec(aux_dev->codec_of_node, aux_dev->codec_name);
1694 if (!codec) { 1676 if (!codec) {
1695 if (aux_dev->codec_of_node) 1677 if (aux_dev->codec_of_node)
1696 codecname = of_node_full_name(aux_dev->codec_of_node); 1678 codecname = of_node_full_name(aux_dev->codec_of_node);