Browse Source

qcacld-3.0: Refine the P2P LO callback API

The P2P LO Callback currently specifies a void pointer for the event
payload. In the case of this API the event payload is always a struct
sir_p2p_lo_event so update the API to explicitly use this type. In
addition, currently the callback is not using the registered
user-supplied context, so update the callback to correctly use the
user-supplied context.

Change-Id: I566facea3c92b377823c1b3e38f99c84bc65e9d4
CRs-Fixed: 2278587
Jeff Johnson 6 years ago
parent
commit
f7e36d6e4e

+ 6 - 6
core/hdd/src/wlan_hdd_main.c

@@ -10088,19 +10088,19 @@ out:
 
 /**
  * wlan_hdd_p2p_lo_event_callback - P2P listen offload stop event handler
- * @context_ptr - hdd context pointer
- * @event_ptr - event structure pointer
+ * @context: context registered with sme_register_p2p_lo_event(). HDD
+ *   always registers a hdd context pointer
+ * @evt:event structure pointer
  *
  * This is the p2p listen offload stop event handler, it sends vendor
  * event back to supplicant to notify the stop reason.
  *
  * Return: None
  */
-static void wlan_hdd_p2p_lo_event_callback(void *context_ptr,
-				void *event_ptr)
+static void wlan_hdd_p2p_lo_event_callback(void *context,
+					   struct sir_p2p_lo_event *evt)
 {
-	struct hdd_context *hdd_ctx = (struct hdd_context *)context_ptr;
-	struct sir_p2p_lo_event *evt = event_ptr;
+	struct hdd_context *hdd_ctx = context;
 	struct sk_buff *vendor_event;
 	struct hdd_adapter *adapter;
 

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

@@ -150,7 +150,8 @@ typedef void (*ext_scan_ind_cb)(hdd_handle_t hdd_handle,
 typedef void (*ocb_callback)(void *context, void *response);
 typedef void (*sme_set_thermal_level_callback)(hdd_handle_t hdd_handle,
 					       u_int8_t level);
-typedef void (*p2p_lo_callback)(void *context, void *event);
+typedef void (*p2p_lo_callback)(void *context,
+				struct sir_p2p_lo_event *event);
 #ifdef FEATURE_OEM_DATA_SUPPORT
 typedef void (*sme_send_oem_data_rsp_msg)(struct oem_data_rsp *);
 #endif

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

@@ -14382,7 +14382,7 @@ void sme_update_hw_dbs_capable(tHalHandle hal, uint8_t hw_dbs_capable)
  * Return: none
  */
 void sme_register_p2p_lo_event(tHalHandle hHal, void *context,
-					p2p_lo_callback callback)
+			       p2p_lo_callback callback)
 {
 	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;

+ 2 - 1
core/wma/src/wma_features.c

@@ -5121,7 +5121,8 @@ int wma_p2p_lo_event_handler(void *handle, uint8_t *event_buf,
 	event->vdev_id = fix_param->vdev_id;
 	event->reason_code = fix_param->reason;
 
-	p_mac->sme.p2p_lo_event_callback(p_mac->hdd_handle, event);
+	p_mac->sme.p2p_lo_event_callback(p_mac->sme.p2p_lo_event_context,
+					 event);
 
 	wma->interfaces[event->vdev_id].p2p_lo_in_progress = false;