diff options
author | Linus Torvalds <torvalds@osdl.org> | 2006-06-24 17:50:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-26 00:08:36 -0400 |
commit | 7c8265f51073bc8632a99de78d5fd19117ed78b7 (patch) | |
tree | 85efa2114f3765c98236152ca46d783dc1bd7d5b /drivers/base/power/resume.c | |
parent | ceeee1fb2897651b434547eb26d93e6d2ff5a1a5 (diff) |
Suspend infrastructure cleanup and extension
Allow devices to participate in the suspend process more intimately,
in particular, allow the final phase (with interrupts disabled) to
also be open to normal devices, not just system devices.
Also, allow classes to participate in device suspend.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/power/resume.c')
-rw-r--r-- | drivers/base/power/resume.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c index 826093ef4c7e..48e3d49d7b65 100644 --- a/drivers/base/power/resume.c +++ b/drivers/base/power/resume.c | |||
@@ -38,13 +38,35 @@ int resume_device(struct device * dev) | |||
38 | dev_dbg(dev,"resuming\n"); | 38 | dev_dbg(dev,"resuming\n"); |
39 | error = dev->bus->resume(dev); | 39 | error = dev->bus->resume(dev); |
40 | } | 40 | } |
41 | if (dev->class && dev->class->resume) { | ||
42 | dev_dbg(dev,"class resume\n"); | ||
43 | error = dev->class->resume(dev); | ||
44 | } | ||
41 | up(&dev->sem); | 45 | up(&dev->sem); |
42 | TRACE_RESUME(error); | 46 | TRACE_RESUME(error); |
43 | return error; | 47 | return error; |
44 | } | 48 | } |
45 | 49 | ||
46 | 50 | ||
51 | static int resume_device_early(struct device * dev) | ||
52 | { | ||
53 | int error = 0; | ||
47 | 54 | ||
55 | TRACE_DEVICE(dev); | ||
56 | TRACE_RESUME(0); | ||
57 | if (dev->bus && dev->bus->resume_early) { | ||
58 | dev_dbg(dev,"EARLY resume\n"); | ||
59 | error = dev->bus->resume_early(dev); | ||
60 | } | ||
61 | TRACE_RESUME(error); | ||
62 | return error; | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | * Resume the devices that have either not gone through | ||
67 | * the late suspend, or that did go through it but also | ||
68 | * went through the early resume | ||
69 | */ | ||
48 | void dpm_resume(void) | 70 | void dpm_resume(void) |
49 | { | 71 | { |
50 | down(&dpm_list_sem); | 72 | down(&dpm_list_sem); |
@@ -99,10 +121,8 @@ void dpm_power_up(void) | |||
99 | struct list_head * entry = dpm_off_irq.next; | 121 | struct list_head * entry = dpm_off_irq.next; |
100 | struct device * dev = to_device(entry); | 122 | struct device * dev = to_device(entry); |
101 | 123 | ||
102 | get_device(dev); | 124 | list_move_tail(entry, &dpm_off); |
103 | list_move_tail(entry, &dpm_active); | 125 | resume_device_early(dev); |
104 | resume_device(dev); | ||
105 | put_device(dev); | ||
106 | } | 126 | } |
107 | } | 127 | } |
108 | 128 | ||