OSDN Git Service

ASoC: SOF: ipc4-topology: move ida allocate/free to widget_setup/free
authorBard Liao <yung-chuan.liao@linux.intel.com>
Fri, 15 Jul 2022 14:52:07 +0000 (09:52 -0500)
committerMark Brown <broonie@kernel.org>
Fri, 15 Jul 2022 19:11:30 +0000 (20:11 +0100)
commit711d0427c7134c5ba65b8f408888a0335e23ed23
tree2bf9c3d7b19eef4370ab288fd1fd18fb1e0453d5
parent740e5d8713e08607c280e1569374401461f3ed5b
ASoC: SOF: ipc4-topology: move ida allocate/free to widget_setup/free

The existing code allocate/release instance_id in widget ipc_prepare/
ipc_unprepare callbacks and creating widget with the instance_id in
tplg widget_setup callback. In the case of multiple widgets connecting
to one widget, the ipc_unprepare will be invoked for all the widgets
in the path including the widget which is still in use.
As a result, the instance_id is released in the ipc_unprepare callback,
but the widget is still in use and the instance_id will be reused by
a new widget when we start the PCM again.
Moving the ida work from ipc_prepare/ipc_unprepare to widget_setup/free
can avoid such problem.

Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220715145216.277003-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc4-topology.c