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>
Please register or sign in to comment