Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vt: keyboard, use tty_insert_flip_string in puts_queue

'puts_queue' currently loops over characters and employs the full tty
buffer machinery for every character. Do the buffer allocation only once
and copy all the character at once. This is achieved using
tty_insert_flip_string instead of loop+tty_insert_flip_char.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20201029113222.32640-17-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby and committed by
Greg Kroah-Hartman
c35f638f 2389cdc3

+2 -5
+2 -5
drivers/tty/vt/keyboard.c
··· 324 324 tty_schedule_flip(&vc->port); 325 325 } 326 326 327 - static void puts_queue(struct vc_data *vc, char *cp) 327 + static void puts_queue(struct vc_data *vc, const char *cp) 328 328 { 329 - while (*cp) { 330 - tty_insert_flip_char(&vc->port, *cp, 0); 331 - cp++; 332 - } 329 + tty_insert_flip_string(&vc->port, cp, strlen(cp)); 333 330 tty_schedule_flip(&vc->port); 334 331 } 335 332