Current ALSA SoC is directly using dai->driver->ops->xxx,
thus, it has deep nested bracket, and it makes code unreadable.
This patch adds new snd_soc_dai_hw_free() and use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y30qhn4w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
 int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
                          struct snd_pcm_substream *substream,
                          struct snd_pcm_hw_params *params);
+void snd_soc_dai_hw_free(struct snd_soc_dai *dai,
+                        struct snd_pcm_substream *substream);
 
 struct snd_soc_dai_ops {
        /*
 
 
        return 0;
 }
+
+void snd_soc_dai_hw_free(struct snd_soc_dai *dai,
+                        struct snd_pcm_substream *substream)
+{
+       if (dai->driver->ops->hw_free)
+               dai->driver->ops->hw_free(substream, dai);
+}
 
                snd_soc_dapm_widget_for_each_source_path(w, path) {
                        source = path->source->priv;
 
-                       if (source->driver->ops->hw_free)
-                               source->driver->ops->hw_free(&substream,
-                                                            source);
+                       snd_soc_dai_hw_free(source, &substream);
 
                        source->active--;
                        if (source->driver->ops->shutdown)
                snd_soc_dapm_widget_for_each_sink_path(w, path) {
                        sink = path->sink->priv;
 
-                       if (sink->driver->ops->hw_free)
-                               sink->driver->ops->hw_free(&substream, sink);
+                       snd_soc_dai_hw_free(sink, &substream);
 
                        sink->active--;
                        if (sink->driver->ops->shutdown)
 
 component_err:
        soc_pcm_components_hw_free(substream, component);
 
-       if (cpu_dai->driver->ops->hw_free)
-               cpu_dai->driver->ops->hw_free(substream, cpu_dai);
+       snd_soc_dai_hw_free(cpu_dai, substream);
        cpu_dai->rate = 0;
 
 interface_err:
                if (!snd_soc_dai_stream_valid(codec_dai, substream->stream))
                        continue;
 
-               if (codec_dai->driver->ops->hw_free)
-                       codec_dai->driver->ops->hw_free(substream, codec_dai);
+               snd_soc_dai_hw_free(codec_dai, substream);
                codec_dai->rate = 0;
        }
 
                if (!snd_soc_dai_stream_valid(codec_dai, substream->stream))
                        continue;
 
-               if (codec_dai->driver->ops->hw_free)
-                       codec_dai->driver->ops->hw_free(substream, codec_dai);
+               snd_soc_dai_hw_free(codec_dai, substream);
        }
 
-       if (cpu_dai->driver->ops->hw_free)
-               cpu_dai->driver->ops->hw_free(substream, cpu_dai);
+       snd_soc_dai_hw_free(cpu_dai, substream);
 
        mutex_unlock(&rtd->pcm_mutex);
        return 0;