diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2009-03-04 06:44:00 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:38:26 -0400 |
commit | ffa6a7054d172a2f57248dff2de600ca795c5656 (patch) | |
tree | f93c6234bb90295c52fcef09e367ed77ff6c3645 /drivers/base/power/main.c | |
parent | 60530afe1ee8a5532cb09d0ab5bc3f1a6495b780 (diff) |
Driver core: Fix device_move() vs. dpm list ordering, v2
dpm_list currently relies on the fact that child devices will
be registered after their parents to get a correct suspend
order. Using device_move() however destroys this assumption, as
an already registered device may be moved under a newly registered
one.
This patch adds a new argument to device_move(), allowing callers
to specify how dpm_list should be adapted.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r-- | drivers/base/power/main.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 2d14f4ae6c01..e255341682c8 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -107,6 +107,50 @@ void device_pm_remove(struct device *dev) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * device_pm_move_before - move device in dpm_list | ||
111 | * @deva: Device to move in dpm_list | ||
112 | * @devb: Device @deva should come before | ||
113 | */ | ||
114 | void device_pm_move_before(struct device *deva, struct device *devb) | ||
115 | { | ||
116 | pr_debug("PM: Moving %s:%s before %s:%s\n", | ||
117 | deva->bus ? deva->bus->name : "No Bus", | ||
118 | kobject_name(&deva->kobj), | ||
119 | devb->bus ? devb->bus->name : "No Bus", | ||
120 | kobject_name(&devb->kobj)); | ||
121 | /* Delete deva from dpm_list and reinsert before devb. */ | ||
122 | list_move_tail(&deva->power.entry, &devb->power.entry); | ||
123 | } | ||
124 | |||
125 | /** | ||
126 | * device_pm_move_after - move device in dpm_list | ||
127 | * @deva: Device to move in dpm_list | ||
128 | * @devb: Device @deva should come after | ||
129 | */ | ||
130 | void device_pm_move_after(struct device *deva, struct device *devb) | ||
131 | { | ||
132 | pr_debug("PM: Moving %s:%s after %s:%s\n", | ||
133 | deva->bus ? deva->bus->name : "No Bus", | ||
134 | kobject_name(&deva->kobj), | ||
135 | devb->bus ? devb->bus->name : "No Bus", | ||
136 | kobject_name(&devb->kobj)); | ||
137 | /* Delete deva from dpm_list and reinsert after devb. */ | ||
138 | list_move(&deva->power.entry, &devb->power.entry); | ||
139 | } | ||
140 | |||
141 | /** | ||
142 | * device_pm_move_last - move device to end of dpm_list | ||
143 | * @dev: Device to move in dpm_list | ||
144 | */ | ||
145 | void device_pm_move_last(struct device *dev) | ||
146 | { | ||
147 | pr_debug("PM: Moving %s:%s to end of list\n", | ||
148 | dev->bus ? dev->bus->name : "No Bus", | ||
149 | kobject_name(&dev->kobj)); | ||
150 | list_move_tail(&dev->power.entry, &dpm_list); | ||
151 | } | ||
152 | |||
153 | /** | ||
110 | * pm_op - execute the PM operation appropiate for given PM event | 154 | * pm_op - execute the PM operation appropiate for given PM event |
111 | * @dev: Device. | 155 | * @dev: Device. |
112 | * @ops: PM operations to choose from. | 156 | * @ops: PM operations to choose from. |