Browse Source

qcacld-3.0: Protect set_thermal_mitigation with dsc psoc sync

Currently, the operation set thermal mitigation which is invoked
from PLD is not dsc protected. As a result it is causing a memory
leak issue when there is an idle shutdown is happening in parallel.

To avoid this, protect set thermal mitigation operation with dsc psoc
sync.

Change-Id: Id36086dd7668258f0aa1d57bc30948e14510e4de
CRs-Fixed: 2882729
Bapiraju Alla 4 years ago
parent
commit
b9dee3953d
1 changed files with 24 additions and 6 deletions
  1. 24 6
      core/hdd/src/wlan_hdd_thermal.c

+ 24 - 6
core/hdd/src/wlan_hdd_thermal.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -396,15 +396,14 @@ QDF_STATUS hdd_restore_thermal_mitigation_config(struct hdd_context *hdd_ctx)
 	return status;
 }
 
-int wlan_hdd_pld_set_thermal_mitigation(struct device *dev, unsigned long state,
-					int mon_id)
+static int
+__wlan_hdd_pld_set_thermal_mitigation(struct device *dev, unsigned long state,
+				      int mon_id)
 {
 	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	QDF_STATUS status;
 	int ret;
 
-	hdd_enter();
-
 	ret = wlan_hdd_validate_context(hdd_ctx);
 	if (ret)
 		return ret;
@@ -414,10 +413,29 @@ int wlan_hdd_pld_set_thermal_mitigation(struct device *dev, unsigned long state,
 
 	status = hdd_send_thermal_mitigation_val(hdd_ctx, state, mon_id);
 
-	hdd_exit();
 	return qdf_status_to_os_return(status);
 }
 
+int wlan_hdd_pld_set_thermal_mitigation(struct device *dev, unsigned long state,
+					int mon_id)
+{
+	struct osif_psoc_sync *psoc_sync;
+	int ret;
+
+	hdd_enter();
+
+	ret = osif_psoc_sync_op_start(dev, &psoc_sync);
+	if (ret)
+		return ret;
+
+	ret =  __wlan_hdd_pld_set_thermal_mitigation(dev, state, mon_id);
+
+	osif_psoc_sync_op_stop(psoc_sync);
+	hdd_exit();
+
+	return ret;
+}
+
 #ifdef FEATURE_WPSS_THERMAL_MITIGATION
 inline void hdd_thermal_mitigation_register_wpps(struct hdd_context *hdd_ctx,
 						 struct device *dev)