Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 542be884 authored by Yue Ma's avatar Yue Ma
Browse files

cnss2: Avoid race condition between time sync and system suspend



Add mutex to protect time sync operation and PCIe bus suspend from
system suspend to avoid race condition between msm_pcie_pm_suspend
and msm_pcie_prevent_l1/allow_l1.

Change-Id: I8ff0f258e8928b97deeada134982ee2cbe93ae9a
Signed-off-by: default avatarYue Ma <yuem@codeaurora.org>
parent 06a7c1db
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1685,7 +1685,9 @@ static void cnss_pci_time_sync_work_hdlr(struct work_struct *work)
	if (cnss_pci_pm_runtime_get_sync(pci_priv, RTPM_ID_CNSS) < 0)
		goto runtime_pm_put;

	mutex_lock(&pci_priv->bus_lock);
	cnss_pci_update_timestamp(pci_priv);
	mutex_unlock(&pci_priv->bus_lock);
	schedule_delayed_work(&pci_priv->time_sync_work,
			      msecs_to_jiffies(time_sync_period_ms));

@@ -2791,7 +2793,9 @@ static int cnss_pci_suspend(struct device *dev)
		goto clear_flag;

	if (!pci_priv->disable_pc) {
		mutex_lock(&pci_priv->bus_lock);
		ret = cnss_pci_suspend_bus(pci_priv);
		mutex_unlock(&pci_priv->bus_lock);
		if (ret)
			goto resume_driver;
	}