ASoC: meson: Use snd_soc_of_parse_aux_devs()
authorStephan Gerhold <stephan@gerhold.net>
Sat, 1 Aug 2020 10:02:57 +0000 (12:02 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 18 Aug 2020 13:52:40 +0000 (14:52 +0100)
Use the new common snd_soc_of_parse_aux_devs() helper function
to parse auxiliary devices from the device tree. The new helper
is just a copy of meson_card_add_aux_devices() so there is no
functional change.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200801100257.22658-3-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/meson/meson-card-utils.c

index 6a64ac01b5ca6a15fef48b6b6ec6db7b8367b9bd..300ac8be46ef8c62cee0fb5bd51627de6383949f 100644 (file)
@@ -254,37 +254,6 @@ static int meson_card_parse_of_optional(struct snd_soc_card *card,
        return func(card, propname);
 }
 
-static int meson_card_add_aux_devices(struct snd_soc_card *card)
-{
-       struct device_node *node = card->dev->of_node;
-       struct snd_soc_aux_dev *aux;
-       int num, i;
-
-       num = of_count_phandle_with_args(node, "audio-aux-devs", NULL);
-       if (num == -ENOENT) {
-               return 0;
-       } else if (num < 0) {
-               dev_err(card->dev, "error getting auxiliary devices: %d\n",
-                       num);
-               return num;
-       }
-
-       aux = devm_kcalloc(card->dev, num, sizeof(*aux), GFP_KERNEL);
-       if (!aux)
-               return -ENOMEM;
-       card->aux_dev = aux;
-       card->num_aux_devs = num;
-
-       for_each_card_pre_auxs(card, i, aux) {
-               aux->dlc.of_node =
-                       of_parse_phandle(node, "audio-aux-devs", i);
-               if (!aux->dlc.of_node)
-                       return -EINVAL;
-       }
-
-       return 0;
-}
-
 static void meson_card_clean_references(struct meson_card *priv)
 {
        struct snd_soc_card *card = &priv->card;
@@ -357,7 +326,7 @@ int meson_card_probe(struct platform_device *pdev)
        if (ret)
                goto out_err;
 
-       ret = meson_card_add_aux_devices(&priv->card);
+       ret = snd_soc_of_parse_aux_devs(&priv->card, "audio-aux-devs");
        if (ret)
                goto out_err;