Skip to content

Commit dcad34f

Browse files
rfvirgilbroonie
authored andcommitted
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: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent f15c19a commit dcad34f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sound/soc/codecs/wm_adsp.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,7 @@ static int wm_adsp_create_name(struct wm_adsp *dsp)
24162416
return 0;
24172417
}
24182418

2419-
int wm_adsp1_init(struct wm_adsp *dsp)
2419+
static int wm_adsp_common_init(struct wm_adsp *dsp)
24202420
{
24212421
int ret;
24222422

@@ -2425,11 +2425,17 @@ int wm_adsp1_init(struct wm_adsp *dsp)
24252425
return ret;
24262426

24272427
INIT_LIST_HEAD(&dsp->alg_regions);
2428+
INIT_LIST_HEAD(&dsp->ctl_list);
24282429

24292430
mutex_init(&dsp->pwr_lock);
24302431

24312432
return 0;
24322433
}
2434+
2435+
int wm_adsp1_init(struct wm_adsp *dsp)
2436+
{
2437+
return wm_adsp_common_init(dsp);
2438+
}
24332439
EXPORT_SYMBOL_GPL(wm_adsp1_init);
24342440

24352441
int wm_adsp1_event(struct snd_soc_dapm_widget *w,
@@ -2914,7 +2920,7 @@ int wm_adsp2_init(struct wm_adsp *dsp)
29142920
{
29152921
int ret;
29162922

2917-
ret = wm_adsp_create_name(dsp);
2923+
ret = wm_adsp_common_init(dsp);
29182924
if (ret)
29192925
return ret;
29202926

@@ -2936,12 +2942,8 @@ int wm_adsp2_init(struct wm_adsp *dsp)
29362942
break;
29372943
}
29382944

2939-
INIT_LIST_HEAD(&dsp->alg_regions);
2940-
INIT_LIST_HEAD(&dsp->ctl_list);
29412945
INIT_WORK(&dsp->boot_work, wm_adsp2_boot_work);
29422946

2943-
mutex_init(&dsp->pwr_lock);
2944-
29452947
return 0;
29462948
}
29472949
EXPORT_SYMBOL_GPL(wm_adsp2_init);

0 commit comments

Comments
 (0)