aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/manage.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen/manage.c')
-rw-r--r--drivers/xen/manage.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 2ac4440e7b08..07e857b0de13 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -80,12 +80,6 @@ static void do_suspend(void)
80 80
81 shutting_down = SHUTDOWN_SUSPEND; 81 shutting_down = SHUTDOWN_SUSPEND;
82 82
83 err = stop_machine_create();
84 if (err) {
85 printk(KERN_ERR "xen suspend: failed to setup stop_machine %d\n", err);
86 goto out;
87 }
88
89#ifdef CONFIG_PREEMPT 83#ifdef CONFIG_PREEMPT
90 /* 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
91 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
@@ -93,7 +87,7 @@ static void do_suspend(void)
93 err = freeze_processes(); 87 err = freeze_processes();
94 if (err) { 88 if (err) {
95 printk(KERN_ERR "xen suspend: freeze failed %d\n", err); 89 printk(KERN_ERR "xen suspend: freeze failed %d\n", err);
96 goto out_destroy_sm; 90 goto out;
97 } 91 }
98#endif 92#endif
99 93
@@ -136,12 +130,8 @@ out_resume:
136out_thaw: 130out_thaw:
137#ifdef CONFIG_PREEMPT 131#ifdef CONFIG_PREEMPT
138 thaw_processes(); 132 thaw_processes();
139
140out_destroy_sm:
141#endif
142 stop_machine_destroy();
143
144out: 133out:
134#endif
145 shutting_down = SHUTDOWN_INVALID; 135 shutting_down = SHUTDOWN_INVALID;
146} 136}
147#endif /* CONFIG_PM_SLEEP */ 137#endif /* CONFIG_PM_SLEEP */
@@ -195,6 +185,7 @@ static void shutdown_handler(struct xenbus_watch *watch,
195 kfree(str); 185 kfree(str);
196} 186}
197 187
188#ifdef CONFIG_MAGIC_SYSRQ
198static void sysrq_handler(struct xenbus_watch *watch, const char **vec, 189static void sysrq_handler(struct xenbus_watch *watch, const char **vec,
199 unsigned int len) 190 unsigned int len)
200{ 191{
@@ -224,15 +215,16 @@ static void sysrq_handler(struct xenbus_watch *watch, const char **vec,
224 handle_sysrq(sysrq_key, NULL); 215 handle_sysrq(sysrq_key, NULL);
225} 216}
226 217
227static struct xenbus_watch shutdown_watch = {
228 .node = "control/shutdown",
229 .callback = shutdown_handler
230};
231
232static struct xenbus_watch sysrq_watch = { 218static struct xenbus_watch sysrq_watch = {
233 .node = "control/sysrq", 219 .node = "control/sysrq",
234 .callback = sysrq_handler 220 .callback = sysrq_handler
235}; 221};
222#endif
223
224static struct xenbus_watch shutdown_watch = {
225 .node = "control/shutdown",
226 .callback = shutdown_handler
227};
236 228
237static int setup_shutdown_watcher(void) 229static int setup_shutdown_watcher(void)
238{ 230{
@@ -244,11 +236,13 @@ static int setup_shutdown_watcher(void)
244 return err; 236 return err;
245 } 237 }
246 238
239#ifdef CONFIG_MAGIC_SYSRQ
247 err = register_xenbus_watch(&sysrq_watch); 240 err = register_xenbus_watch(&sysrq_watch);
248 if (err) { 241 if (err) {
249 printk(KERN_ERR "Failed to set sysrq watcher\n"); 242 printk(KERN_ERR "Failed to set sysrq watcher\n");
250 return err; 243 return err;
251 } 244 }
245#endif
252 246
253 return 0; 247 return 0;
254} 248}