From 698282f659d7c657aad4e0a72ed33190f2332e04 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Fri, 3 Jun 2016 17:45:30 +0530 Subject: [PATCH] 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 Reviewed-by: Mark Greer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/audio_module.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c index 53e84f5fafb0..95d2ddadeeab 100644 --- a/drivers/staging/greybus/audio_module.c +++ b/drivers/staging/greybus/audio_module.c @@ -363,10 +363,12 @@ static void gb_audio_disconnect(struct gb_bundle *bundle) struct gbaudio_data_connection *dai, *_dai; + /* cleanup module related resources first */ + gbaudio_unregister_module(gbmodule); + /* inform uevent to above layers */ gb_audio_manager_remove(gbmodule->manager_id); - gbaudio_unregister_module(gbmodule); gbaudio_tplg_release(gbmodule); kfree(gbmodule->topology); gbmodule->topology = NULL; -- 2.39.5