aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/resume.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 14:49:46 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 14:49:46 -0400
commitdd77a4ee0f3981693d4229aa1d57cea9e526ff47 (patch)
treecb486be20b950201103a03636cbb1e1d180f0098 /drivers/base/power/resume.c
parente8216dee838c09776680a6f1a2e54d81f3cdfa14 (diff)
parent7e9f4b2d3e21e87c26025810413ef1592834e63b (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (47 commits) Driver core: Don't call put methods while holding a spinlock Driver core: Remove unneeded routines from driver core Driver core: Fix potential deadlock in driver core PCI: enable driver multi-threaded probe Driver Core: add ability for drivers to do a threaded probe sysfs: add proper sysfs_init() prototype drivers/base: check errors drivers/base: Platform notify needs to occur before drivers attach to the device v4l-dev2: handle __must_check add CONFIG_ENABLE_MUST_CHECK add __must_check to device management code Driver core: fixed add_bind_files() definition Driver core: fix comments in drivers/base/power/resume.c sysfs_remove_bin_file: no return value, dump_stack on error kobject: must_check fixes Driver core: add ability for devices to create and remove bin files Class: add support for class interfaces for devices Driver core: create devices/virtual/ tree Driver core: add device_rename function Driver core: add ability for classes to handle devices properly ...
Diffstat (limited to 'drivers/base/power/resume.c')
-rw-r--r--drivers/base/power/resume.c37
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
51static 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 */
48void dpm_resume(void) 70void 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
75void device_resume(void) 97void 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.