Commit 56717d72 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: wm_adsp: Remove the wmfw_add_ctl helper function

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: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211117132300.1290-1-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7fabe7fe
...@@ -537,15 +537,20 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len) ...@@ -537,15 +537,20 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len)
return out; 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 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; struct snd_kcontrol_new *kcontrol;
int ret;
kcontrol = kzalloc(sizeof(*kcontrol), GFP_KERNEL); kcontrol = kzalloc(sizeof(*kcontrol), GFP_KERNEL);
if (!kcontrol) if (!kcontrol)
return -ENOMEM; return;
kcontrol->name = ctl->name; kcontrol->name = ctl->name;
kcontrol->info = wm_coeff_info; kcontrol->info = wm_coeff_info;
...@@ -571,29 +576,9 @@ static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl) ...@@ -571,29 +576,9 @@ static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl)
break; break;
} }
ret = snd_soc_add_component_controls(dsp->component, kcontrol, 1); snd_soc_add_component_controls(dsp->component, kcontrol, 1);
if (ret < 0)
goto err_kcontrol;
kfree(kcontrol); 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) static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment