summary refs log tree commit diff
path: root/drivers/char/vt.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2006-03-23 03:00:07 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 07:38:08 -0800
commitff4da2e262d2509fe1bacff70dd00934be569c66 (patch)
tree1e171f1858be98f4a7c6ea3f92358b692dab44dc /drivers/char/vt.c
parente4e4d665560c75afb6060cb43bb6738777648ca1 (diff)
downloadlinux-ff4da2e262d2509fe1bacff70dd00934be569c66.tar.gz
[PATCH] swsusp: add check for suspension of X-controlled devices
It is unsafe to suspend devices if the hardware is controlled by X.  Add an
extra check to prevent this from happening.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/vt.c')
-rw-r--r--drivers/char/vt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0900d1dbee59..86b31b87eb85 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -3234,6 +3234,14 @@ void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org)
 	}
 }
 
+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
  */