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

Commit 0545550d authored by Gokhan Moral's avatar Gokhan Moral Committed by Samuel Pascua
Browse files

wakelock: main_wake_lock fix by tungstwenty

parent 0492c4c6
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -281,7 +281,14 @@ static void assign_next_awake_culprit_locked(void)
	}
	if (candidate_lock) {
		// Account PREVENTING_SUSPEND time before assigning new culprit
		if (wake_lock_active(&main_wake_lock)) {
			// Update times but keep all active locks as *not* PREVENTING_SUSPEND, "main" is active
			update_sleep_wait_stats_locked(1);
		} else {
			// Update times and set all active locks as PREVENTING_SUSPEND, "main" is not active and the device
			// could be sleeping
			update_sleep_wait_stats_locked(0);
		}
		// Set now as the last_time of the culprit
		candidate_lock->exclusive_stat.last_time = ktime_get();
		// Assign new culprit
@@ -533,6 +540,7 @@ void wake_lock_destroy(struct wake_lock *lock)
		pr_info("wake_lock_destroy name=%s\n", lock->name);
	spin_lock_irqsave(&list_lock, irqflags);
	lock->flags &= ~WAKE_LOCK_INITIALIZED;
	lock->flags &= ~WAKE_LOCK_ACTIVE;
	list_del(&lock->link);
#ifdef CONFIG_WAKELOCK_STAT
	if (lock->flags & WAKE_LOCK_AWAKE_CULPRIT) {