Browse Source

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
Jeff Johnson 6 years ago
parent
commit
d0b6c7e4ed

+ 2 - 2
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);

+ 2 - 2
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

+ 3 - 3
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

+ 9 - 1
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;

+ 3 - 3
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)) {