Skip to content

Commit fc44a2e

Browse files
Qingwu-LiFedeDP
authored andcommitted
pm: fix suspend counter increment only on successful validation
The suspend counter was incremented even when VALIDATE_REQ() failed, causing the counter to grow indefinitely on duplicate pause requests. This led to continuous validation failures and required multiple resume calls to exit the suspended state. Move the counter increment inside the VALIDATE_REQ() conditional block to ensure it only increments on successful validation. Before fix: Multiple resume requests needed to match pause count After fix: Single resume request properly exits suspended state Reproduce sequence: busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b true busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b true busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b true busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b true busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b true busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b false busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b false busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b false busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b false busctl --user introspect org.clight.clight /org/clight/clight | grep Suspended .Suspended property b true emits-change busctl --user call org.clight.clight /org/clight/clight org.clight.clight Pause b false busctl --user introspect org.clight.clight /org/clight/clight | grep Suspended .Suspended property b false emits-change Signed-off-by: LI Qingwu <[email protected]>
1 parent 3842dcb commit fc44a2e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/modules/pm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ static void on_suspend_req(suspend_upd *up) {
262262
M_PUB(suspend_msg);
263263
}
264264
}
265+
266+
/* Count currently held suspends */
267+
if (up->new) {
268+
suspend_ctr++;
269+
}
265270
}
266-
/* Count currently held suspends */
267-
if (up->new) {
268-
suspend_ctr++;
269-
}
270-
DEBUG("Suspend ctr: %d\n", suspend_ctr);
271271
}

0 commit comments

Comments
 (0)