Commit 7b4032e7 authored by Russell King's avatar Russell King Committed by Linus Torvalds

[PATCH] Provide console_suspend() and console_resume()

Add console_stop() and console_start() methods so the serial drivers
can disable console output before suspending a port, and re-enable output
afterwards.

We also add locking to ensure that we synchronise with any in-progress
printk.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d070a434
...@@ -1923,7 +1923,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) ...@@ -1923,7 +1923,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
* Disable the console device before suspending. * Disable the console device before suspending.
*/ */
if (uart_console(port)) if (uart_console(port))
port->cons->flags &= ~CON_ENABLED; console_stop(port->cons);
uart_change_pm(state, 3); uart_change_pm(state, 3);
...@@ -1945,7 +1945,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) ...@@ -1945,7 +1945,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
*/ */
if (uart_console(port)) { if (uart_console(port)) {
uart_change_speed(state, NULL); uart_change_speed(state, NULL);
port->cons->flags |= CON_ENABLED; console_start(port->cons);
} }
if (state->info && state->info->flags & UIF_INITIALIZED) { if (state->info && state->info->flags & UIF_INITIALIZED) {
......
...@@ -105,6 +105,8 @@ extern void release_console_sem(void); ...@@ -105,6 +105,8 @@ extern void release_console_sem(void);
extern void console_conditional_schedule(void); extern void console_conditional_schedule(void);
extern void console_unblank(void); extern void console_unblank(void);
extern struct tty_driver *console_device(int *); extern struct tty_driver *console_device(int *);
extern void console_stop(struct console *);
extern void console_start(struct console *);
extern int is_console_locked(void); extern int is_console_locked(void);
/* Some debug stub to catch some of the obvious races in the VT code */ /* Some debug stub to catch some of the obvious races in the VT code */
......
...@@ -703,6 +703,27 @@ struct tty_driver *console_device(int *index) ...@@ -703,6 +703,27 @@ struct tty_driver *console_device(int *index)
return driver; return driver;
} }
/*
* Prevent further output on the passed console device so that (for example)
* serial drivers can disable console output before suspending a port, and can
* re-enable output afterwards.
*/
void console_stop(struct console *console)
{
acquire_console_sem();
console->flags &= ~CON_ENABLED;
release_console_sem();
}
EXPORT_SYMBOL(console_stop);
void console_start(struct console *console)
{
acquire_console_sem();
console->flags |= CON_ENABLED;
release_console_sem();
}
EXPORT_SYMBOL(console_start);
/* /*
* The console driver calls this routine during kernel initialization * The console driver calls this routine during kernel initialization
* to register the console printing procedure with printk() and to * to register the console printing procedure with printk() and to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment