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

Commit 25c1e316 authored by Naman Padhiar's avatar Naman Padhiar
Browse files

icnss2: Avoid race between SOC WAKE REQ/RESP



There is a race between soc wake release in event queue
and soc wake request called from driver. Due to which
ref count is not updated properly and results in number
of soc wake release send to FW is more than number of
soc wake request. Fix it by atomically incrementing
ref count.

Change-Id: I1e134af8a1170d804aeaea53ea6bd288bbcb42b8
Signed-off-by: default avatarNaman Padhiar <npadhiar@codeaurora.org>
parent c5a32017
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2329,7 +2329,6 @@ EXPORT_SYMBOL(icnss_set_fw_log_mode);
int icnss_force_wake_request(struct device *dev)
{
	struct icnss_priv *priv = dev_get_drvdata(dev);
	int count = 0;

	if (!dev)
		return -ENODEV;
@@ -2339,9 +2338,9 @@ int icnss_force_wake_request(struct device *dev)
		return -EINVAL;
	}

	if (atomic_read(&priv->soc_wake_ref_count)) {
		count = atomic_inc_return(&priv->soc_wake_ref_count);
		icnss_pr_dbg("SOC already awake, Ref count: %d", count);
	if (atomic_inc_not_zero(&priv->soc_wake_ref_count)) {
		icnss_pr_dbg("SOC already awake, Ref count: %d",
			     atomic_read(&priv->soc_wake_ref_count));
		return 0;
	}