Browse Source

qcacld-3.0: Remove adapter parameter from start modules

hdd_wlan_start_modules() currently takes an adapter parameter in order
to do management frame event deregistration. Instead, do management
frame event deregistration during adapter stop for symmetry with the
event registration. This allows us to remove the adapter parameter
completely from hdd_wlan_start_modules().

Change-Id: Ifb4619c80a129b8ef4e84c597dd98004d5cd713d
CRs-Fixed: 2240850
Dustin Brown 7 years ago
parent
commit
e7e71d3fe3

+ 2 - 4
core/hdd/inc/wlan_hdd_main.h

@@ -2611,11 +2611,9 @@ int hdd_register_cb(struct hdd_context *hdd_ctx);
 void hdd_deregister_cb(struct hdd_context *hdd_ctx);
 int hdd_start_station_adapter(struct hdd_adapter *adapter);
 int hdd_start_ap_adapter(struct hdd_adapter *adapter);
-int hdd_configure_cds(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter);
+int hdd_configure_cds(struct hdd_context *hdd_ctx);
 int hdd_set_fw_params(struct hdd_adapter *adapter);
-int hdd_wlan_start_modules(struct hdd_context *hdd_ctx,
-			   struct hdd_adapter *adapter,
-			   bool reinit);
+int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit);
 int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode);
 int hdd_start_adapter(struct hdd_adapter *adapter);
 void hdd_populate_random_mac_addr(struct hdd_context *hdd_ctx, uint32_t num);

+ 1 - 1
core/hdd/src/wlan_hdd_cfg80211.c

@@ -16159,7 +16159,7 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
 	hdd_debug("Device_mode = %d, IFTYPE = 0x%x",
 	       adapter->device_mode, type);
 
