Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 27435
b: refs/heads/master
c: 2090af7
h: refs/heads/master
i:
  27433: a518bb0
  27431: 5d855cf
v: v3
  • Loading branch information
Linus Torvalds committed Jun 20, 2006
1 parent a6da44d commit 3d2fd19
Show file tree
Hide file tree
Showing 6 changed files with 38 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: 4b6ace7f02cddb8c363ad27bb1e5014c6791e34a
refs/heads/master: 2090af718014f3d434fb8b85b00eeea01ebcec19
3 changes: 3 additions & 0 deletions trunk/drivers/acpi/pci_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,9 @@ static int irqrouter_resume(struct sys_device *dev)

ACPI_FUNCTION_TRACE("irqrouter_resume");

/* Make sure SCI is enabled again (Apple firmware bug?) */
acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK);

acpi_in_resume = 1;
list_for_each(node, &acpi_link.entries) {
link = list_entry(node, struct acpi_pci_link, node);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4297,6 +4297,7 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev)
int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
{
if (ap->flags & ATA_FLAG_SUSPENDED) {
ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 200000);
ap->flags &= ~ATA_FLAG_SUSPENDED;
ata_set_mode(ap);
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/linux/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ extern void console_stop(struct console *);
extern void console_start(struct console *);
extern int is_console_locked(void);

/* Suspend and resume console messages over PM events */
extern void suspend_console(void);
extern void resume_console(void);

/* Some debug stub to catch some of the obvious races in the VT code */
#if 1
#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress)
Expand Down
2 changes: 2 additions & 0 deletions trunk/kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ static int suspend_prepare(suspend_state_t state)
goto Thaw;
}

suspend_console();
if ((error = device_suspend(PMSG_SUSPEND))) {
printk(KERN_ERR "Some devices failed to suspend\n");
goto Finish;
Expand Down Expand Up @@ -133,6 +134,7 @@ int suspend_enter(suspend_state_t state)
static void suspend_finish(suspend_state_t state)
{
device_resume();
resume_console();
thaw_processes();
enable_nonboot_cpus();
if (pm_ops && pm_ops->finish)
Expand Down
28 changes: 27 additions & 1 deletion trunk/kernel/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ EXPORT_SYMBOL(oops_in_progress);
* driver system.
*/
static DECLARE_MUTEX(console_sem);
static DECLARE_MUTEX(secondary_console_sem);
struct console *console_drivers;
/*
* This is used for debugging the mess that is the VT code by
Expand All @@ -76,7 +77,7 @@ struct console *console_drivers;
* path in the console code where we end up in places I want
* locked without the console sempahore held
*/
static int console_locked;
static int console_locked, console_suspended;

/*
* logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars
Expand Down Expand Up @@ -697,6 +698,23 @@ int __init add_preferred_console(char *name, int idx, char *options)
return 0;
}

/**
* suspend_console - suspend the console subsystem
*
* This disables printk() while we go into suspend states
*/
void suspend_console(void)
{
acquire_console_sem();
console_suspended = 1;
}

void resume_console(void)
{
console_suspended = 0;
release_console_sem();
}

/**
* acquire_console_sem - lock the console system for exclusive use.
*
Expand All @@ -708,6 +726,10 @@ int __init add_preferred_console(char *name, int idx, char *options)
void acquire_console_sem(void)
{
BUG_ON(in_interrupt());
if (console_suspended) {
down(&secondary_console_sem);
return;
}
down(&console_sem);
console_locked = 1;
console_may_schedule = 1;
Expand Down Expand Up @@ -750,6 +772,10 @@ void release_console_sem(void)
unsigned long _con_start, _log_end;
unsigned long wake_klogd = 0;

if (console_suspended) {
up(&secondary_console_sem);
return;
}
for ( ; ; ) {
spin_lock_irqsave(&logbuf_lock, flags);
wake_klogd |= log_start - log_end;
Expand Down

0 comments on commit 3d2fd19

Please sign in to comment.