]> git.ipfire.org Git - thirdparty/grub.git/commit
term/serial: Avoid double lookup of serial ports
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 23 Dec 2022 01:48:48 +0000 (12:48 +1100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 19 Jan 2023 16:39:04 +0000 (17:39 +0100)
commite37dbba6650fce39649825ffa7040b60055f9cf2
tree6363eac389e499667c4236ab20aa8afa50ed109c
parentb73a44b281908526048fd5884cde463a0a275280
term/serial: Avoid double lookup of serial ports

The various functions to add a port used to return port->name, and
the callers would immediately iterate all registered ports to "find"
the one just created by comparing that return value with ... port->name.

This is a waste of cycles and code. Instead, have those functions
return "port" directly.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/term/arc/serial.c
grub-core/term/ieee1275/serial.c
grub-core/term/ns8250-spcr.c
grub-core/term/ns8250.c
grub-core/term/serial.c
include/grub/serial.h