Re: [PATCH 02/11] PM: Add early suspend api.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 14, 2009 at 1:17 AM, Nigel Cunningham
<ncunningham@xxxxxxxxxxx> wrote:
>> +
>> +/* The early_suspend structure defines suspend and resume hooks to be called
>> + * when the user visible sleep state of the system changes, and a level to
>> + * control the order. They can be used to turn off the screen and input
>> + * devices that are not used for wakeup.
>> + * Suspend handlers are called in low to high level order, resume handlers are
>> + * called in the opposite order. If, when calling register_early_suspend,
>> + * the suspend handlers have already been called without a matching call to the
>> + * resume handlers, the suspend handler will be called directly from
>> + * register_early_suspend. This direct call can violate the normal level order.
>> + */
>
> Registering can happen while we're suspending and resuming? That
> potential variation in ordering sounds dangerous as far as opportunities
> for race conditions goes.
>

Yes, but there is no time limit on how long the system is in the early
suspend state. This direct call at least allows a driver to rely on
suspend being called before resume.

>> +struct early_suspend {
>> +#ifdef CONFIG_HAS_EARLYSUSPEND
>> +     struct list_head link;
>> +     int level;
>> +     void (*suspend)(struct early_suspend *h);
>> +     void (*resume)(struct early_suspend *h);
>
> Could these functions ever potentially fail in way that you'd want
> callers to know? If so, you might want a non void return value.
>

They are not allowed to fail. These calls inform drivers that the user
visible sleep state has changed.

-- 
Arve Hjønnevåg
_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm


[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux