diff mbox series

[v2,01/10] ASoC: wm_adsp: Remove the wmfw_add_ctl helper function

Message ID 20211117132300.1290-1-ckeepax@opensource.cirrus.com (mailing list archive)
State Accepted
Commit 56717d72f7a811799e8d138ff3d49325272c5cf6
Headers show
Series [v2,01/10] ASoC: wm_adsp: Remove the wmfw_add_ctl helper function | expand

Commit Message

Charles Keepax Nov. 17, 2021, 1:22 p.m. UTC
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(-)

Comments

Mark Brown Nov. 17, 2021, 10:31 p.m. UTC | #1
On Wed, 17 Nov 2021 13:22:51 +0000, Charles Keepax wrote:
> 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.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[01/10] ASoC: wm_adsp: Remove the wmfw_add_ctl helper function
        commit: 56717d72f7a811799e8d138ff3d49325272c5cf6
[02/10] firmware: cs_dsp: Add lockdep asserts to interface functions
        commit: 5065cfabec21a4acf562932f1d0a814c119e0a69
[03/10] firmware: cs_dsp: Add version checks on coefficient loading
        commit: 2925748eadc33cba3bded7b69475a1b002b124ac
[04/10] firmware: cs_dsp: Add pre_run callback
        commit: 14055b5a3a23204c4702ae5d3f2a819ee081ce33
[05/10] firmware: cs_dsp: Print messages from bin files
        commit: 40a34ae7308682bbbf5827145afa23dcdfb1f090
[06/10] firmware: cs_dsp: Add support for rev 2 coefficient files
        commit: dcee767667f44ed0d40a3debf507a3ba027a1994
[07/10] firmware: cs_dsp: Perform NULL check in cs_dsp_coeff_write/read_ctrl
        commit: 86c6080407740937ed2ba0ccd181e947f77e2154
[08/10] firmware: cs_dsp: Clarify some kernel doc comments
        commit: b329b3d39497a9fdb175d7e4fd77ae7170d5d26c
[09/10] firmware: cs_dsp: Add offset to cs_dsp read/write
        commit: f444da38ac924748de696c393327a44c4b8d727e
[10/10] firmware: cs_dsp: Allow creation of event controls
        commit: 5c903f64ce97172d63f7591cfa9e37cba58867b2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

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)