Commit f324edc85e5c1137e49e3b36a58cf436ab5b1fb3

Authored by Daniel Mack
Committed by Linus Torvalds
1 parent 4764e280dc

console: make blank timeout value a boot option

The console blank timer is currently hardcoded to 10*60 seconds which
might be annoying on systems with no input devices attached to wake up the
console again.  Especially during development, disabling the screen saver
can be handy - for example when debugging the root fs mount mechanism or
other scenarios where no userspace program could be started to do that at
runtime from userspace.

This patch defines a core_param for the variable in charge which allows
users to entirely disable the blank feature at boot time by setting it 0.
The value can still be overwritten at runtime using the standard ioctl
call - this just allows to conditionally change the default.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 11 additions and 6 deletions Side-by-side Diff

Documentation/kernel-parameters.txt
... ... @@ -546,6 +546,10 @@
546 546 console=brl,ttyS0
547 547 For now, only VisioBraille is supported.
548 548  
  549 + consoleblank= [KNL] The console blank (screen saver) timeout in
  550 + seconds. Defaults to 10*60 = 10mins. A value of 0
  551 + disables the blank timer.
  552 +
549 553 coredump_filter=
550 554 [KNL] Change the default value for
551 555 /proc/<pid>/coredump_filter.
... ... @@ -171,8 +171,9 @@
171 171 int console_blanked;
172 172  
173 173 static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */
174   -static int blankinterval = 10*60*HZ;
175 174 static int vesa_off_interval;
  175 +static int blankinterval = 10*60;
  176 +core_param(consoleblank, blankinterval, int, 0444);
176 177  
177 178 static DECLARE_WORK(console_work, console_callback);
178 179  
... ... @@ -1485,7 +1486,7 @@
1485 1486 update_attr(vc);
1486 1487 break;
1487 1488 case 9: /* set blanking interval */
1488   - blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ;
  1489 + blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60;
1489 1490 poke_blanked_console();
1490 1491 break;
1491 1492 case 10: /* set bell frequency in Hz */
... ... @@ -2871,7 +2872,7 @@
2871 2872  
2872 2873 if (blankinterval) {
2873 2874 blank_state = blank_normal_wait;
2874   - mod_timer(&console_timer, jiffies + blankinterval);
  2875 + mod_timer(&console_timer, jiffies + (blankinterval * HZ));
2875 2876 }
2876 2877  
2877 2878 for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
... ... @@ -3677,7 +3678,7 @@
3677 3678 return; /* but leave console_blanked != 0 */
3678 3679  
3679 3680 if (blankinterval) {
3680   - mod_timer(&console_timer, jiffies + blankinterval);
  3681 + mod_timer(&console_timer, jiffies + (blankinterval * HZ));
3681 3682 blank_state = blank_normal_wait;
3682 3683 }
3683 3684  
... ... @@ -3711,7 +3712,7 @@
3711 3712 static void blank_screen_t(unsigned long dummy)
3712 3713 {
3713 3714 if (unlikely(!keventd_up())) {
3714   - mod_timer(&console_timer, jiffies + blankinterval);
  3715 + mod_timer(&console_timer, jiffies + (blankinterval * HZ));
3715 3716 return;
3716 3717 }
3717 3718 blank_timer_expired = 1;
... ... @@ -3741,7 +3742,7 @@
3741 3742 if (console_blanked)
3742 3743 unblank_screen();
3743 3744 else if (blankinterval) {
3744   - mod_timer(&console_timer, jiffies + blankinterval);
  3745 + mod_timer(&console_timer, jiffies + (blankinterval * HZ));
3745 3746 blank_state = blank_normal_wait;
3746 3747 }
3747 3748 }