Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23023
b: refs/heads/master
c: ff4da2e
h: refs/heads/master
i:
  23021: e6fe66c
  23019: b3ee320
  23015: b54417b
  23007: 5b74a81
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Mar 23, 2006
1 parent c781f47 commit a946e18
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e4e4d665560c75afb6060cb43bb6738777648ca1
refs/heads/master: ff4da2e262d2509fe1bacff70dd00934be569c66
5 changes: 4 additions & 1 deletion trunk/drivers/base/power/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*
*/

#include <linux/vt_kern.h>
#include <linux/device.h>
#include "../base.h"
#include "power.h"
Expand Down Expand Up @@ -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.
Expand All @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/char/vt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/vt_kern.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
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
Expand Down

0 comments on commit a946e18

Please sign in to comment.