]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ASoC: soc-component: add snd_soc_pcm_component_hw_free()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 4 Jun 2020 08:07:24 +0000 (17:07 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 15 Jun 2020 17:21:23 +0000 (18:21 +0100)
We have 2 type of component functions
snd_soc_component_xxx()     is focusing to component itself,
snd_soc_pcm_component_xxx() is focusing to rtd related component.

Now we can update snd_soc_component_hw_free() to
snd_soc_pcm_component_hw_free(). This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87lfl3w8xv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-component.h
sound/soc/soc-component.c
sound/soc/soc-pcm.c

index a2898bdd0a3c576ec0ea398228eddcb572f157fd..d2f62d529559177cd224b2779882573ddb6e186b 100644 (file)
@@ -426,8 +426,6 @@ int snd_soc_component_open(struct snd_soc_component *component,
                           struct snd_pcm_substream *substream);
 int snd_soc_component_close(struct snd_soc_component *component,
                            struct snd_pcm_substream *substream);
-int snd_soc_component_hw_free(struct snd_soc_component *component,
-                             struct snd_pcm_substream *substream);
 int snd_soc_component_trigger(struct snd_soc_component *component,
                              struct snd_pcm_substream *substream,
                              int cmd);
@@ -459,5 +457,7 @@ int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream);
 int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
                                    struct snd_pcm_hw_params *params,
                                    struct snd_soc_component **last);
+void snd_soc_pcm_component_hw_free(struct snd_pcm_substream *substream,
+                                  struct snd_soc_component *last);
 
 #endif /* __SOC_COMPONENT_H */
index 56341968fe6d148fe7554f7f78041b38926f0010..380f6459b5cb9185f56cef7c4a322b7037a74312 100644 (file)
@@ -275,17 +275,6 @@ int snd_soc_component_close(struct snd_soc_component *component,
        return soc_component_ret(component, ret);
 }
 
-int snd_soc_component_hw_free(struct snd_soc_component *component,
-                              struct snd_pcm_substream *substream)
-{
-       int ret = 0;
-
-       if (component->driver->hw_free)
-               ret = component->driver->hw_free(component, substream);
-
-       return soc_component_ret(component, ret);
-}
-
 int snd_soc_component_trigger(struct snd_soc_component *component,
                              struct snd_pcm_substream *substream,
                              int cmd)
@@ -585,3 +574,22 @@ int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
        *last = NULL;
        return 0;
 }
+
+void snd_soc_pcm_component_hw_free(struct snd_pcm_substream *substream,
+                                  struct snd_soc_component *last)
+{
+       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_component *component;
+       int i, ret;
+
+       for_each_rtd_components(rtd, i, component) {
+               if (component == last)
+                       break;
+
+               if (component->driver->hw_free) {
+                       ret = component->driver->hw_free(component, substream);
+                       if (ret < 0)
+                               soc_component_ret(component, ret);
+               }
+       }
+}
index e5eef48af167d6cc054338aedc1ade263e818a79..cbce15c5721ee1666df35d7f518403a6d91f3729 100644 (file)
@@ -898,25 +898,6 @@ static void soc_pcm_codec_params_fixup(struct snd_pcm_hw_params *params,
        interval->max = channels;
 }
 
-static int soc_pcm_components_hw_free(struct snd_pcm_substream *substream,
-                                     struct snd_soc_component *last)
-{
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_component *component;
-       int i, r, ret = 0;
-
-       for_each_rtd_components(rtd, i, component) {
-               if (component == last)
-                       break;
-
-               r = snd_soc_component_hw_free(component, substream);
-               if (r < 0)
-                       ret = r; /* use last ret */
-       }
-
-       return ret;
-}
-
 /*
  * Called by ALSA when the hardware params are set by application. This
  * function can also be called multiple times and can allocate buffers
@@ -1018,7 +999,7 @@ out:
        return ret;
 
 component_err:
-       soc_pcm_components_hw_free(substream, component);
+       snd_soc_pcm_component_hw_free(substream, component);
 
        i = rtd->num_cpus;
 
@@ -1077,7 +1058,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
        snd_soc_link_hw_free(substream);
 
        /* free any component resources */
-       soc_pcm_components_hw_free(substream, NULL);
+       snd_soc_pcm_component_hw_free(substream, NULL);
 
        /* now free hw params for the DAIs  */
        for_each_rtd_dais(rtd, i, dai) {