Commit dcad34f8 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown

ASoC: wm_adsp: Factor out common init code

Factor out the duplicated initialization statements from
wm_adsp1_init() and wm_adsp2_init() into new function
wm_adsp_common_init().

The entire content of wm_adsp1_init() is the common code
but it is convenient to retain this exported function
to hide what we currently treat as common init (which might
change in the future) and also make clear the difference
between an ADSP1 entry point and common code.
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f15c19af
...@@ -2416,7 +2416,7 @@ static int wm_adsp_create_name(struct wm_adsp *dsp) ...@@ -2416,7 +2416,7 @@ static int wm_adsp_create_name(struct wm_adsp *dsp)
return 0; return 0;
} }
int wm_adsp1_init(struct wm_adsp *dsp) static int wm_adsp_common_init(struct wm_adsp *dsp)
{ {
int ret; int ret;
...@@ -2425,11 +2425,17 @@ int wm_adsp1_init(struct wm_adsp *dsp) ...@@ -2425,11 +2425,17 @@ int wm_adsp1_init(struct wm_adsp *dsp)
return ret; return ret;
INIT_LIST_HEAD(&dsp->alg_regions); INIT_LIST_HEAD(&dsp->alg_regions);
INIT_LIST_HEAD(&dsp->ctl_list);
mutex_init(&dsp->pwr_lock); mutex_init(&dsp->pwr_lock);
return 0; return 0;
} }
int wm_adsp1_init(struct wm_adsp *dsp)
{
return wm_adsp_common_init(dsp);
}
EXPORT_SYMBOL_GPL(wm_adsp1_init); EXPORT_SYMBOL_GPL(wm_adsp1_init);
int wm_adsp1_event(struct snd_soc_dapm_widget *w, int wm_adsp1_event(struct snd_soc_dapm_widget *w,
...@@ -2914,7 +2920,7 @@ int wm_adsp2_init(struct wm_adsp *dsp) ...@@ -2914,7 +2920,7 @@ int wm_adsp2_init(struct wm_adsp *dsp)
{ {
int ret; int ret;
ret = wm_adsp_create_name(dsp); ret = wm_adsp_common_init(dsp);
if (ret) if (ret)
return ret; return ret;
...@@ -2936,12 +2942,8 @@ int wm_adsp2_init(struct wm_adsp *dsp) ...@@ -2936,12 +2942,8 @@ int wm_adsp2_init(struct wm_adsp *dsp)
break; break;
} }
INIT_LIST_HEAD(&dsp->alg_regions);
INIT_LIST_HEAD(&dsp->ctl_list);
INIT_WORK(&dsp->boot_work, wm_adsp2_boot_work); INIT_WORK(&dsp->boot_work, wm_adsp2_boot_work);
mutex_init(&dsp->pwr_lock);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(wm_adsp2_init); EXPORT_SYMBOL_GPL(wm_adsp2_init);
......
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