diff options
author | Dhananjay Kumar <dhakumar@codeaurora.org> | 2017-07-10 13:49:13 +0530 |
---|---|---|
committer | Shiv Maliyappanahalli <smaliyap@codeaurora.org> | 2017-07-27 12:21:36 -0700 |
commit | a427f14cf277e14eeba128c5d23bd42bc747b1bc (patch) | |
tree | 5ab9b7286f9ce1b648a8661430ee9ca88a0d331c | |
parent | ac66803f6697ceabcac0bab3e2fb96131b4e2aed (diff) | |
download | hardware_qcom_audio-a427f14cf277e14eeba128c5d23bd42bc747b1bc.tar.gz hardware_qcom_audio-a427f14cf277e14eeba128c5d23bd42bc747b1bc.tar.bz2 hardware_qcom_audio-a427f14cf277e14eeba128c5d23bd42bc747b1bc.zip |
hal: gef: update gef extn to deinit gef library on hal deinit
Update gef extension to call deinit of gef library if the call is
available, so that gef is aware of audio hal state and gef init/deinit
is not tightly coupled with hal init/deinit.
Change-Id: I72ced9d6b9535563ee0b8e6d81efd634fcdc3ee3
-rw-r--r-- | hal/audio_extn/gef.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hal/audio_extn/gef.c b/hal/audio_extn/gef.c index 19f9dfb4..0781f4ce 100644 --- a/hal/audio_extn/gef.c +++ b/hal/audio_extn/gef.c @@ -62,6 +62,7 @@ #endif typedef void* (*gef_init_t)(void*); +typedef void (*gef_deinit_t)(void*); typedef void (*gef_device_config_cb_t)(void*, audio_devices_t, audio_channel_mask_t, int, int); @@ -69,6 +70,7 @@ typedef struct { void* handle; void* gef_ptr; gef_init_t init; + gef_deinit_t deinit; gef_device_config_cb_t device_config_cb; } gef_data; @@ -138,6 +140,18 @@ void audio_extn_gef_init(struct audio_device *adev) } //call dlerror to clear the error + dlerror(); + gef_hal_handle.deinit = + (gef_deinit_t)dlsym(gef_hal_handle.handle, "gef_deinit"); + error = dlerror(); + + if(error != NULL) { + ALOGE("%s: dlsym of %s failed with error %s", + __func__, "gef_deinit", error); + goto ERROR_RETURN; + } + + //call dlerror to clear the error error = dlerror(); gef_hal_handle.device_config_cb = (gef_device_config_cb_t)dlsym(gef_hal_handle.handle, @@ -289,6 +303,8 @@ void audio_extn_gef_deinit() ALOGV("%s: Enter", __func__); if (gef_hal_handle.handle) { + if (gef_hal_handle.handle && gef_hal_handle.deinit) + gef_hal_handle.deinit(gef_hal_handle.gef_ptr); dlclose(gef_hal_handle.handle); } |