[linux-pm] [RFC] Power Management API (rev 1)

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

 



Hi!

> I've made some revisions to my new power management API.  I would
> appreciate any suggestions or comments.


> /*
>  *  pm.h - the Power Management Interface
>  *
>  */
> 
> #ifndef _LINUX_PM_H
> #define _LINUX_PM_H
> 
> #ifdef __KERNEL__
> 
> #include <linux/config.h>
> #include <linux/list.h>
> #include <asm/atomic.h>
> 
> struct device;
> 
> struct power_resource;
> struct power_driver;
> struct power_policy;
> struct power_device;
> 
> 
> /*
>  * Global System Power States
>  *
>  * Reflect the status of the overall system.
>  */
> 
> struct system_power_state {
> 	unsigned int state;

We already have int system_state... How is this different?

Please move the defines near here, and preferably add type-checking
for sparse.

> 	unsigned int flags;
> 
> 	struct list_head state_list;
> };
> 
> extern int pm_register_system_state(struct system_power_state *state);
> extern void pm_unregister_system_state(struct system_power_state *state);
> 
> extern struct system_power_state *
> pm_get_system_state_data(unsigned int state);

Having "unsigned int state" is asking for trouble.

> /*
>  * Power States
>  *
>  * These are used to define device-specific power states.
>  */
> 
> struct power_state {
> 	char * name;
> 	int available;
> 
> 	unsigned int state;
> 	unsigned int flags;

Are they same type as system_power_state.state? This should be clear,
and type-checked by sparse. Otherwise people will get it wrong.


> /*
>  * Power Devices
>  *
>  * Power devices are the core building block of a system's power management
>  * topology.  They may require power resources, but the primary dependency
>  * relationships are represented by a tree of "power devices".  This tree
>  * is based on a power domain (or container) model.
>  */
> 
> struct power_device {
> 	char			* name;
> 	struct kobject		kobj;
> 
> 	unsigned int		state;
> 	unsigned int		min_state;
> 	unsigned int		max_state;

Third "state"... Are they same type? Different?

							Pavel
-- 
Boycott Kodak -- for their patent abuse against Java.

[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