From: Andrew Morton It broke APM suspend, probably because APM doesn't switch back to a VT when suspending. Tracked down by Matt Mackall Rafael sayeth: "It only fixed the theoretical issue that a quick-handed user could switch to X after processes have been frozen and before the devices are suspended. With the current userland suspend tools it shouldn't be necessary." Cc: Pavel Machek Cc: "Rafael J. Wysocki" Signed-off-by: Andrew Morton --- drivers/base/power/suspend.c | 5 +---- drivers/char/vt.c | 8 -------- include/linux/vt_kern.h | 5 ----- 3 files changed, 1 insertion(+), 17 deletions(-) diff -puN drivers/base/power/suspend.c~revert-swsusp-add-check-for-suspension-of-x-controlled-devices drivers/base/power/suspend.c --- 25/drivers/base/power/suspend.c~revert-swsusp-add-check-for-suspension-of-x-controlled-devices Fri May 26 15:04:27 2006 +++ 25-akpm/drivers/base/power/suspend.c Fri May 26 15:04:27 2006 @@ -8,7 +8,6 @@ * */ -#include #include #include #include @@ -81,6 +80,7 @@ int suspend_device(struct device * dev, return error; } + /** * device_suspend - Save state and stop all devices in system. * @state: Power state to put each device in. @@ -100,9 +100,6 @@ int device_suspend(pm_message_t state) { int error = 0; - if (!is_console_suspend_safe()) - return -EINVAL; - down(&dpm_sem); down(&dpm_list_sem); while (!list_empty(&dpm_active) && error == 0) { diff -puN drivers/char/vt.c~revert-swsusp-add-check-for-suspension-of-x-controlled-devices drivers/char/vt.c --- 25/drivers/char/vt.c~revert-swsusp-add-check-for-suspension-of-x-controlled-devices Fri May 26 15:04:27 2006 +++ 25-akpm/drivers/char/vt.c Fri May 26 15:04:27 2006 @@ -3246,14 +3246,6 @@ void vcs_scr_writew(struct vc_data *vc, } } -int is_console_suspend_safe(void) -{ - /* It is unsafe to suspend devices while X has control of the - * hardware. Make sure we are running on a kernel-controlled console. - */ - return vc_cons[fg_console].d->vc_mode == KD_TEXT; -} - /* * Visible symbols for modules */ diff -puN include/linux/vt_kern.h~revert-swsusp-add-check-for-suspension-of-x-controlled-devices include/linux/vt_kern.h --- 25/include/linux/vt_kern.h~revert-swsusp-add-check-for-suspension-of-x-controlled-devices Fri May 26 15:04:27 2006 +++ 25-akpm/include/linux/vt_kern.h Fri May 26 15:04:27 2006 @@ -72,11 +72,6 @@ int con_copy_unimap(struct vc_data *dst_ int vt_waitactive(int vt); void change_console(struct vc_data *new_vc); void reset_vc(struct vc_data *vc); -#ifdef CONFIG_VT -int is_console_suspend_safe(void); -#else -static inline int is_console_suspend_safe(void) { return 1; } -#endif /* * vc_screen.c shares this temporary buffer with the console write code so that _