浏览代码

qcacmn: Set enable_rpm earlier in hdd_wlan_start_modules

Currently enable_rpm is being set in hif_rtpm_start
which is called later in hdd_wlan_start_modules,
this can result in race between hif_rtpm_start
and hif_rtpm_put.

To fix the issue set enable_rpm earlier to avoid
race condition.

Change-Id: Iaa4ffda4eef3050f43ff5ca2bdba555abb8a0b47
CRs-Fixed: 3581962
Amit Mehta 1 年之前
父节点
当前提交
2c0fb4ffc6
共有 2 个文件被更改,包括 21 次插入2 次删除
  1. 14 0
      hif/inc/hif.h
  2. 7 2
      hif/src/hif_runtime_pm.c

+ 14 - 0
hif/inc/hif.h

@@ -1761,6 +1761,15 @@ void hif_rtpm_display_last_busy_hist(struct hif_opaque_softc *hif_ctx);
  */
 void hif_rtpm_record_ce_last_busy_evt(struct hif_softc *scn,
 				      unsigned long ce_id);
+
+/**
+ * hif_set_enable_rpm() - Set enable_rpm value
+ * @hif_hdl: hif opaque handle
+ *
+ *  Return: None
+ */
+void hif_set_enable_rpm(struct hif_opaque_softc *hif_hdl);
+
 #else
 
 /**
@@ -1869,6 +1878,11 @@ void hif_rtpm_set_monitor_wake_intr(int val)
 static inline
 void hif_rtpm_mark_last_busy(uint32_t id)
 {}
+
+static inline
+void hif_set_enable_rpm(struct hif_opaque_softc *hif_hdl)
+{
+}
 #endif
 
 void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,

+ 7 - 2
hif/src/hif_runtime_pm.c

@@ -430,11 +430,16 @@ void hif_rtpm_close(struct hif_softc *scn)
 	hif_info_high("Runtime PM context detached");
 }
 
-void hif_rtpm_start(struct hif_softc *scn)
+void hif_set_enable_rpm(struct hif_opaque_softc *hif_hdl)
 {
-	uint32_t mode = hif_get_conparam(scn);
+	struct hif_softc *scn = HIF_GET_SOFTC(hif_hdl);
 
 	gp_hif_rtpm_ctx->enable_rpm = scn->hif_config.enable_runtime_pm;
+}
+
+void hif_rtpm_start(struct hif_softc *scn)
+{
+	uint32_t mode = hif_get_conparam(scn);
 
 	if (!gp_hif_rtpm_ctx->enable_rpm) {
 		hif_info_high("RUNTIME PM is disabled in ini");