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

Commit 2fe41840 authored by Utkarsh Saxena's avatar Utkarsh Saxena
Browse files

msm: ipa: Fix incorrect wakelock handling



With the current logic __pm_stay_awake is
called whenever wakelock ref cnt is non-zero
and released only when it is 0. Make a change
to acquire wakelock only when it is not held
previously and releasing time chaeck and
release it only if it is held previously.

Change-Id: I8c61c184506c705fd5866de8a606f642c5de3d5b
Acked-by: default avatarChaitanya Pratapa <cpratapa@qti.qualcomm.com>
Signed-off-by: default avatarUtkarsh Saxena <usaxena@codeaurora.org>
parent bc387ed2
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -3430,8 +3430,11 @@ void ipa_inc_acquire_wakelock(enum ipa_wakelock_ref_client ref_client)
		IPADBG("client enum %d mask already set. ref cnt = %d\n",
		ref_client, ipa_ctx->wakelock_ref_cnt.cnt);
	ipa_ctx->wakelock_ref_cnt.cnt |= (1 << ref_client);
	if (ipa_ctx->wakelock_ref_cnt.cnt)
	if (ipa_ctx->wakelock_ref_cnt.cnt &&
		!ipa_ctx->wakelock_ref_cnt.wakelock_acquired) {
		__pm_stay_awake(&ipa_ctx->w_lock);
		ipa_ctx->wakelock_ref_cnt.wakelock_acquired = true;
	}
	IPADBG_LOW("active wakelock ref cnt = %d client enum %d\n",
		ipa_ctx->wakelock_ref_cnt.cnt, ref_client);
	spin_unlock_irqrestore(&ipa_ctx->wakelock_ref_cnt.spinlock, flags);
@@ -3455,8 +3458,11 @@ void ipa_dec_release_wakelock(enum ipa_wakelock_ref_client ref_client)
	ipa_ctx->wakelock_ref_cnt.cnt &= ~(1 << ref_client);
	IPADBG_LOW("active wakelock ref cnt = %d client enum %d\n",
		ipa_ctx->wakelock_ref_cnt.cnt, ref_client);
	if (ipa_ctx->wakelock_ref_cnt.cnt == 0)
	if (ipa_ctx->wakelock_ref_cnt.cnt == 0 &&
		ipa_ctx->wakelock_ref_cnt.wakelock_acquired) {
		__pm_relax(&ipa_ctx->w_lock);
		ipa_ctx->wakelock_ref_cnt.wakelock_acquired = false;
	}
	spin_unlock_irqrestore(&ipa_ctx->wakelock_ref_cnt.spinlock, flags);
}

+1 −0
Original line number Diff line number Diff line
@@ -837,6 +837,7 @@ struct ipa_active_clients {
struct ipa_wakelock_ref_cnt {
	spinlock_t spinlock;
	u32 cnt;
	bool wakelock_acquired;
};

struct ipa_tag_completion {