]> xenbits.xensource.com Git - seabios.git/commitdiff
boot: cache HALT priority
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 14 Jan 2020 08:56:31 +0000 (09:56 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 14 Jan 2020 09:15:19 +0000 (10:15 +0100)
Call find_prio("HALT") only once, on first is_bootprio_strict() call.
Store the result in a variable and reuse it on subsequent calls.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
src/boot.c

index 5182ab426b9f8641b402b113b5f0fcf12df446af..afeb36a3319aa3fda858cbbf93a508c37d759b36 100644 (file)
@@ -297,7 +297,11 @@ find_prio(const char *glob)
 
 u8 is_bootprio_strict(void)
 {
-    return find_prio("HALT") >= 0;
+    static int prio_halt = -2;
+
+    if (prio_halt == -2)
+        prio_halt = find_prio("HALT");
+    return prio_halt >= 0;
 }
 
 int bootprio_find_pci_device(struct pci_device *pci)