From: Cezary Rojewski <cezary.rojewski@intel.com>
To: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
Cc: alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Jie Yang <yang.jie@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 08/14] ASoC: Intel: Skylake: Properly cleanup on component removal
Date: Mon, 10 Jun 2019 09:17:21 +0200 [thread overview]
Message-ID: <36e24c2a-feb4-4c6f-7bc5-76b13ff625a3@intel.com> (raw)
In-Reply-To: <20190605134556.10322-9-amadeuszx.slawinski@linux.intel.com>
On 2019-06-05 15:45, Amadeusz Sławiński wrote:
> When we remove component we need to reverse things which were done on
> init, this consists of topology cleanup, lists cleanup and releasing
> firmware.
>
> Currently cleanup handlers are put in wrong places or otherwise missing.
> So add proper component cleanup function and perform cleanups in it.
>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> ---
> sound/soc/intel/skylake/skl-pcm.c | 8 ++++++--
> sound/soc/intel/skylake/skl-topology.c | 15 +++++++++++++++
> sound/soc/intel/skylake/skl-topology.h | 2 ++
> sound/soc/intel/skylake/skl.c | 2 --
> 4 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
> index 44062806fbed..7e8110c15258 100644
> --- a/sound/soc/intel/skylake/skl-pcm.c
> +++ b/sound/soc/intel/skylake/skl-pcm.c
> @@ -1459,8 +1459,12 @@ static int skl_platform_soc_probe(struct snd_soc_component *component)
>
> static void skl_pcm_remove(struct snd_soc_component *component)
> {
> - /* remove topology */
> - snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL);
> + struct hdac_bus *bus = dev_get_drvdata(component->dev);
> + struct skl *skl = bus_to_skl(bus);
> +
> + skl_tplg_exit(component, bus);
> +
> + skl_debugfs_exit(skl);
> }
>
> static const struct snd_soc_component_driver skl_component = {
> diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
> index 44f3b29a7210..3964262109ac 100644
> --- a/sound/soc/intel/skylake/skl-topology.c
> +++ b/sound/soc/intel/skylake/skl-topology.c
> @@ -3748,3 +3748,18 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
>
> return 0;
> }
> +
> +void skl_tplg_exit(struct snd_soc_component *component, struct hdac_bus *bus)
> +{
> + struct skl *skl = bus_to_skl(bus);
> + struct skl_pipeline *ppl, *tmp;
> +
> + if (!list_empty(&skl->ppl_list))
> + list_for_each_entry_safe(ppl, tmp, &skl->ppl_list, node)
> + list_del(&ppl->node);
> +
> + /* clean up topology */
> + snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL);
> +
> + release_firmware(skl->tplg);
> +}
In debugfs cleanup patch:
[PATCH 07/14] ASoC: Intel: Skylake: Add function to cleanup debugfs
interface
you define skl_debugfs_exit separately - its usage is split and present
in this very patch instead. However, for tplg counterpart -
skl_tplg_exit - you've decided to combine both together. Why not
separate tplg cleanup too?
> diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h
> index 82282cac9751..7d32c61c73e7 100644
> --- a/sound/soc/intel/skylake/skl-topology.h
> +++ b/sound/soc/intel/skylake/skl-topology.h
> @@ -471,6 +471,8 @@ void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
> struct skl_pipe_params *params, int stream);
> int skl_tplg_init(struct snd_soc_component *component,
> struct hdac_bus *ebus);
> +void skl_tplg_exit(struct snd_soc_component *component,
> + struct hdac_bus *bus);
> struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
> struct snd_soc_dai *dai, int stream);
> int skl_tplg_update_pipe_params(struct device *dev,
> diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
> index 6d6401410250..e4881ff427ea 100644
> --- a/sound/soc/intel/skylake/skl.c
> +++ b/sound/soc/intel/skylake/skl.c
> @@ -1119,14 +1119,12 @@ static void skl_remove(struct pci_dev *pci)
> struct skl *skl = bus_to_skl(bus);
>
> cancel_work_sync(&skl->probe_work);
> - release_firmware(skl->tplg);
>
> pm_runtime_get_noresume(&pci->dev);
>
> /* codec removal, invoke bus_device_remove */
> snd_hdac_ext_bus_device_remove(bus);
>
> - skl->debugfs = NULL;
> skl_platform_unregister(&pci->dev);
> skl_free_dsp(skl);
> skl_machine_device_unregister(skl);
>
next prev parent reply other threads:[~2019-06-10 7:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 13:45 [PATCH 00/14] Fix driver reload issues Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 01/14] ASoC: Intel: Skylake: Initialize lists before access so they are safe to use Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 02/14] ALSA: hdac: fix memory release for SST and SOF drivers Amadeusz Sławiński
2019-06-05 15:06 ` Pierre-Louis Bossart
2019-06-06 12:57 ` [alsa-devel] " Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 03/14] ALSA: hdac: Fix codec name after machine driver is unloaded and reloaded Amadeusz Sławiński
2019-06-05 15:13 ` [alsa-devel] " Pierre-Louis Bossart
2019-06-05 13:45 ` [PATCH 04/14] ASoC: compress: Fix memory leak from snd_soc_new_compress Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 05/14] ASoC: Intel: Skylake: Don't return failure on machine driver reload Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 06/14] ASoC: Intel: Skylake: Remove static table index when parsing topology Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 07/14] ASoC: Intel: Skylake: Add function to cleanup debugfs interface Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 08/14] ASoC: Intel: Skylake: Properly cleanup on component removal Amadeusz Sławiński
2019-06-10 7:17 ` Cezary Rojewski [this message]
2019-06-10 8:23 ` [alsa-devel] " Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 09/14] ASoC: Intel: Skylake: Fix NULL ptr dereference when unloading clk dev Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 10/14] SoC: rt274: Fix internal jack assignment in set_jack callback Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 11/14] ASoC: core: Tell codec that jack is being removed Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 12/14] ASoC: Intel: hdac_hdmi: Set ops to NULL on remove Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 13/14] ASoC: topology: Consolidate how dtexts and dvalues are freed Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 14/14] ASoC: topology: Consolidate and fix asoc_tplg_dapm_widget_*_create flow Amadeusz Sławiński
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36e24c2a-feb4-4c6f-7bc5-76b13ff625a3@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.com \
--cc=yang.jie@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).