[edk2-devel] [edk2-platforms] [PATCH v2 4/6] Vlv2TbltDevicePkg: Clean up the unused variables and function

Gary Lin glin at suse.com
Tue Jul 30 08:16:17 UTC 2019


In PlatformBootOption.c:

* mContinueBoot and mBootMenuBoot were assigned as "!EnterSetup" before
  being used. However, EnterSetup is always "FALSE", so it's meaningless
  to keep those variables.

* mPxeBoot is defined but never used.

* DetectKeypressCallback() is never used. So we can remove it altogether
  with mHotKeypressed and HotKeyEvent.

* RegisterBootOptionHotkey() only uses EFI_INPUT_KEY from EFI_KEY_DATA,
  so we don't need to use EFI_KEY_DATA for F2 and F7 in
  RegisterStaticHotkey().

v2:
  Update the description for the removal of EFI_KEY_DATA

Cc: Zailiang Sun <zailiang.sun at intel.com>
Cc: Yi Qian <yi.qian at intel.com>
Cc: Michael D Kinney <michael.d.kinney at intel.com>
Signed-off-by: Gary Lin <glin at suse.com>
---
 Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/PlatformBootOption.c | 57 ++++----------------
 1 file changed, 11 insertions(+), 46 deletions(-)

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/PlatformBootOption.c b/Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/PlatformBootOption.c
index 195b3f3097..7b0c2ea336 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/PlatformBootOption.c
+++ b/Platform/Intel/Vlv2TbltDevicePkg/Library/DxePlatformBootManagerLib/PlatformBootOption.c
@@ -10,12 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include <Library/PcdLib.h>
 
-BOOLEAN    mContinueBoot  = FALSE;
-BOOLEAN    mBootMenuBoot  = FALSE;
-BOOLEAN    mPxeBoot       = FALSE;
-BOOLEAN    mHotKeypressed = FALSE;
-EFI_EVENT  HotKeyEvent    = NULL;
-
 UINTN      mBootMenuOptionNumber;
 
 EFI_DEVICE_PATH_PROTOCOL *
@@ -396,21 +390,6 @@ RegisterBootOptionHotkey (
   }
 }
 
-EFI_STATUS
-EFIAPI
-DetectKeypressCallback (
-  IN EFI_KEY_DATA     *KeyData
-)
-{
-  mHotKeypressed = TRUE;
-
-  if (HotKeyEvent != NULL) {
-    gBS->SignalEvent(HotKeyEvent);
-  }
-
-  return EFI_SUCCESS;
-}
-
 /**
   This function is called after all the boot options are enumerated and ordered properly.
 **/
@@ -419,46 +398,32 @@ RegisterStaticHotkey (
   VOID
   )
 {
-
   EFI_INPUT_KEY                 Enter;
-  EFI_KEY_DATA                  F2;
-  EFI_KEY_DATA                  F7;
-  BOOLEAN                       EnterSetup;
+  EFI_INPUT_KEY                 F2;
+  EFI_INPUT_KEY                 F7;
   EFI_STATUS                    Status;
   EFI_BOOT_MANAGER_LOAD_OPTION  BootOption;
 
-  EnterSetup = FALSE;
-
   //
   // [Enter]
   //
-  mContinueBoot = !EnterSetup;
-  if (mContinueBoot) {
-    Enter.ScanCode    = SCAN_NULL;
-    Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
-    EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);
-  }
-
+  Enter.ScanCode    = SCAN_NULL;
+  Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
+  EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);
 
   //
   // [F2]/[F7]
   //
-  F2.Key.ScanCode    = SCAN_F2;
-  F2.Key.UnicodeChar = CHAR_NULL;
-  F2.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;
-  F2.KeyState.KeyToggleState = 0;
+  F2.ScanCode    = SCAN_F2;
+  F2.UnicodeChar = CHAR_NULL;
   Status = EfiBootManagerGetBootManagerMenu (&BootOption);
   ASSERT_EFI_ERROR (Status);
-  RegisterBootOptionHotkey ((UINT16) BootOption.OptionNumber, &F2.Key, TRUE);
+  RegisterBootOptionHotkey ((UINT16) BootOption.OptionNumber, &F2, TRUE);
   EfiBootManagerFreeLoadOption (&BootOption);
 
-  F7.Key.ScanCode    = SCAN_F7;
-  F7.Key.UnicodeChar = CHAR_NULL;
-  F7.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;
-  F7.KeyState.KeyToggleState = 0;
-  mBootMenuBoot  = !EnterSetup;
-  RegisterBootOptionHotkey ((UINT16) mBootMenuOptionNumber, &F7.Key, mBootMenuBoot);
-
+  F7.ScanCode    = SCAN_F7;
+  F7.UnicodeChar = CHAR_NULL;
+  RegisterBootOptionHotkey ((UINT16) mBootMenuOptionNumber, &F7, TRUE);
 }
 
 UINT8
-- 
2.22.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44596): https://edk2.groups.io/g/devel/message/44596
Mute This Topic: https://groups.io/mt/32651920/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list