diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2024-12-19 10:53:23 +0100 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2025-01-14 08:34:25 +0100 |
commit | c14bca3f7aa94fd8d3f5e621ce5b56535ef2396b (patch) | |
tree | cb9f0d9d43dad5727bbc521770bb0ef54517da37 /drivers/firmware/efi/libstub/pci.c | |
parent | 144d52dd8fc83a082a275e1b663e7454d2b616a4 (diff) |
efi/libstub: Use C99-style for loop to traverse handle buffer
Tweak the for_each_efi_handle() macro in order to avoid the need on the
part of the caller to provide a loop counter variable.
Also move efi_get_handle_num() to the callers, so that each occurrence
can be replaced with the actual number returned by the simplified
LocateHandleBuffer API.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/pci.c')
-rw-r--r-- | drivers/firmware/efi/libstub/pci.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/firmware/efi/libstub/pci.c b/drivers/firmware/efi/libstub/pci.c index 99fb25d2bcf5..b0ba372c26c5 100644 --- a/drivers/firmware/efi/libstub/pci.c +++ b/drivers/firmware/efi/libstub/pci.c @@ -21,7 +21,6 @@ void efi_pci_disable_bridge_busmaster(void) efi_handle_t handle; efi_status_t status; u16 class, command; - int i; status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL, &pci_proto, NULL, &pci_handle_size, NULL); @@ -46,7 +45,7 @@ void efi_pci_disable_bridge_busmaster(void) goto free_handle; } - for_each_efi_handle(handle, pci_handle, pci_handle_size, i) { + for_each_efi_handle(handle, pci_handle, efi_get_handle_num(pci_handle_size)) { efi_pci_io_protocol_t *pci; unsigned long segment_nr, bus_nr, device_nr, func_nr; @@ -82,7 +81,7 @@ void efi_pci_disable_bridge_busmaster(void) efi_bs_call(disconnect_controller, handle, NULL, NULL); } - for_each_efi_handle(handle, pci_handle, pci_handle_size, i) { + for_each_efi_handle(handle, pci_handle, efi_get_handle_num(pci_handle_size)) { efi_pci_io_protocol_t *pci; status = efi_bs_call(handle_protocol, handle, &pci_proto, |