-	status = hdd_wlan_start_modules(hdd_ctx, adapter, false);
+	status = hdd_wlan_start_modules(hdd_ctx, false);
 	if (status) {
 		hdd_err("Failed to start modules");
 		return -EINVAL;

+ 1 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -442,7 +442,7 @@ static int __hdd_hostapd_open(struct net_device *dev)
 	/*
 	 * Check statemachine state and also stop iface change timer if running
 	 */
-	ret = hdd_wlan_start_modules(hdd_ctx, adapter, false);
+	ret = hdd_wlan_start_modules(hdd_ctx, false);
 
 	if (ret) {
 		hdd_err("Failed to start WLAN modules return");

+ 32 - 42
core/hdd/src/wlan_hdd_main.c

@@ -2148,7 +2148,7 @@ static int __hdd_mon_open(struct net_device *dev)
 	hdd_mon_mode_ether_setup(dev);
 
 	if (con_mode == QDF_GLOBAL_MONITOR_MODE) {
-		ret = hdd_wlan_start_modules(hdd_ctx, adapter, false);
+		ret = hdd_wlan_start_modules(hdd_ctx, false);
 		if (ret) {
 			hdd_err("Failed to start WLAN modules return");
 			return ret;
@@ -2297,15 +2297,14 @@ int hdd_start_adapter(struct hdd_adapter *adapter)
 	if (hdd_set_fw_params(adapter))
 		hdd_err("Failed to set the FW params for the adapter!");
 
-	/*
-	 * Action frame registered in one adapter which will
-	 * applicable to all interfaces
-	 */
-	ret = wlan_hdd_cfg80211_register_frames(adapter);
-	if (ret < 0) {
-		hdd_err("Failed to register frames - ret %d", ret);
-		goto err_start_adapter;
+	if (adapter->session_id != HDD_SESSION_ID_INVALID) {
+		ret = wlan_hdd_cfg80211_register_frames(adapter);
+		if (ret < 0) {
+			hdd_err("Failed to register frames - ret %d", ret);
+			goto err_start_adapter;
+		}
 	}
+
 	wlan_hdd_update_dbs_scan_and_fw_mode_config();
 
 exit_with_success:
@@ -2607,7 +2606,6 @@ static int hdd_update_country_code(struct hdd_context *hdd_ctx)
 /**
  * hdd_wlan_start_modules() - Single driver state machine for starting modules
  * @hdd_ctx: HDD context
- * @adapter: HDD adapter
  * @reinit: flag to indicate from SSR or normal path
  *
  * This function maintains the driver state machine it will be invoked from
@@ -2616,9 +2614,7 @@ static int hdd_update_country_code(struct hdd_context *hdd_ctx)
  *
  * Return: 0 for success; non-zero for failure
  */
-int hdd_wlan_start_modules(struct hdd_context *hdd_ctx,
-			   struct hdd_adapter *adapter,
-			   bool reinit)
+int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit)
 {
 	int ret = 0;
 	qdf_device_t qdf_dev;
@@ -2759,18 +2755,13 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx,
 	case DRIVER_MODULES_OPENED:
 		hdd_info("Wlan transitioning (OPENED -> ENABLED)");
 
-		if (!adapter) {
-			hdd_alert("adapter is Null");
-			ret = -EINVAL;
-			goto post_disable;
-		}
 		if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
 			hdd_err("in ftm mode, no need to configure cds modules");
 			ret = -EINVAL;
 			break;
 		}
 
-		ret = hdd_configure_cds(hdd_ctx, adapter);
+		ret = hdd_configure_cds(hdd_ctx);
 		if (ret) {
 			hdd_err("Failed to Enable cds modules; errno: %d", ret);
 			goto post_disable;
@@ -2955,7 +2946,7 @@ static int __hdd_open(struct net_device *dev)
 	}
 
 
-	ret = hdd_wlan_start_modules(hdd_ctx, adapter, false);
+	ret = hdd_wlan_start_modules(hdd_ctx, false);
 	if (ret) {
 		hdd_err("Failed to start WLAN modules return");
 		goto err_hdd_hdd_init_deinit_lock;
@@ -4904,6 +4895,9 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
 
 	hdd_enter();
 
+	if (adapter->session_id != HDD_SESSION_ID_INVALID)
+		wlan_hdd_cfg80211_deregister_frames(adapter);
+
 	hdd_nud_ignore_tracking(adapter, true);
 	hdd_nud_reset_tracking(adapter);
 
@@ -6297,7 +6291,6 @@ static inline QDF_STATUS hdd_unregister_wext_all_adapters(struct hdd_context *
 		    adapter->device_mode == QDF_P2P_DEVICE_MODE ||
 		    adapter->device_mode == QDF_SAP_MODE ||
 		    adapter->device_mode == QDF_P2P_GO_MODE) {
-			wlan_hdd_cfg80211_deregister_frames(adapter);
 			hdd_unregister_wext(adapter->dev);
 		}
 	}
@@ -8289,10 +8282,8 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind)
 	struct hdd_adapter *adapter = NULL;
 	int i;
 
-	/* Get the HDD context.*/
-	hdd_ctx = (struct hdd_context *)cds_get_context(QDF_MODULE_ID_HDD);
-
-	if (0 != wlan_hdd_validate_context(hdd_ctx))
+	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	if (wlan_hdd_validate_context(hdd_ctx))
 		return;
 
 	if (SME_SESSION_ID_ANY == frame_ind->sessionId) {
@@ -9978,13 +9969,12 @@ static int hdd_set_auto_shutdown_cb(struct hdd_context *hdd_ctx)
 /**
  * hdd_features_init() - Init features
  * @hdd_ctx:	HDD context
- * @adapter:	Primary adapter context
  *
  * Initialize features and their feature context after WLAN firmware is up.
  *
  * Return: 0 on success and errno on failure.
  */
-static int hdd_features_init(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter)
+static int hdd_features_init(struct hdd_context *hdd_ctx)
 {
 	tSirTxPowerLimit hddtxlimit;
 	QDF_STATUS status;
@@ -10026,7 +10016,7 @@ static int hdd_features_init(struct hdd_context *hdd_ctx, struct hdd_adapter *ad
 	ret = hdd_init_thermal_info(hdd_ctx);
 	if (ret) {
 		hdd_err("Error while initializing thermal information");
-		goto deregister_frames;
+		return ret;
 	}
 
 	/**
@@ -10050,7 +10040,7 @@ static int hdd_features_init(struct hdd_context *hdd_ctx, struct hdd_adapter *ad
 	ret = hdd_register_cb(hdd_ctx);
 	if (ret) {
 		hdd_err("Failed to register HDD callbacks!");
-		goto deregister_frames;
+		return ret;
 	}
 
 	if (hdd_ctx->config->goptimize_chan_avoid_event) {
@@ -10095,8 +10085,7 @@ static int hdd_features_init(struct hdd_context *hdd_ctx, struct hdd_adapter *ad
 
 deregister_cb:
 	hdd_deregister_cb(hdd_ctx);
-deregister_frames:
-	wlan_hdd_cfg80211_deregister_frames(adapter);
+
 	return -EINVAL;
 }
 
@@ -10145,7 +10134,7 @@ static inline QDF_STATUS hdd_register_bcn_cb(struct hdd_context *hdd_ctx)
  *
  * Return: 0 on success and errno on failure.
  */
-int hdd_configure_cds(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter)
+int hdd_configure_cds(struct hdd_context *hdd_ctx)
 {
 	int ret;
 	QDF_STATUS status;
@@ -10244,7 +10233,7 @@ int hdd_configure_cds(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter)
 		goto cds_disable;
 	}
 
-	ret = hdd_features_init(hdd_ctx, adapter);
+	ret = hdd_features_init(hdd_ctx);
 	if (ret)
 		goto cds_disable;
 
@@ -10715,7 +10704,7 @@ int hdd_wlan_startup(struct device *dev)
 
 	hdd_driver_memdump_init();
 
-	ret = hdd_wlan_start_modules(hdd_ctx, NULL, false);
+	ret = hdd_wlan_start_modules(hdd_ctx, false);
 	if (ret) {
 		hdd_err("Failed to start modules: %d", ret);
 		goto err_memdump_deinit;
@@ -12507,7 +12496,6 @@ static int __con_mode_handler(const char *kmessage,
 			      struct hdd_context *hdd_ctx)
 {
 	int ret;
-	struct hdd_adapter *adapter;
 	enum QDF_GLOBAL_MODE curr_mode;
 	enum QDF_OPMODE adapter_mode;
 	int new_con_mode;
@@ -12576,19 +12564,21 @@ static int __con_mode_handler(const char *kmessage,
 		goto reset_flags;
 	}
 
-	adapter = hdd_get_adapter(hdd_ctx, adapter_mode);
-	if (!adapter) {
-		hdd_err("Failed to get adapter:%d", adapter_mode);
-		goto reset_flags;
-	}
-
-	ret = hdd_wlan_start_modules(hdd_ctx, adapter, false);
+	ret = hdd_wlan_start_modules(hdd_ctx, false);
 	if (ret) {
 		hdd_err("Start wlan modules failed: %d", ret);
 		goto reset_flags;
 	}
 
 	if (new_con_mode == QDF_GLOBAL_MONITOR_MODE) {
+		struct hdd_adapter *adapter =
+			hdd_get_adapter(hdd_ctx, adapter_mode);
+
+		if (!adapter) {
+			hdd_err("Failed to get adapter:%d", adapter_mode);
+			goto reset_flags;
+		}
+
 		if (hdd_start_adapter(adapter)) {
 			hdd_err("Failed to start %s adapter", kmessage);
 			ret = -EINVAL;

+ 2 - 2
core/hdd/src/wlan_hdd_p2p.c

@@ -716,7 +716,7 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
 	 * check the statemachine for modules state and if they are closed
 	 * open the modules.
 	 */
-	ret = hdd_wlan_start_modules(hdd_ctx, adapter, false);
+	ret = hdd_wlan_start_modules(hdd_ctx, false);
 	if (ret) {
 		hdd_err("Failed to start the wlan_modules");
 		goto close_adapter;
@@ -868,7 +868,7 @@ int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 		return status;
 
 	/* check state machine state and kickstart modules if they are closed */
-	status = hdd_wlan_start_modules(hdd_ctx, pVirtAdapter, false);
+	status = hdd_wlan_start_modules(hdd_ctx, false);
 	if (status)
 		return status;
 

+ 1 - 1
core/hdd/src/wlan_hdd_power.c

@@ -1381,7 +1381,7 @@ QDF_STATUS hdd_wlan_re_init(void)
 	hdd_bus_bandwidth_init(hdd_ctx);
 
 
-	ret = hdd_wlan_start_modules(hdd_ctx, adapter, true);
+	ret = hdd_wlan_start_modules(hdd_ctx, true);
 	if (ret) {
 		hdd_err("Failed to start wlan after error");
 		goto err_re_init;

+ 1 - 1
core/hdd/src/wlan_hdd_wext.c

@@ -10396,7 +10396,7 @@ void hdd_register_wext(struct net_device *dev)
 {
 	hdd_enter_dev(dev);
 
-	dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def;
+	dev->wireless_handlers = &we_handler_def;
 
 	hdd_exit();
 }