Kaynağa Gözat

qcacmn: Add API to init scan runtime suspend lock

Commit fb9d5acfed and 645749571d introduce an API to deinit scan
runtime suspend lock in order to fix a memory leak issue. However,
it breaks SSR because scan lock init and deinit are not matching
during SSR which results double free happens in the rmmod after
SSR. Add the API to init scan runtime suspend lock so that it can
be added in the correct place during SSR.

Change-Id: Ied85b16b199fdbf43fef4c966bed56c9f7bb0e86
CRs-fixed: 2120661
Yue Ma 7 yıl önce
ebeveyn
işleme
04dfab5ac6

+ 10 - 0
os_if/linux/scan/inc/wlan_cfg80211_scan.h

@@ -150,6 +150,16 @@ int wlan_cfg80211_sched_scan_stop(struct wlan_objmgr_pdev *pdev,
 	struct net_device *dev);
 #endif
 
+/**
+ * wlan_scan_runtime_pm_init() - API to initialize runtime pm context for scan
+ * @pdev: Pointer to pdev
+ *
+ * This will help to initialize scan runtime pm context separately.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS wlan_scan_runtime_pm_init(struct wlan_objmgr_pdev *pdev);
+
 /**
  * wlan_scan_runtime_pm_deinit() - API to deinitialize runtime pm
  * for scan.

+ 14 - 1
os_if/linux/scan/src/wlan_cfg80211_scan.c

@@ -977,6 +977,20 @@ allow_suspend:
 
 }
 
+QDF_STATUS wlan_scan_runtime_pm_init(struct wlan_objmgr_pdev *pdev)
+{
+	struct pdev_osif_priv *osif_priv;
+	struct osif_scan_pdev *scan_priv;
+
+	wlan_pdev_obj_lock(pdev);
+	osif_priv = wlan_pdev_get_ospriv(pdev);
+	wlan_pdev_obj_unlock(pdev);
+
+	scan_priv = osif_priv->osif_scan;
+
+	return qdf_runtime_lock_init(&scan_priv->runtime_pm_lock);
+}
+
 void wlan_scan_runtime_pm_deinit(struct wlan_objmgr_pdev *pdev)
 {
 	struct pdev_osif_priv *osif_priv;
@@ -1013,7 +1027,6 @@ QDF_STATUS wlan_cfg80211_scan_priv_init(struct wlan_objmgr_pdev *pdev)
 	qdf_list_create(&scan_priv->scan_req_q, WLAN_MAX_SCAN_COUNT);
 	qdf_mutex_create(&scan_priv->scan_req_q_lock);
 	scan_priv->req_id = req_id;
-	qdf_runtime_lock_init(&scan_priv->runtime_pm_lock);
 
 	return QDF_STATUS_SUCCESS;
 }