diff options
author | Dasari Srinivas <dasaris@codeaurora.org> | 2014-10-28 20:33:54 +0530 |
---|---|---|
committer | Dasari Srinivas <dasaris@codeaurora.org> | 2014-10-28 20:33:54 +0530 |
commit | 9de0a16e04bfcfc5ee8222fd57bfa6c75408dccb (patch) | |
tree | 51588bd20e95eeb0ab08df510eab7155b840496c | |
parent | d9fd2949c68833247001d37662b6a48d162c843c (diff) | |
download | android_hardware_qcom_wlan-9de0a16e04bfcfc5ee8222fd57bfa6c75408dccb.tar.gz android_hardware_qcom_wlan-9de0a16e04bfcfc5ee8222fd57bfa6c75408dccb.tar.bz2 android_hardware_qcom_wlan-9de0a16e04bfcfc5ee8222fd57bfa6c75408dccb.zip |
wifihal: Avoid registering for an event more than once
wifihal allows registering for an event more than once, which
gives duplicate indications to the upper layers. To avoid this,
we need to overwrite the existing callback if it is from the same
object.
Change-Id: I81ae1ed6018d81bc93fdc14bf1f146ea40d77e01
CRs-Fixed: 746935
-rw-r--r-- | qcwcn/wifi_hal/common.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/qcwcn/wifi_hal/common.cpp b/qcwcn/wifi_hal/common.cpp index 8634b9c..65a49b0 100644 --- a/qcwcn/wifi_hal/common.cpp +++ b/qcwcn/wifi_hal/common.cpp @@ -57,7 +57,15 @@ wifi_error wifi_register_handler(wifi_handle handle, int cmd, nl_recvmsg_msg_cb_ { hal_info *info = (hal_info *)handle; - /* TODO: check for multiple handlers? */ + for (int i = 0; i < info->num_event_cb; i++) { + if(info->event_cb[i].nl_cmd == cmd && + info->event_cb[i].cb_arg == arg) { + info->event_cb[i].cb_func = func; + ALOGI("Updated event handler %p for nl_cmd 0x%0x" + " and arg %p", func, cmd, arg); + return WIFI_SUCCESS; + } + } if (info->num_event_cb < info->alloc_event_cb) { info->event_cb[info->num_event_cb].nl_cmd = cmd; |