Re: [RFD] Automatic suspend

From: Matthew Garrett
Date: Fri Feb 27 2009 - 09:30:52 EST


On Fri, Feb 27, 2009 at 03:22:39PM +0100, Rafael J. Wysocki wrote:
> On Friday 27 February 2009, Pavel Machek wrote:
> > Wakelocks done right are single atomic_t... and if you set it to 0,
> > you just unblock "sleeper" thread or something. Zero polling and very
> > simple...
>
> Except that you have to check all of the wakelocks periodically in a loop =>
> polling. So?

Why do you need to check them? If you're taking this approach you just
have something like:

suspend_unblock() {
if (atomc_dec_and_test(&suspend_lock))
suspend();
}

and then check that the lock count is still 0 after device_suspend().
There's no need to poll.

--
Matthew Garrett | mjg59@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/