diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-06 13:13:54 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-06 13:13:54 -0400 |
| commit | 11e4afb49b7fa1fc8e1ffd850c1806dd86a08204 (patch) | |
| tree | 9e57efcb106ae912f7bec718feb3f8ec607559bb /drivers/xen/manage.c | |
| parent | 162500b3a3ff39d941d29db49b41a16667ae44f0 (diff) | |
| parent | 9b2a606d3898fcb2eedb6faded3bb37549590ac4 (diff) | |
Merge branches 'gemini' and 'misc' into devel
Diffstat (limited to 'drivers/xen/manage.c')
| -rw-r--r-- | drivers/xen/manage.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 5d42d55e299b..07e857b0de13 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | */ | 3 | */ |
| 4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
| 5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
| 6 | #include <linux/slab.h> | ||
| 6 | #include <linux/reboot.h> | 7 | #include <linux/reboot.h> |
| 7 | #include <linux/sysrq.h> | 8 | #include <linux/sysrq.h> |
| 8 | #include <linux/stop_machine.h> | 9 | #include <linux/stop_machine.h> |
| @@ -79,12 +80,6 @@ static void do_suspend(void) | |||
| 79 | 80 | ||
| 80 | shutting_down = SHUTDOWN_SUSPEND; | 81 | shutting_down = SHUTDOWN_SUSPEND; |
| 81 | 82 | ||
| 82 | err = stop_machine_create(); | ||
| 83 | if (err) { | ||
| 84 | printk(KERN_ERR "xen suspend: failed to setup stop_machine %d\n", err); | ||
| 85 | goto out; | ||
| 86 | } | ||
| 87 | |||
| 88 | #ifdef CONFIG_PREEMPT | 83 | #ifdef CONFIG_PREEMPT |
| 89 | /* If the kernel is preemptible, we need to freeze all the processes | 84 | /* If the kernel is preemptible, we need to freeze all the processes |
| 90 | to prevent them from being in the middle of a pagetable update | 85 | to prevent them from being in the middle of a pagetable update |
| @@ -92,7 +87,7 @@ static void do_suspend(void) | |||
| 92 | err = freeze_processes(); | 87 | err = freeze_processes(); |
| 93 | if (err) { | 88 | if (err) { |
| 94 | printk(KERN_ERR "xen suspend: freeze failed %d\n", err); | 89 | printk(KERN_ERR "xen suspend: freeze failed %d\n", err); |
| 95 | goto out_destroy_sm; | 90 | goto out; |
| 96 | } | 91 | } |
| 97 | #endif | 92 | #endif |
| 98 | 93 | ||
| @@ -135,12 +130,8 @@ out_resume: | |||
| 135 | out_thaw: | 130 | out_thaw: |
| 136 | #ifdef CONFIG_PREEMPT | 131 | #ifdef CONFIG_PREEMPT |
| 137 | thaw_processes(); | 132 | thaw_processes(); |
| 138 | |||
| 139 | out_destroy_sm: | ||
| 140 | #endif | ||
| 141 | stop_machine_destroy(); | ||
| 142 | |||
| 143 | out: | 133 | out: |
| 134 | #endif | ||
| 144 | shutting_down = SHUTDOWN_INVALID; | 135 | shutting_down = SHUTDOWN_INVALID; |
| 145 | } | 136 | } |
| 146 | #endif /* CONFIG_PM_SLEEP */ | 137 | #endif /* CONFIG_PM_SLEEP */ |
| @@ -194,6 +185,7 @@ static void shutdown_handler(struct xenbus_watch *watch, | |||
| 194 | kfree(str); | 185 | kfree(str); |
| 195 | } | 186 | } |
| 196 | 187 | ||
| 188 | #ifdef CONFIG_MAGIC_SYSRQ | ||
| 197 | static void sysrq_handler(struct xenbus_watch *watch, const char **vec, | 189 | static void sysrq_handler(struct xenbus_watch *watch, const char **vec, |
| 198 | unsigned int len) | 190 | unsigned int len) |
| 199 | { | 191 | { |
| @@ -223,15 +215,16 @@ static void sysrq_handler(struct xenbus_watch *watch, const char **vec, | |||
| 223 | handle_sysrq(sysrq_key, NULL); | 215 | handle_sysrq(sysrq_key, NULL); |
| 224 | } | 216 | } |
| 225 | 217 | ||
| 226 | static struct xenbus_watch shutdown_watch = { | ||
| 227 | .node = "control/shutdown", | ||
| 228 | .callback = shutdown_handler | ||
| 229 | }; | ||
| 230 | |||
| 231 | static struct xenbus_watch sysrq_watch = { | 218 | static struct xenbus_watch sysrq_watch = { |
| 232 | .node = "control/sysrq", | 219 | .node = "control/sysrq", |
| 233 | .callback = sysrq_handler | 220 | .callback = sysrq_handler |
| 234 | }; | 221 | }; |
| 222 | #endif | ||
| 223 | |||
| 224 | static struct xenbus_watch shutdown_watch = { | ||
| 225 | .node = "control/shutdown", | ||
| 226 | .callback = shutdown_handler | ||
| 227 | }; | ||
| 235 | 228 | ||
| 236 | static int setup_shutdown_watcher(void) | 229 | static int setup_shutdown_watcher(void) |
| 237 | { | 230 | { |
| @@ -243,11 +236,13 @@ static int setup_shutdown_watcher(void) | |||
| 243 | return err; | 236 | return err; |
| 244 | } | 237 | } |
| 245 | 238 | ||
| 239 | #ifdef CONFIG_MAGIC_SYSRQ | ||
| 246 | err = register_xenbus_watch(&sysrq_watch); | 240 | err = register_xenbus_watch(&sysrq_watch); |
| 247 | if (err) { | 241 | if (err) { |
| 248 | printk(KERN_ERR "Failed to set sysrq watcher\n"); | 242 | printk(KERN_ERR "Failed to set sysrq watcher\n"); |
| 249 | return err; | 243 | return err; |
| 250 | } | 244 | } |
| 245 | #endif | ||
| 251 | 246 | ||
| 252 | return 0; | 247 | return 0; |
| 253 | } | 248 | } |
