Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

greybus: audio: Report DISCONNECT event after resource cleanup.

Reporting DISCONNECT event immediately on module removal causes
race condition while re-populating mixer controls by above HAL. The
original intent was to avoid any (invalid) mixer control modification
request from above layer.

Ideally, it should report 'MODULE_NOT_READY' on module plug-out and
DISCONNECT after resource cleanup. This would involve changes in GB
Audio manager and HAL layer.

Since we already have a plan to remove GB Audio manager, I'm making this
change in GB codec driver to avoid any race condition. Also, codec
driver already ensures mixer control modifcations for disconnected
modules are not triggered to AP Bridge audio FW & reported invalid.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>

authored by

Vaibhav Agarwal and committed by
Greg Kroah-Hartman
698282f6 02f1c12c

+3 -1
+3 -1
drivers/staging/greybus/audio_module.c
··· 363 363 struct gbaudio_data_connection *dai, *_dai; 364 364 365 365 366 + /* cleanup module related resources first */ 367 + gbaudio_unregister_module(gbmodule); 368 + 366 369 /* inform uevent to above layers */ 367 370 gb_audio_manager_remove(gbmodule->manager_id); 368 371 369 - gbaudio_unregister_module(gbmodule); 370 372 gbaudio_tplg_release(gbmodule); 371 373 kfree(gbmodule->topology); 372 374 gbmodule->topology = NULL;