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>
This commit is contained in:
Benjamin Herrenschmidt authored and Daniel Kiper committed 2023-01-19 17:39:04 +01:00
1 parent b73a44b281
commit e37dbba665
6 files changed
+33 -45

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@
#include <grub/dl.h>
#include <grub/acpi.h>
char *
struct grub_serial_port *
grub_ns8250_spcr_init (void)
{
struct grub_acpi_spcr *spcr;