Pārlūkot izejas kodu

qcacmn: Maintain wiphy init and de-init states

Wiphy is attached to pdev after pdev has been created, but before pdev
is opened. So maintain the state of wiphy in pdev open and close
callbacks. While calling regulatory callbacks, check the wiphy init
state.

Change-Id: I51243017ac24bc4473abddbfd0506b9e3490de4a
CRs-Fixed: 2718363
Amar Singhal 5 gadi atpakaļ
vecāks
revīzija
07cc4bb4b1

+ 10 - 0
umac/regulatory/core/src/reg_callbacks.c

@@ -206,6 +206,11 @@ QDF_STATUS reg_send_scheduler_msg_sb(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	if (!pdev_priv_obj->pdev_opened) {
+		reg_err("hlos not initialized");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	if (!pdev_priv_obj->chan_list_recvd) {
 		reg_err("Empty channel list");
 		return QDF_STATUS_E_FAILURE;
@@ -262,6 +267,11 @@ QDF_STATUS reg_send_scheduler_msg_nb(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	if (!pdev_priv_obj->pdev_opened) {
+		reg_err("hlos not initialized");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	if (!pdev_priv_obj->chan_list_recvd) {
 		reg_err("Empty channel list");
 		return QDF_STATUS_E_FAILURE;

+ 5 - 0
umac/regulatory/core/src/reg_priv_objs.h

@@ -144,6 +144,10 @@ struct wlan_regulatory_psoc_priv_obj {
 	qdf_spinlock_t cbk_list_lock;
 };
 
+/**
+ * struct wlan_regulatory_pdev_priv_obj - wlan regulatory pdev private object
+ * @pdev_opened: whether pdev has been opened by application
+ */
 struct wlan_regulatory_pdev_priv_obj {
 	struct regulatory_channel cur_chan_list[NUM_CHANNELS];
 	struct regulatory_channel mas_chan_list[NUM_CHANNELS];
@@ -180,6 +184,7 @@ struct wlan_regulatory_pdev_priv_obj {
 	struct reg_rule_info reg_rules;
 	qdf_spinlock_t reg_rules_lock;
 	bool chan_list_recvd;
+	bool pdev_opened;
 };
 
 /**

+ 19 - 0
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -483,6 +483,16 @@ QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc)
 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev)
 {
 	struct wlan_objmgr_psoc *parent_psoc;
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev private obj is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	pdev_priv_obj->pdev_opened = true;
 
 	parent_psoc = wlan_pdev_get_psoc(pdev);
 
@@ -495,6 +505,15 @@ QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev)
 {
 	struct wlan_objmgr_psoc *psoc;
 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev private obj is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	pdev_priv_obj->pdev_opened = false;
 
 	psoc = wlan_pdev_get_psoc(pdev);
 	soc_reg = reg_get_psoc_obj(psoc);