]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
Retired gSimpleTextInExNotifyGuid, used local structure address to be notify handle.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbKbDxe / EfiKey.c
index 07fec7c315780dcaf82aeace026e2c77830f3d1e..c78305e7800aa2304ee90c8641ff9335819d08cd 100644 (file)
@@ -1022,7 +1022,6 @@ USBKeyboardRegisterKeyNotify (
   )\r
 {\r
   USB_KB_DEV                        *UsbKeyboardDevice;\r
-  EFI_STATUS                        Status;\r
   KEYBOARD_CONSOLE_IN_EX_NOTIFY     *NewNotify;\r
   LIST_ENTRY                        *Link;\r
   LIST_ENTRY                        *NotifyList;\r
@@ -1066,20 +1065,11 @@ USBKeyboardRegisterKeyNotify (
 \r
   NewNotify->Signature         = USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE;     \r
   NewNotify->KeyNotificationFn = KeyNotificationFunction;\r
+  NewNotify->NotifyHandle      = (EFI_HANDLE) NewNotify;\r
   CopyMem (&NewNotify->KeyData, KeyData, sizeof (EFI_KEY_DATA));\r
   InsertTailList (&UsbKeyboardDevice->NotifyList, &NewNotify->NotifyEntry);\r
 \r
-  //\r
-  // Use gSimpleTextInExNotifyGuid to get a valid EFI_HANDLE\r
-  //  \r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &NewNotify->NotifyHandle,\r
-                  &gSimpleTextInExNotifyGuid,\r
-                  NULL,\r
-                  NULL\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-  \r
+\r
   *NotifyHandle = NewNotify->NotifyHandle;  \r
   \r
   return EFI_SUCCESS;\r
@@ -1105,7 +1095,6 @@ USBKeyboardUnregisterKeyNotify (
   )\r
 {\r
   USB_KB_DEV                        *UsbKeyboardDevice;\r
-  EFI_STATUS                        Status;\r
   KEYBOARD_CONSOLE_IN_EX_NOTIFY     *CurrentNotify;\r
   LIST_ENTRY                        *Link;\r
   LIST_ENTRY                        *NotifyList;\r
@@ -1116,21 +1105,6 @@ USBKeyboardUnregisterKeyNotify (
   \r
   UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);\r
   \r
-  //\r
-  // Check if NotificationHandle is returned from RegisterKeyNotify().\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  NotificationHandle,\r
-                  &gSimpleTextInExNotifyGuid,\r
-                  NULL,\r
-                  NULL,\r
-                  NULL,\r
-                  EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
   //\r
   // Traverse notify list of USB keyboard and remove the entry of NotificationHandle.\r
   //\r
@@ -1149,13 +1123,7 @@ USBKeyboardUnregisterKeyNotify (
       // Remove the notification function from NotifyList and free resources\r
       //\r
       RemoveEntryList (&CurrentNotify->NotifyEntry);      \r
-      Status = gBS->UninstallMultipleProtocolInterfaces (\r
-                      CurrentNotify->NotifyHandle,\r
-                      &gSimpleTextInExNotifyGuid,\r
-                      NULL,\r
-                      NULL\r
-                      );\r
-      ASSERT_EFI_ERROR (Status);\r
+\r
       FreePool (CurrentNotify);            \r
       return EFI_SUCCESS;\r
     }\r