Skip to content

Commit ecf5309

Browse files
nivedita76ardbiesheuvel
authored andcommitted
efi/gop: Factor out locating the gop into a function
Move the loop to find a gop into its own function. Signed-off-by: Arvind Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 6327e6d commit ecf5309

File tree

1 file changed

+17
-6
lines changed
  • drivers/firmware/efi/libstub

1 file changed

+17
-6
lines changed

drivers/firmware/efi/libstub/gop.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,17 @@ setup_pixel_info(struct screen_info *si, u32 pixels_per_scan_line,
8585
}
8686
}
8787

88-
static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
89-
unsigned long size, void **handles)
88+
static efi_graphics_output_protocol_t *
89+
find_gop(efi_guid_t *proto, unsigned long size, void **handles)
9090
{
9191
efi_graphics_output_protocol_t *gop, *first_gop;
9292
efi_graphics_output_protocol_mode_t *mode;
9393
efi_graphics_output_mode_info_t *info = NULL;
94-
efi_physical_addr_t fb_base;
9594
efi_status_t status;
9695
efi_handle_t h;
9796
int i;
9897

9998
first_gop = NULL;
100-
gop = NULL;
10199

102100
for_each_efi_handle(h, handles, size, i) {
103101
efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID;
@@ -134,12 +132,25 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
134132
}
135133
}
136134

135+
return first_gop;
136+
}
137+
138+
static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
139+
unsigned long size, void **handles)
140+
{
141+
efi_graphics_output_protocol_t *gop;
142+
efi_graphics_output_protocol_mode_t *mode;
143+
efi_graphics_output_mode_info_t *info = NULL;
144+
efi_physical_addr_t fb_base;
145+
146+
gop = find_gop(proto, size, handles);
147+
137148
/* Did we find any GOPs? */
138-
if (!first_gop)
149+
if (!gop)
139150
return EFI_NOT_FOUND;
140151

141152
/* EFI framebuffer */
142-
mode = efi_table_attr(first_gop, mode);
153+
mode = efi_table_attr(gop, mode);
143154
info = efi_table_attr(mode, info);
144155

145156
si->orig_video_isVGA = VIDEO_TYPE_EFI;

0 commit comments

Comments
 (0)