Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Mark Brown" <broonie@kernel.org>
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
	Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH 11/11] ASoC: topology: Unify kcontrol removal code
Date: Wed, 25 Jan 2023 09:15:15 -0600	[thread overview]
Message-ID: <40207a2a-3f2a-bbef-74f6-9e85ced3150a@linux.intel.com> (raw)
In-Reply-To: <20230125194649.3485731-12-amadeuszx.slawinski@linux.intel.com>



On 1/25/23 13:46, Amadeusz Sławiński wrote:
> Functions removing bytes, enum and mixer kcontrols are identical. Unify

they are identical because of the change in patch10.

Please clarify that this is not a cleanup removing duplicated code
that's been there forever, it's become useless as a result of the
previous patch.

> them under one function and use it to free associated kcontrols.
> 
> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> ---
>  sound/soc/soc-topology.c | 48 +++++-----------------------------------
>  1 file changed, 6 insertions(+), 42 deletions(-)
> 
> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
> index eb49037d86ae..e66b0d9e387a 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -350,41 +350,9 @@ static int soc_tplg_add_kcontrol(struct soc_tplg *tplg,
>  				tplg->dev, k, comp->name_prefix, comp, kcontrol);
>  }
>  
> -/* remove a mixer kcontrol */
> -static void soc_tplg_remove_mixer(struct snd_soc_component *comp,
> -	struct snd_soc_dobj *dobj, int pass)
> -{
> -	struct snd_card *card = comp->card->snd_card;
> -
> -	if (pass != SOC_TPLG_PASS_CONTROL)
> -		return;
> -
> -	if (dobj->unload)
> -		dobj->unload(comp, dobj);
> -
> -	snd_ctl_remove(card, dobj->control.kcontrol);
> -	list_del(&dobj->list);
> -}
> -
> -/* remove an enum kcontrol */
> -static void soc_tplg_remove_enum(struct snd_soc_component *comp,
> -	struct snd_soc_dobj *dobj, int pass)
> -{
> -	struct snd_card *card = comp->card->snd_card;
> -
> -	if (pass != SOC_TPLG_PASS_CONTROL)
> -		return;
> -
> -	if (dobj->unload)
> -		dobj->unload(comp, dobj);
> -
> -	snd_ctl_remove(card, dobj->control.kcontrol);
> -	list_del(&dobj->list);
> -}
> -
> -/* remove a byte kcontrol */
> -static void soc_tplg_remove_bytes(struct snd_soc_component *comp,
> -	struct snd_soc_dobj *dobj, int pass)
> +/* remove kcontrol */
> +static void soc_tplg_remove_kcontrol(struct snd_soc_component *comp, struct snd_soc_dobj *dobj,
> +				     int pass)
>  {
>  	struct snd_card *card = comp->card->snd_card;
>  
> @@ -2626,14 +2594,10 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp)
>  			list) {
>  
>  			switch (dobj->type) {
> -			case SND_SOC_DOBJ_MIXER:
> -				soc_tplg_remove_mixer(comp, dobj, pass);
> -				break;
> -			case SND_SOC_DOBJ_ENUM:
> -				soc_tplg_remove_enum(comp, dobj, pass);
> -				break;
>  			case SND_SOC_DOBJ_BYTES:
> -				soc_tplg_remove_bytes(comp, dobj, pass);
> +			case SND_SOC_DOBJ_ENUM:
> +			case SND_SOC_DOBJ_MIXER:
> +				soc_tplg_remove_kcontrol(comp, dobj, pass);
>  				break;
>  			case SND_SOC_DOBJ_GRAPH:
>  				soc_tplg_remove_route(comp, dobj, pass);

  reply	other threads:[~2023-01-25 15:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 19:46 [PATCH 00/11] ASoC: topology: Fixes and cleanups Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 01/11] ASoC: topology: Properly access value coming from topology file Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 02/11] ASoC: topology: Remove unused SOC_TPLG_PASS_PINS constant Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 03/11] ASoC: topology: Fix typo in functions name Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 04/11] ASoC: topology: Fix function name Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 05/11] ASoC: topology: Rename remove_ handlers Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 06/11] ASoC: topology: Remove unnecessary forward declarations Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 07/11] ASoC: topology: Pass correct pointer instead of casting Amadeusz Sławiński
2023-01-25 15:05   ` Pierre-Louis Bossart
2023-01-25 19:46 ` [PATCH 08/11] ASoC: topology: Return an error on complete() failure Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 09/11] ASoC: Topology: Remove unnecessary check for EOF Amadeusz Sławiński
2023-01-25 19:46 ` [PATCH 10/11] ASoC: topology: Use unload() op directly Amadeusz Sławiński
2023-01-25 15:13   ` Pierre-Louis Bossart
2023-01-25 19:46 ` [PATCH 11/11] ASoC: topology: Unify kcontrol removal code Amadeusz Sławiński
2023-01-25 15:15   ` Pierre-Louis Bossart [this message]
2023-01-27 11:12     ` Amadeusz Sławiński
2023-01-27 13:38       ` Pierre-Louis Bossart
2023-01-27 15:09         ` Amadeusz Sławiński
2023-01-25 20:15 ` [PATCH 00/11] ASoC: topology: Fixes and cleanups Ranjani Sridharan

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=40207a2a-3f2a-bbef-74f6-9e85ced3150a@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=tiwai@suse.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