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

Gary Lin glin at suse.com
Fri Jul 26 07:06:43 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.

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 a73d54a97d..539127e93f 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 (#44445): https://edk2.groups.io/g/devel/message/44445
Mute This Topic: https://groups.io/mt/32606872/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