[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>
This commit is contained in:
committed by
Linus Torvalds
parent
e4e4d66556
commit
ff4da2e262
@@ -8,6 +8,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/vt_kern.h>
|
||||
#include <linux/device.h>
|
||||
#include "../base.h"
|
||||
#include "power.h"
|
||||
@@ -62,7 +63,6 @@ int suspend_device(struct device * dev, pm_message_t state)
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* device_suspend - Save state and stop all devices in system.
|
||||
* @state: Power state to put each device in.
|
||||
@@ -82,6 +82,9 @@ 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) {
|
||||
|
||||
Reference in New Issue
Block a user