Browse Source

qcacld-3.0: Refine the Roam Scan Offload callback API

The Roam Scan Offload (RSO) 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: I9f3098a9f4bc840ef2f6210717849db5d4dd2c2a
CRs-fixed: 2278584
Jeff Johnson 6 years ago
parent
commit
4397514c87

+ 3 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -12078,9 +12078,10 @@ nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = {
 						 .len = QDF_MAC_ADDR_SIZE},
 };
 
-void wlan_hdd_rso_cmd_status_cb(void *ctx, struct rso_cmd_status *rso_status)
+void wlan_hdd_rso_cmd_status_cb(hdd_handle_t hdd_handle,
+				struct rso_cmd_status *rso_status)
 {
-	struct hdd_context *hdd_ctx = (struct hdd_context *)ctx;
+	struct hdd_context *hdd_ctx = hdd_handle_to_context(hdd_handle);
 	struct hdd_adapter *adapter;
 
 	adapter = hdd_get_adapter_by_vdev(hdd_ctx, rso_status->vdev_id);

+ 3 - 2
core/hdd/src/wlan_hdd_cfg80211.h

@@ -358,7 +358,7 @@ void wlan_hdd_cfg80211_extscan_callback(hdd_handle_t hdd_handle,
 #endif /* FEATURE_WLAN_EXTSCAN */
 /**
  * wlan_hdd_rso_cmd_status_cb() - HDD callback to read RSO command status
- * @ctx: void pointer to hdd context
+ * @hdd_handle: opaque handle for the hdd context
  * @rso_status: rso command status
  *
  * This callback function is invoked by firmware to update
@@ -366,7 +366,8 @@ void wlan_hdd_cfg80211_extscan_callback(hdd_handle_t hdd_handle,
  *
  * Return: None
  */
-void wlan_hdd_rso_cmd_status_cb(void *ctx, struct rso_cmd_status *rso_status);
+void wlan_hdd_rso_cmd_status_cb(hdd_handle_t hdd_handle,
+				struct rso_cmd_status *rso_status);
 
 /**
  * hdd_rssi_threshold_breached() - rssi breached NL event

+ 4 - 4
core/sme/inc/sme_api.h

@@ -1787,15 +1787,15 @@ QDF_STATUS sme_deregister_tx_queue_cb(mac_handle_t mac_handle);
 
 /**
  * sme_rso_cmd_status_cb() - Set RSO cmd status callback
- * @hal: HAL Handle
- * @cb: HDD Callback to rso comman status read
+ * @mac_handle: Opaque handle for the MAC context
+ * @cb: HDD Callback to rso command status read
  *
  * This function is used to save HDD RSO Command status callback in MAC
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS sme_rso_cmd_status_cb(tHalHandle hal,
-		void (*cb)(void *, struct rso_cmd_status *));
+QDF_STATUS sme_rso_cmd_status_cb(mac_handle_t mac_handle,
+				 rso_cmd_status_cb cb);
 
 /**
  * sme_register_set_connection_info_cb() - Register connection

+ 9 - 2
core/sme/inc/sme_internal.h

@@ -240,6 +240,14 @@ typedef void (*bt_activity_info_cb)(hdd_handle_t hdd_handle,
 typedef void (*congestion_cb)(hdd_handle_t hdd_handle, uint32_t congestion,
 			      uint32_t vdev_id);
 
+/**
+ * typedef rso_cmd_status_cb - RSO command status  callback function
+ * @hdd_handle: HDD handle registered with SME
+ * @rso_status: Status of the operation
+ */
+typedef void (*rso_cmd_status_cb)(hdd_handle_t hdd_handle,
+				  struct rso_cmd_status *rso_status);
+
 typedef struct tagSmeStruct {
 	eSmeState state;
 	qdf_mutex_t lkSmeGlobalLock;
@@ -323,8 +331,7 @@ typedef struct tagSmeStruct {
 	bool (*set_connection_info_cb)(bool);
 	bool (*get_connection_info_cb)(uint8_t *session_id,
 			enum scan_reject_states *reason);
-	void (*rso_cmd_status_cb)(void *hdd_context,
-			struct rso_cmd_status *rso_status);
+	rso_cmd_status_cb rso_cmd_status_cb;
 	congestion_cb congestion_cb;
 	pwr_save_fail_cb chip_power_save_fail_cb;
 	bt_activity_info_cb bt_activity_info_cb;

+ 3 - 3
core/sme/src/common/sme_api.c

@@ -15235,11 +15235,11 @@ QDF_STATUS sme_register_set_connection_info_cb(tHalHandle hHal,
 	return status;
 }
 
-QDF_STATUS sme_rso_cmd_status_cb(tHalHandle hal,
-		void (*cb)(void *, struct rso_cmd_status *))
+QDF_STATUS sme_rso_cmd_status_cb(mac_handle_t mac_handle,
+				 rso_cmd_status_cb cb)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	tpAniSirGlobal mac = PMAC_STRUCT(hal);
+	tpAniSirGlobal mac = MAC_CONTEXT(mac_handle);
 
 	mac->sme.rso_cmd_status_cb = cb;
 	sme_debug("Registered RSO command status callback");