diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/device.h | 25 | ||||
| -rw-r--r-- | include/linux/pm.h | 35 | ||||
| -rw-r--r-- | include/linux/reboot.h | 2 | ||||
| -rw-r--r-- | include/linux/suspend.h | 10 | ||||
| -rw-r--r-- | include/linux/sysfs.h | 17 |
5 files changed, 57 insertions, 32 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 2795b85ac6f1..59808676d3ef 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -19,6 +19,7 @@ #include <linux/types.h> #include <linux/ioport.h> #include <linux/module.h> +#include <linux/pm.h> #include <asm/semaphore.h> #include <asm/atomic.h> @@ -41,13 +42,6 @@ enum { RESUME_ENABLE, }; -enum device_state { - DEVICE_UNINITIALIZED = 0, - DEVICE_INITIALIZED = 1, - DEVICE_REGISTERED = 2, - DEVICE_GONE = 3, -}; - struct device; struct device_driver; struct class; @@ -64,8 +58,8 @@ struct bus_type { struct device * (*add) (struct device * parent, char * bus_id); int (*hotplug) (struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size); -}; +}; extern int bus_register(struct bus_type * bus); extern void bus_unregister(struct bus_type * bus); @@ -182,8 +176,8 @@ struct class_attribute class_attr_##_name = { \ .store = _store, \ }; -extern int class_create_file(struct class *, struct class_attribute *); -extern void class_remove_file(struct class *, struct class_attribute *); +extern int class_create_file(struct class *, const struct class_attribute *); +extern void class_remove_file(struct class *, const struct class_attribute *); struct class_device { @@ -234,8 +228,10 @@ struct class_device_attribute class_device_attr_##_name = { \ .store = _store, \ }; -extern int class_device_create_file(struct class_device *, struct class_device_attribute *); -extern void class_device_remove_file(struct class_device *, struct class_device_attribute *); +extern int class_device_create_file(struct class_device *, + const struct class_device_attribute *); +extern void class_device_remove_file(struct class_device *, + const struct class_device_attribute *); struct class_interface { @@ -267,13 +263,16 @@ struct device { void *driver_data; /* data private to the driver */ void *platform_data; /* Platform specific data (e.g. ACPI, BIOS data relevant to device) */ - + struct dev_pm_info power; u32 power_state; /* Current operating state. In ACPI-speak, this is D0-D3, D0 being fully functional, and D3 being off. */ unsigned char *saved_state; /* saved device state */ + u32 detach_state; /* State to enter when device is + detached from its driver. */ + u64 *dma_mask; /* dma mask (if dma'able device) */ void (*release)(struct device * dev); diff --git a/include/linux/pm.h b/include/linux/pm.h index ab9305b0953a..6942ad5d5cb3 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -25,6 +25,7 @@ #include <linux/config.h> #include <linux/list.h> +#include <asm/atomic.h> /* * Power management requests @@ -118,29 +119,29 @@ extern int pm_active; /* * Register a device with power management */ -struct pm_dev *pm_register(pm_dev_t type, - unsigned long id, - pm_callback callback); +struct pm_dev __deprecated *pm_register(pm_dev_t type, + unsigned long id, + pm_callback callback); /* * Unregister a device with power management */ -void pm_unregister(struct pm_dev *dev); +void __deprecated pm_unregister(struct pm_dev *dev); /* * Unregister all devices with matching callback */ -void pm_unregister_all(pm_callback callback); +void __deprecated pm_unregister_all(pm_callback callback); /* * Send a request to a single device */ -int pm_send(struct pm_dev *dev, pm_request_t rqst, void *data); +int __deprecated pm_send(struct pm_dev *dev, pm_request_t rqst, void *data); /* * Send a request to all devices */ -int pm_send_all(pm_request_t rqst, void *data); +int __deprecated pm_send_all(pm_request_t rqst, void *data); /* * Find a device @@ -188,6 +189,26 @@ static inline void pm_dev_idle(struct pm_dev *dev) {} extern void (*pm_idle)(void); extern void (*pm_power_off)(void); +struct device; + +struct dev_pm_info { +#ifdef CONFIG_PM + u32 power_state; + u8 * saved_state; + atomic_t pm_users; + struct device * pm_parent; + struct list_head entry; +#endif +}; + +extern void device_pm_set_parent(struct device * dev, struct device * parent); + +extern int device_pm_suspend(u32 state); +extern int device_pm_power_down(u32 state); +extern void device_pm_power_up(void); +extern void device_pm_resume(void); + + #endif /* __KERNEL__ */ #endif /* _LINUX_PM_H */ diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 68b0cb81d986..b73b84d514d6 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -21,7 +21,7 @@ * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task. * POWER_OFF Stop OS and remove all power from system, if possible. * RESTART2 Restart system using given command string. - * SW_SUSPEND Suspend system using Software Suspend if compiled in + * SW_SUSPEND Suspend system using software suspend if compiled in. */ #define LINUX_REBOOT_CMD_RESTART 0x01234567 diff --git a/include/linux/suspend.h b/include/linux/suspend.h index af0143331c94..28788d8a65ff 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -11,9 +11,6 @@ extern unsigned char software_suspend_enabled; -#define NORESUME 1 -#define RESUME_SPECIFIED 2 - #ifdef CONFIG_SOFTWARE_SUSPEND /* page backup entry */ typedef struct pbe { @@ -50,8 +47,7 @@ extern int shrink_mem(void); extern void drain_local_pages(void); /* kernel/suspend.c */ -extern void software_suspend(void); -extern void software_resume(void); +extern int software_suspend(void); extern int register_suspend_notifier(struct notifier_block *); extern int unregister_suspend_notifier(struct notifier_block *); @@ -72,10 +68,10 @@ extern void do_suspend_lowlevel(int resume); extern void do_suspend_lowlevel_s4bios(int resume); #else /* CONFIG_SOFTWARE_SUSPEND */ -static inline void software_suspend(void) +static inline int software_suspend(void) { + return -EPERM; } -#define software_resume() do { } while(0) #define register_suspend_notifier(a) do { } while(0) #define unregister_suspend_notifier(a) do { } while(0) #endif /* CONFIG_SOFTWARE_SUSPEND */ diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 441c0d91f583..b34de79dcf3b 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -40,16 +40,16 @@ extern void sysfs_remove_dir(struct kobject *); extern void -sysfs_rename_dir(struct kobject *, char *new_name); +sysfs_rename_dir(struct kobject *, const char *new_name); extern int -sysfs_create_file(struct kobject *, struct attribute *); +sysfs_create_file(struct kobject *, const struct attribute *); extern int -sysfs_update_file(struct kobject *, struct attribute *); +sysfs_update_file(struct kobject *, const struct attribute *); extern void -sysfs_remove_file(struct kobject *, struct attribute *); +sysfs_remove_file(struct kobject *, const struct attribute *); extern int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name); @@ -57,4 +57,13 @@ sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name); extern void sysfs_remove_link(struct kobject *, char * name); + +struct attribute_group { + char * name; + struct attribute ** attrs; +}; + +int sysfs_create_group(struct kobject *, const struct attribute_group *); +void sysfs_remove_group(struct kobject *, const struct attribute_group *); + #endif /* _SYSFS_H_ */ |
