Commit graph

3 commits

Author SHA1 Message Date
Todd Poynor
6f26891d67 libsuspend: use wakeup count interface for system suspend
Use the wakeup count interface for requesting suspend, instead of
autosleep, to allow userspace to collect stats on suspend/resume
activity.

Change-Id: I44b5ef031b2bdc5b09c904fb2adbbe16370c2984
2014-03-04 20:02:53 -08:00
Kyle Russell
a26b4caf4c autosuspend_inited flag set even if initialization fails
Prevents possible SIGSEGV on second autosuspend_enable attempt when
first intialization attempt fails.  autosuspend_inited should only
be set once autosuspend_ops has been assigned.

Consider the first call to autosuspend_enable().
autosuspend_init() sets its inited flag to true, and attempts to
set autosuspend_ops.  If all the other autosuspend_*_init() attempts
fail, autosuspend_init() returns -1, which autosuspend_enable()
will return as a failure.  A second call to autosuspend_enable()
will check autosuspend_init() and see that autosuspend has already
been initialized.  It will attempt to access autosuspend_ops, which
were not set in the first initialization attempt, causing a SIGSEGV.

Change-Id: Ib2d3ee62fee4c3b6d0323e5b7f3709a23c6b923f
2012-11-20 09:12:39 -05:00
Colin Cross
a2582c2c4d libsuspend: create new library to handle triggering suspend
libsuspend provides functions autosuspend_enable() and
autosuspend_disable() to trigger suspend on a variety of different
kernels.

Change-Id: I5dc28fb51532fa7c514330f1cfde7698d31d734c
2012-05-07 15:33:34 -07:00