Commit 2d237c63 authored by Stephane Doyon's avatar Stephane Doyon Committed by Linus Torvalds

[PATCH] Console blanking locking fix

I've had WARN_CONSOLE_UNLOCKED warnings when calling TIOCLINUX
TIOCL_BLANKSCREEN and TIOCL_UNBLANKSCREEN.

(I'm blind and I use a braille display.  I use those functions to blank my
laptop's screen so people don't read it, and hopefully to conserve power.)

The warnings are from these places:
do_blank_screen at drivers/char/vt.c:2754 (Not tainted)
save_screen at drivers/char/vt.c:575 (Not tainted)
do_unblank_screen at drivers/char/vt.c:2822 (Not tainted)
set_palette at drivers/char/vt.c:2908 (Not tainted)

At a glance I would think the following patch ought to fix that.  Tested on
one machine.  Could you please tell me if this is correct and/or forward
the patch where appropriate...
Signed-off-by: default avatarStephane Doyon <s.doyon@videotron.ca>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f62c6d0a
...@@ -2272,7 +2272,9 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) ...@@ -2272,7 +2272,9 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
ret = paste_selection(tty); ret = paste_selection(tty);
break; break;
case TIOCL_UNBLANKSCREEN: case TIOCL_UNBLANKSCREEN:
acquire_console_sem();
unblank_screen(); unblank_screen();
release_console_sem();
break; break;
case TIOCL_SELLOADLUT: case TIOCL_SELLOADLUT:
ret = sel_loadlut(p); ret = sel_loadlut(p);
...@@ -2317,8 +2319,10 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) ...@@ -2317,8 +2319,10 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
} }
break; break;
case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */ case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */
acquire_console_sem();
ignore_poke = 1; ignore_poke = 1;
do_blank_screen(0); do_blank_screen(0);
release_console_sem();
break; break;
case TIOCL_BLANKEDSCREEN: case TIOCL_BLANKEDSCREEN:
ret = console_blanked; ret = console_blanked;
......
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