From d0b6c7e4eda75eb4e90d169351cc0a7337d7ec2c Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Wed, 4 Jul 2018 14:53:06 -0700 Subject: [PATCH] qcacld-3.0: Refine the BT Activity callback API The BT Activity callback currently specifies a void pointer for the context. In the case of this API the context is actually known to be an HDD handle, so update the API to explicitly use this type. This will allow the compiler to verify that the correct type of parameter is being passed. Change-Id: I1bb29fcbd339d48b19352d61a18c0ae3ee3b10da CRs-Fixed: 2278583 --- core/hdd/src/wlan_hdd_cfg80211.c | 4 ++-- core/hdd/src/wlan_hdd_cfg80211.h | 4 ++-- core/sme/inc/sme_api.h | 6 +++--- core/sme/inc/sme_internal.h | 10 +++++++++- core/sme/src/common/sme_api.c | 6 +++--- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 6106b5c8ddab..dec76e295516 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -13319,9 +13319,9 @@ static int wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, #undef QCA_ATTR_NUD_STATS_AP_LINK_ACTIVE #undef QCA_ATTR_NUD_STATS_GET_MAX -void hdd_bt_activity_cb(void *context, uint32_t bt_activity) +void hdd_bt_activity_cb(hdd_handle_t hdd_handle, uint32_t bt_activity) { - struct hdd_context *hdd_ctx = (struct hdd_context *)context; + struct hdd_context *hdd_ctx = hdd_handle_to_context(hdd_handle); int status; status = wlan_hdd_validate_context(hdd_ctx); diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index c6745f457019..75e8c74c518d 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -567,12 +567,12 @@ int wlan_hdd_merge_avoid_freqs(struct ch_avoid_ind_type *destFreqList, /** * hdd_bt_activity_cb() - callback function to receive bt activity - * @context: HDD context + * @hdd_handle: Opaque handle to the HDD context * @bt_activity: specifies the kind of bt activity * * Return: none */ -void hdd_bt_activity_cb(void *context, uint32_t bt_activity); +void hdd_bt_activity_cb(hdd_handle_t hdd_handle, uint32_t bt_activity); /** * wlan_hdd_save_gtk_offload_params() - Save gtk offload parameters in STA diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 7e091f624213..9c0c265bb22e 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1911,13 +1911,13 @@ int sme_cli_set_command(int vdev_id, int param_id, int sval, int vpdev); /** * sme_set_bt_activity_info_cb - set the callback handler for bt events - * @hal: handle returned by mac_open + * @mac_handle: handle returned by mac_open * @cb: callback handler * * Return: QDF_STATUS */ -QDF_STATUS sme_set_bt_activity_info_cb(tHalHandle hal, - void (*cb)(void *, uint32_t profile_info)); +QDF_STATUS sme_set_bt_activity_info_cb(mac_handle_t mac_handle, + bt_activity_info_cb cb); /** * sme_set_smps_cfg() - set SMPS config params diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h index 48b2df496abb..c1013508d9f7 100644 --- a/core/sme/inc/sme_internal.h +++ b/core/sme/inc/sme_internal.h @@ -223,6 +223,14 @@ struct chip_pwr_save_fail_detected_params; typedef void (*pwr_save_fail_cb)(hdd_handle_t hdd_handle, struct chip_pwr_save_fail_detected_params *params); +/** + * typedef bt_activity_info_cb - bluetooth activity callback function + * @hdd_handle: HDD handle registered with SME + * @bt_activity: bluetooth activity information + */ +typedef void (*bt_activity_info_cb)(hdd_handle_t hdd_handle, + uint32_t bt_activity); + /** * typedef congestion_cb - congestion callback function * @hdd_handle: HDD handle registered with SME @@ -319,7 +327,7 @@ typedef struct tagSmeStruct { struct rso_cmd_status *rso_status); congestion_cb congestion_cb; pwr_save_fail_cb chip_power_save_fail_cb; - void (*bt_activity_info_cb)(void *context, uint32_t bt_activity); + bt_activity_info_cb bt_activity_info_cb; void *get_arp_stats_context; void (*get_arp_stats_cb)(void *, struct rsp_stats *, void *); get_chain_rssi_callback get_chain_rssi_cb; diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 247f5a59a3a1..8d0c684b1d62 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -15490,11 +15490,11 @@ int sme_cli_set_command(int vdev_id, int param_id, int sval, int vpdev) return wma_cli_set_command(vdev_id, param_id, sval, vpdev); } -QDF_STATUS sme_set_bt_activity_info_cb(tHalHandle hal, - void (*cb)(void *, uint32_t bt_activity)) +QDF_STATUS sme_set_bt_activity_info_cb(mac_handle_t mac_handle, + bt_activity_info_cb cb) { QDF_STATUS status; - tpAniSirGlobal mac = PMAC_STRUCT(hal); + tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); status = sme_acquire_global_lock(&mac->sme); if (QDF_IS_STATUS_SUCCESS(status)) {