diff options
Diffstat (limited to 'drivers/base/power/resume.c')
-rw-r--r-- | drivers/base/power/resume.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c index 826093ef4c7e..020be36705a6 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); |
@@ -74,6 +96,7 @@ void dpm_resume(void) | |||
74 | 96 | ||
75 | void device_resume(void) | 97 | void device_resume(void) |
76 | { | 98 | { |
99 | might_sleep(); | ||
77 | down(&dpm_sem); | 100 | down(&dpm_sem); |
78 | dpm_resume(); | 101 | dpm_resume(); |
79 | up(&dpm_sem); | 102 | up(&dpm_sem); |
@@ -83,12 +106,12 @@ EXPORT_SYMBOL_GPL(device_resume); | |||
83 | 106 | ||
84 | 107 | ||
85 | /** | 108 | /** |
86 | * device_power_up_irq - Power on some devices. | 109 | * dpm_power_up - Power on some devices. |
87 | * | 110 | * |
88 | * Walk the dpm_off_irq list and power each device up. This | 111 | * Walk the dpm_off_irq list and power each device up. This |
89 | * is used for devices that required they be powered down with | 112 | * is used for devices that required they be powered down with |
90 | * interrupts disabled. As devices are powered on, they are moved to | 113 | * interrupts disabled. As devices are powered on, they are moved |
91 | * the dpm_suspended list. | 114 | * to the dpm_active list. |
92 | * | 115 | * |
93 | * Interrupts must be disabled when calling this. | 116 | * Interrupts must be disabled when calling this. |
94 | */ | 117 | */ |
@@ -99,16 +122,14 @@ void dpm_power_up(void) | |||
99 | struct list_head * entry = dpm_off_irq.next; | 122 | struct list_head * entry = dpm_off_irq.next; |
100 | struct device * dev = to_device(entry); | 123 | struct device * dev = to_device(entry); |
101 | 124 | ||
102 | get_device(dev); | 125 | list_move_tail(entry, &dpm_off); |
103 | list_move_tail(entry, &dpm_active); | 126 | resume_device_early(dev); |
104 | resume_device(dev); | ||
105 | put_device(dev); | ||
106 | } | 127 | } |
107 | } | 128 | } |
108 | 129 | ||
109 | 130 | ||
110 | /** | 131 | /** |
111 | * device_pm_power_up - Turn on all devices that need special attention. | 132 | * device_power_up - Turn on all devices that need special attention. |
112 | * | 133 | * |
113 | * Power on system devices then devices that required we shut them down | 134 | * Power on system devices then devices that required we shut them down |
114 | * with interrupts disabled. | 135 | * with interrupts disabled. |