[linux-pm] PM:Different idea for callbacks, smoother evolution

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

 



On Sat, 4 Dec 2004, Benjamin Herrenschmidt wrote:

> The idea is simple. Drivers describe their possible power states in an
> array, which contains:
> 
>  - state name (ascii) for use by sysfs (see below)
>  - some flags (for later use mostly)
>  - matching system state
>  - additional infos (see below), that is struct can be extended for
> later uses.
> 
> set_power_state() is called to get to a state (passing the state index
> in the array), along with a possible argument giving indications on the
> cause of the state transition (our former flags)
> 
> the matching system state is used to find an appropriate driver state
> for a system sleep state. System sleep states are globally defined, for
> now, they would be PM_SYSTEM_RUNNING, PM_SYSTEM_IDLE,
> PM_SYSTEM_SUSPENDED. They are defined as bits in a mask so a driver can
> match several system states to one power state. RUNNING can be 0.

I don't like this because (apart from the unwieldiness of all those state
tables) it requires the table to contain enough information for the PM
core to pick out the appropriate state for any combination of event/flags.  
Such things are better left to the individual drivers, which can use a
table-based lookup if they want but can do something else if it would work
out better.  For example, transitions may depend on the current state as
well as the values of event/flags.

If you leave the decision-making entirely up to the drivers, and expose
through sysfs only the name entries of your state tables, then the rest of
the table is unnecessary and you end up with something very much like what
we have been discussing all along.

Alan Stern



[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