boot: cache HALT priority

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>
This commit is contained in:
Gerd Hoffmann 2020-01-14 09:56:31 +01:00
parent 2f4d068645
commit 8d4252254a
1 changed files with 5 additions and 1 deletions

View 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)