ASoC: soc-dai: add snd_soc_dai_remove()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 22 Jul 2019 01:35:05 +0000 (10:35 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 23 Jul 2019 17:14:24 +0000 (18:14 +0100)
Current ALSA SoC is directly using dai->driver->xxx,
thus, it has deep nested bracket, and it makes code unreadable.
This patch adds new snd_soc_dai_remvoe() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imruhn1x.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dai.h
sound/soc/soc-core.c
sound/soc/soc-dai.c

index da8d8b8890893bd714c8302b6546629344153d5e..2a11f177ce0135a0ee6aceedc8881f09bfdfa853 100644 (file)
@@ -165,6 +165,7 @@ snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai,
 void snd_soc_dai_suspend(struct snd_soc_dai *dai);
 void snd_soc_dai_resume(struct snd_soc_dai *dai);
 int snd_soc_dai_probe(struct snd_soc_dai *dai);
+int snd_soc_dai_remove(struct snd_soc_dai *dai);
 
 struct snd_soc_dai_ops {
        /*
index 3e73468225f9898967e7ea1d21547f381120a3f1..727fd342b3fbca1a1ba04afbdc7aa243687a3455 100644 (file)
@@ -992,13 +992,12 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order)
            dai->driver->remove_order != order)
                return;
 
-       if (dai->driver->remove) {
-               err = dai->driver->remove(dai);
-               if (err < 0)
-                       dev_err(dai->dev,
-                               "ASoC: failed to remove %s: %d\n",
-                               dai->name, err);
-       }
+       err = snd_soc_dai_remove(dai);
+       if (err < 0)
+               dev_err(dai->dev,
+                       "ASoC: failed to remove %s: %d\n",
+                       dai->name, err);
+
        dai->probed = 0;
 }
 
index 55c1fac9961361980d8f54156e803bc9d179e7b1..384765c747daebb9593b506f7d69f66f2da5e678 100644 (file)
@@ -372,3 +372,10 @@ int snd_soc_dai_probe(struct snd_soc_dai *dai)
                return dai->driver->probe(dai);
        return 0;
 }
+
+int snd_soc_dai_remove(struct snd_soc_dai *dai)
+{
+       if (dai->driver->remove)
+               return dai->driver->remove(dai);
+       return 0;
+}