cmd: simplify eficonfig_init()
As the system table already has pointers to the Simple Text Input and Output Protocols we can directly use these instead of calling OpenProtocol. Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
@@ -2283,26 +2283,11 @@ static efi_status_t eficonfig_init(void)
|
|||||||
{
|
{
|
||||||
efi_status_t ret = EFI_SUCCESS;
|
efi_status_t ret = EFI_SUCCESS;
|
||||||
static bool init;
|
static bool init;
|
||||||
struct efi_handler *handler;
|
|
||||||
unsigned long columns, rows;
|
unsigned long columns, rows;
|
||||||
|
|
||||||
if (!init) {
|
if (!init) {
|
||||||
ret = efi_search_protocol(efi_root, &efi_guid_text_input_protocol, &handler);
|
cout = systab.con_out;
|
||||||
if (ret != EFI_SUCCESS)
|
cin = systab.con_in;
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = efi_protocol_open(handler, (void **)&cin, efi_root, NULL,
|
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
|
||||||
if (ret != EFI_SUCCESS)
|
|
||||||
return ret;
|
|
||||||
ret = efi_search_protocol(efi_root, &efi_guid_text_output_protocol, &handler);
|
|
||||||
if (ret != EFI_SUCCESS)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = efi_protocol_open(handler, (void **)&cout, efi_root, NULL,
|
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
|
||||||
if (ret != EFI_SUCCESS)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
cout->query_mode(cout, cout->mode->mode, &columns, &rows);
|
cout->query_mode(cout, cout->mode->mode, &columns, &rows);
|
||||||
avail_row = rows - (EFICONFIG_MENU_HEADER_ROW_NUM +
|
avail_row = rows - (EFICONFIG_MENU_HEADER_ROW_NUM +
|
||||||
|
Reference in New Issue
Block a user