All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 01/10] ASoC: wm_adsp: Remove the wmfw_add_ctl helper function
@ 2021-11-17 13:22 Charles Keepax
  2021-11-17 13:22 ` [PATCH v2 02/10] firmware: cs_dsp: Add lockdep asserts to interface functions Charles Keepax
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Charles Keepax @ 2021-11-17 13:22 UTC (permalink / raw)
  To: broonie; +Cc: patches, alsa-devel, lgirdwood

The helper function wmfw_add_ctl is only called from one place and that
place is a function with only 2 lines of code. Merge the helper function
into the work function to simplify the code.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/codecs/wm_adsp.c | 33 +++++++++------------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index d4f0d72cbcc80..404717e30f44d 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -537,15 +537,20 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len)
 	return out;
 }
 
-static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl)
+static void wm_adsp_ctl_work(struct work_struct *work)
 {
+	struct wm_coeff_ctl *ctl = container_of(work,
+						struct wm_coeff_ctl,
+						work);
 	struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
+	struct wm_adsp *dsp = container_of(cs_ctl->dsp,
+					   struct wm_adsp,
+					   cs_dsp);
 	struct snd_kcontrol_new *kcontrol;
-	int ret;
 
 	kcontrol = kzalloc(sizeof(*kcontrol), GFP_KERNEL);
 	if (!kcontrol)
-		return -ENOMEM;
+		return;
 
 	kcontrol->name = ctl->name;
 	kcontrol->info = wm_coeff_info;
@@ -571,29 +576,9 @@ static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl)
 		break;
 	}
 
-	ret = snd_soc_add_component_controls(dsp->component, kcontrol, 1);
-	if (ret < 0)
-		goto err_kcontrol;
+	snd_soc_add_component_controls(dsp->component, kcontrol, 1);
 
 	kfree(kcontrol);
-
-	return 0;
-
-err_kcontrol:
-	kfree(kcontrol);
-	return ret;
-}
-
-static void wm_adsp_ctl_work(struct work_struct *work)
-{
-	struct wm_coeff_ctl *ctl = container_of(work,
-						struct wm_coeff_ctl,
-						work);
-	struct wm_adsp *dsp = container_of(ctl->cs_ctl->dsp,
-					   struct wm_adsp,
-					   cs_dsp);
-
-	wmfw_add_ctl(dsp, ctl);
 }
 
 static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-11-17 22:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 13:22 [PATCH v2 01/10] ASoC: wm_adsp: Remove the wmfw_add_ctl helper function Charles Keepax
2021-11-17 13:22 ` [PATCH v2 02/10] firmware: cs_dsp: Add lockdep asserts to interface functions Charles Keepax
2021-11-17 13:22 ` [PATCH v2 03/10] firmware: cs_dsp: Add version checks on coefficient loading Charles Keepax
2021-11-17 13:22 ` [PATCH v2 04/10] firmware: cs_dsp: Add pre_run callback Charles Keepax
2021-11-17 13:22 ` [PATCH v2 05/10] firmware: cs_dsp: Print messages from bin files Charles Keepax
2021-11-17 13:22 ` [PATCH v2 06/10] firmware: cs_dsp: Add support for rev 2 coefficient files Charles Keepax
2021-11-17 13:22 ` [PATCH v2 07/10] firmware: cs_dsp: Perform NULL check in cs_dsp_coeff_write/read_ctrl Charles Keepax
2021-11-17 13:22 ` [PATCH v2 08/10] firmware: cs_dsp: Clarify some kernel doc comments Charles Keepax
2021-11-17 13:22 ` [PATCH v2 09/10] firmware: cs_dsp: Add offset to cs_dsp read/write Charles Keepax
2021-11-17 13:23 ` [PATCH v2 10/10] firmware: cs_dsp: Allow creation of event controls Charles Keepax
2021-11-17 22:31 ` [PATCH v2 01/10] ASoC: wm_adsp: Remove the wmfw_add_ctl helper function Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.