alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com, vkoul@kernel.org,
	broonie@kernel.org, Bard liao <yung-chuan.liao@linux.intel.com>
Subject: Re: [PATCH 7/7] ASoC: topology: unload physical dai link in remove
Date: Fri, 1 Feb 2019 07:08:59 -0600	[thread overview]
Message-ID: <7b3ec583-ed71-2d88-3a7d-de4cf0cc2bc1@linux.intel.com> (raw)
In-Reply-To: <20190125200648.12470-8-pierre-louis.bossart@linux.intel.com>

Hi Mark,

please discard this version. The changes are good but additional tests 
with module unload/reload expose a missing reset of the dobj.type. Will 
send a v2 shortly (along with a couple of DAPM/topology fixes in the 
ASoC core)

Thanks

-Pierre

On 1/25/19 2:06 PM, Pierre-Louis Bossart wrote:
> From: Bard liao <yung-chuan.liao@linux.intel.com>
>
> soc_tplg_link_config() will find the physical dai link and call
> soc_tplg_dai_link_load() to load the BE dai link. Currently remove_link()
> is only used to remove the FE dai link which is created by the topology.
> The BE dai link cannot however be unloaded in snd_soc_tplg_component
> _remove(), which is problematic if anything needs to be released or
> reinitialized.
>
> This patch aligns the definitions of dynamic types with the existing
> UAPI and adds a new remove_backend_link() routine to unload the the BE
> dai link when snd_soc_tplg_component_remove() is invoked.
>
> Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>   include/sound/soc-topology.h |  1 +
>   sound/soc/soc-topology.c     | 31 +++++++++++++++++++++++++++++++
>   2 files changed, 32 insertions(+)
>
> diff --git a/include/sound/soc-topology.h b/include/sound/soc-topology.h
> index 8c43cfc240fa..5223896de26f 100644
> --- a/include/sound/soc-topology.h
> +++ b/include/sound/soc-topology.h
> @@ -45,6 +45,7 @@ enum snd_soc_dobj_type {
>   	SND_SOC_DOBJ_DAI_LINK,
>   	SND_SOC_DOBJ_PCM,
>   	SND_SOC_DOBJ_CODEC_LINK,
> +	SND_SOC_DOBJ_BACKEND_LINK,
>   };
>   
>   /* dynamic control object */
> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
> index 23d421370e6c..49e6fd76d9bc 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -557,6 +557,24 @@ static void remove_link(struct snd_soc_component *comp,
>   	kfree(link);
>   }
>   
> +/* unload dai link */
> +static void remove_backend_link(struct snd_soc_component *comp,
> +	struct snd_soc_dobj *dobj, int pass)
> +{
> +	if (pass != SOC_TPLG_PASS_LINK)
> +		return;
> +
> +	if (dobj->ops && dobj->ops->link_unload)
> +		dobj->ops->link_unload(comp, dobj);
> +
> +	/*
> +	 * We don't free the link here as what remove_link() do since BE
> +	 * links are not allocated by topology.
> +	 */
> +
> +	list_del(&dobj->list);
> +}
> +
>   /* bind a kcontrol to it's IO handlers */
>   static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
>   	struct snd_kcontrol_new *k,
> @@ -2163,6 +2181,12 @@ static int soc_tplg_link_config(struct soc_tplg *tplg,
>   		return ret;
>   	}
>   
> +	/* for unloading it in snd_soc_tplg_component_remove */
> +	link->dobj.index = tplg->index;
> +	link->dobj.ops = tplg->ops;
> +	link->dobj.type = SND_SOC_DOBJ_BACKEND_LINK;
> +	list_add(&link->dobj.list, &tplg->comp->dobj_list);
> +
>   	return 0;
>   }
>   
> @@ -2649,6 +2673,13 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index)
>   			case SND_SOC_DOBJ_DAI_LINK:
>   				remove_link(comp, dobj, pass);
>   				break;
> +			case SND_SOC_DOBJ_BACKEND_LINK:
> +				/*
> +				 * call link_unload ops if extra
> +				 * deinitialization is needed.
> +				 */
> +				remove_backend_link(comp, dobj, pass);
> +				break;
>   			default:
>   				dev_err(comp->dev, "ASoC: invalid component type %d for removal\n",
>   					dobj->type);

      reply	other threads:[~2019-02-01 13:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 20:06 [PATCH 0/7] ASoC: topology: fixes and improvements Pierre-Louis Bossart
2019-01-25 20:06 ` [PATCH 1/7] ASoC: topology: Reduce number of dereferences when accessing dobj Pierre-Louis Bossart
2019-01-25 20:06 ` [PATCH 2/7] ASoC: topology: Remove widgets from dobj list Pierre-Louis Bossart
2019-01-25 20:06 ` [PATCH 3/7] ASoC: topology: Fix memory leak from soc_tplg_denum_create_texts Pierre-Louis Bossart
2019-01-26 17:43   ` Takashi Iwai
2019-01-28 15:36     ` Pierre-Louis Bossart
2019-01-25 20:06 ` [PATCH 4/7] ASoC: topology: fix memory leak in soc_tplg_dapm_widget_create Pierre-Louis Bossart
2019-01-29 18:12   ` Applied "ASoC: topology: fix memory leak in soc_tplg_dapm_widget_create" to the asoc tree Mark Brown
2019-01-25 20:06 ` [PATCH 5/7] ASoC: topology: add SND_SOC_DOBJ_GRAPH type for dapm routes Pierre-Louis Bossart
2019-01-29 18:12   ` Applied "ASoC: topology: add SND_SOC_DOBJ_GRAPH type for dapm routes" to the asoc tree Mark Brown
2019-01-25 20:06 ` [PATCH 6/7] ASoC: topology: modify dapm route loading routine and add dapm route unloading Pierre-Louis Bossart
2019-01-29 18:12   ` Applied "ASoC: topology: modify dapm route loading routine and add dapm route unloading" to the asoc tree Mark Brown
2019-01-25 20:06 ` [PATCH 7/7] ASoC: topology: unload physical dai link in remove Pierre-Louis Bossart
2019-02-01 13:08   ` Pierre-Louis Bossart [this message]

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=7b3ec583-ed71-2d88-3a7d-de4cf0cc2bc1@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@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).