Skip to contentSkip to conversation

tty/vt: Remove printable variable

PATCH In review Daniel Vetter 3 participants 3 messages Aug 26, 2022 – Aug 29, 2022 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty/vt: Remove printable variable

Every since the 0.99.7A release when console_register() was introduced it's become impossible to call vt_console_print (called console_print() back then still) directly. Which means the initialization issue this variable protected against is no more.

Give it a send off with style and let it rest in peace.

Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc "Ilpo Järvinen" <[email protected]>
Cc nick black <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Tetsuo Handa <[email protected]>
Cc Yangxi Xiang <[email protected]>
Cc Xuezhi Zhang <[email protected]>
---
 drivers/tty/vt/vt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/tty/vt/vt.c +0 -4
index ae9c926acd6f..4d29e4a17db7 100644
@@ -157,7 +157,6 @@ static void set_palette(struct vc_data *vc);
 
 #define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
 
-static int printable;		/* Is console ready for printing? */
 int default_utf8 = true;
 module_param(default_utf8, int, S_IRUGO | S_IWUSR);
 int global_cursor_default = -1;
@@ -3085,8 +3084,6 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
 	int kmsg_console;
 
 	/* console busy or not yet initialized */
-	if (!printable)
-		return;
 	if (!spin_trylock(&printing_lock))
 		return;
 
@@ -3537,7 +3534,6 @@ static int __init con_init(void)
 	pr_info("Console: %s %s %dx%d\n",
 		vc->vc_can_do_color ? "colour" : "mono",
 		display_desc, vc->vc_cols, vc->vc_rows);
-	printable = 1;
 
 	console_unlock();
 
Signature · 1 line
2.37.2
#1 lore raw

Hi Daniel,

Quoted 33 lines · Daniel Vetter

Every since the 0.99.7A release when console_register() was introduced it's become impossible to call vt_console_print (called console_print() back then still) directly. Which means the initialization issue this variable protected against is no more.

Give it a send off with style and let it rest in peace.

Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc "Ilpo Järvinen" <[email protected]>
Cc nick black <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Tetsuo Handa <[email protected]>
Cc Yangxi Xiang <[email protected]>
Cc Xuezhi Zhang <[email protected]>
---
 drivers/tty/vt/vt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/tty/vt/vt.c +0 -1
index ae9c926acd6f..4d29e4a17db7 100644
@@ -157,7 +157,6 @@ static void set_palette(struct vc_data *vc);
 
 #define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
 
-static int printable;		/* Is console ready for printing? */
 int default_utf8 = true;
 module_param(default_utf8, int, S_IRUGO | S_IWUSR);
 int global_cursor_default = -1;

drivers/tty/vt/vt.c static void vt_console_print(struct console *co, const char *b, unsigned count) · line 3088

Quoted 7 lines
drivers/tty/vt/vt.c +0 -2
@@ -3085,8 +3084,6 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
 	int kmsg_console;
 
 	/* console busy or not yet initialized */
-	if (!printable)
-		return;
 	if (!spin_trylock(&printing_lock))
 		return;

Speaking on locks - it the printing_lock necessary. Or will the caller serialize the calls to write()?

Sam

Quoted 11 lines
drivers/tty/vt/vt.c +0 -1
@@ -3537,7 +3534,6 @@ static int __init con_init(void)
 	pr_info("Console: %s %s %dx%d\n",
 		vc->vc_can_do_color ? "colour" : "mono",
 		display_desc, vc->vc_cols, vc->vc_rows);
-	printable = 1;
 
 	console_unlock();
 
Signature · 1 line
2.37.2
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Vetter
Quoted 6 lines · Daniel Vetter

Every since the 0.99.7A release when console_register() was introduced it's become impossible to call vt_console_print (called console_print() back then still) directly. Which means the initialization issue this variable protected against is no more.

Give it a send off with style and let it rest in peace.

FWIW:

In hopes, nothing breaks.

Quoted 35 lines
Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc "Ilpo Järvinen" <[email protected]>
Cc nick black <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Tetsuo Handa <[email protected]>
Cc Yangxi Xiang <[email protected]>
Cc Xuezhi Zhang <[email protected]>
---
  drivers/tty/vt/vt.c | 4 ----
  1 file changed, 4 deletions(-)
drivers/tty/vt/vt.c +0 -3
index ae9c926acd6f..4d29e4a17db7 100644
@@ -157,7 +157,6 @@ static void set_palette(struct vc_data *vc);
 
  #define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
 
-static int printable;		/* Is console ready for printing? */
  int default_utf8 = true;
  module_param(default_utf8, int, S_IRUGO | S_IWUSR);
  int global_cursor_default = -1;
@@ -3085,8 +3084,6 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
  	int kmsg_console;
 
  	/* console busy or not yet initialized */
-	if (!printable)
-		return;
  	if (!spin_trylock(&printing_lock))
  		return;
 

drivers/tty/vt/vt.c static int __init con_init(void) · line 3539

Quoted 7 lines
drivers/tty/vt/vt.c +0 -1
@@ -3537,7 +3534,6 @@ static int __init con_init(void)
  	pr_info("Console: %s %s %dx%d\n",
  		vc->vc_can_do_color ? "colour" : "mono",
  		display_desc, vc->vc_cols, vc->vc_rows);
-	printable = 1;
 
  	console_unlock();
 

thanks,

Signature · 2 lines
js
suse labs