summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPatrick Mochel <mochel@osdl.org>2003-06-09 23:58:37 -0700
committerPatrick Mochel <mochel@osdl.org>2003-06-09 23:58:37 -0700
commitd507789a02e933ab503a4457abd6f56c579dea05 (patch)
treeef221eeb3e34191d409c93702414585986136b17 /include/linux
parent4db4540fc9455c8d0e3d506b0a62b433f31d2150 (diff)
[driver model] Add save() and restore() methods for system device drivers.
It turns out that at least some system device drivers need to allocate memory and/or sleep for one reason or another when either saving or restoring state. Instead of adding a 'level' paramter to the suspend() and resume() methods, which I despise and think is a horrible programming interface, two new methods have been added to struct sysdev_driver: int (*save)(struct sys_device *, u32 state); int (*restore)(struct sys_device *); that are called explicitly before and after suspend() and resume() respectively, with interrupts enabled. This gives the drivers the flexibility to allocate memory and sleep, if necessary.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sysdev.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index 2a90db8d41de..4bc3e22b5104 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -31,8 +31,10 @@ struct sysdev_class {
/* Default operations for these types of devices */
int (*shutdown)(struct sys_device *);
+ int (*save)(struct sys_device *, u32 state);
int (*suspend)(struct sys_device *, u32 state);
int (*resume)(struct sys_device *);
+ int (*restore)(struct sys_device *);
struct kset kset;
};
@@ -50,8 +52,10 @@ struct sysdev_driver {
int (*add)(struct sys_device *);
int (*remove)(struct sys_device *);
int (*shutdown)(struct sys_device *);
+ int (*save)(struct sys_device *, u32 state);
int (*suspend)(struct sys_device *, u32 state);
int (*resume)(struct sys_device *);
+ int (*restore)(struct sys_device *);
};