Merge lp://staging/~jhodapp/powerd/fix-music-app-next into lp://staging/powerd

Proposed by Jim Hodapp
Status: Rejected
Rejected by: Ricardo Salveti
Proposed branch: lp://staging/~jhodapp/powerd/fix-music-app-next
Merge into: lp://staging/powerd
Diff against target: 44 lines (+19/-5)
1 file modified
src/power-request.c (+19/-5)
To merge this branch: bzr merge lp://staging/~jhodapp/powerd/fix-music-app-next
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Seth Forshee (community) Disapprove
Ricardo Salveti Pending
Review via email: mp+229823@code.staging.launchpad.net

Commit message

To prevent the device from suspending right away after the last lock is released, add a timeout and wait 6 seconds to release the final lock. This fixes bug: https://bugs.launchpad.net/powerd/+bug/1342351

Description of the change

To prevent the device from suspending right away after the last lock is released, add a timeout and wait 6 seconds to release the final lock. This fixes bug: https://bugs.launchpad.net/powerd/+bug/1342351

To post a comment you must log in.
Revision history for this message
Seth Forshee (sforshee) wrote :

First, I'd argue that powerd shouldn't have this sort of behavior at all, and that the media hub or whoever shouldn't release it's active state request until it's really okay for the device to suspend.

Assuming that powerd should have this behavior, this isn't the right way to do it. The point of using a wake lock here is to avoid a race with the in-kernel autosuspend and handling an incoming request. I.e., block suspend in the kernel until the reqeust can get handed over to the main thread and that thread disables suspend. If powerd were ever used with a kernel lacking autosuspend (e.g. the stock distro kernels) this will fail, because there's no notion of wake locks in these kernels.

It would be better to move the call to enter_suspend() to happen in a timeout 6 seconds in the future, but you've got to make sure that the timeout is cancelled if leaving the suspend state in the interim.

review: Disapprove
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Seth, thanks for the feedback. I wasn't quite sure where it should be done and thought about doing that in enter_suspend() as well. It wasn't quite obvious to me what the difference is between the two. Maybe adding a code comment for both functions would be appropriate to make it absolutely clear what the difference is?

I could go either way for a fix, either in powerd or media-hub. I'm discussing your objections to putting this in powerd with rsalveti. I do know of a way of accomplishing this in media-hub and may decide to move it there.

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Yeah, let's land this in media-hub for now, better to avoid races and regressions.

Unmerged revisions

137. By Jim Hodapp

To prevent the device from suspending right away after the last lock is released, add a timeout and wait 6 seconds to release the final lock. This fixes bug: https://bugs.launchpad.net/music-app/+bug/1342351

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches