From: gikidy Date: Fri, 26 Dec 2008 09:18:12 +0000 (+0000) Subject: Check Library usage and fix some typo. X-Git-Tag: edk2-stable201903~19107 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=e15c65a371286026d80fab12a8382f901adf059f Check Library usage and fix some typo. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7140 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c index d889b974d6..1ccc8784d0 100644 --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c @@ -545,6 +545,7 @@ USBKeyboardReadKeyStrokeWorker ( EFI_STATUS Status; UINT8 KeyCode; LIST_ENTRY *Link; + LIST_ENTRY *NotifyList; KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify; EFI_KEY_DATA OriginalKeyData; @@ -609,9 +610,10 @@ USBKeyboardReadKeyStrokeWorker ( // // Invoke notification functions if the key is registered. // - for (Link = GetFirstNode (&UsbKeyboardDevice->NotifyList); - !IsNull (&UsbKeyboardDevice->NotifyList, Link); - Link = GetNextNode (&UsbKeyboardDevice->NotifyList, Link)) { + NotifyList = &UsbKeyboardDevice->NotifyList; + for (Link = GetFirstNode (NotifyList); + !IsNull (NotifyList, Link); + Link = GetNextNode (NotifyList, Link)) { CurrentNotify = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE); if (IsKeyRegistered (&CurrentNotify->KeyData, &OriginalKeyData)) { CurrentNotify->KeyNotificationFn (&OriginalKeyData); @@ -622,7 +624,7 @@ USBKeyboardReadKeyStrokeWorker ( } /** - Reset the input device and optionaly run diagnostics + Reset the input device and optionally run diagnostics There are 2 types of reset for USB keyboard. For non-exhaustive reset, only keyboard buffer is cleared. @@ -695,7 +697,7 @@ USBKeyboardReset ( @retval EFI_SUCCESS The keystroke information was returned. @retval EFI_NOT_READY There was no keystroke data availiable. - @retval EFI_DEVICE_ERROR The keydtroke information was not returned due to + @retval EFI_DEVICE_ERROR The keystroke information was not returned due to hardware errors. **/ @@ -826,7 +828,7 @@ KbdFreeNotifyList ( @param InputData A pointer to keystroke data for the key that was pressed. @retval TRUE Key pressed matches a registered key. - @retval FLASE Key pressed does not matche a registered key. + @retval FLASE Key pressed does not matches a registered key. **/ BOOLEAN @@ -1015,7 +1017,7 @@ USBKeyboardSetState ( @param NotifyHandle Points to the unique handle assigned to the registered notification. @retval EFI_SUCCESS The notification function was registered successfully. - @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data structures. + @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necessary data structures. @retval EFI_INVALID_PARAMETER KeyData or NotifyHandle or KeyNotificationFunction is NULL. **/ @@ -1032,6 +1034,7 @@ USBKeyboardRegisterKeyNotify ( EFI_STATUS Status; KEYBOARD_CONSOLE_IN_EX_NOTIFY *NewNotify; LIST_ENTRY *Link; + LIST_ENTRY *NotifyList; KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify; if (KeyData == NULL || NotifyHandle == NULL || KeyNotificationFunction == NULL) { @@ -1043,9 +1046,11 @@ USBKeyboardRegisterKeyNotify ( // // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered. // - for (Link = GetFirstNode (&UsbKeyboardDevice->NotifyList); - !IsNull (&UsbKeyboardDevice->NotifyList, Link); - Link = GetNextNode (&UsbKeyboardDevice->NotifyList, Link)) { + NotifyList = &UsbKeyboardDevice->NotifyList; + + for (Link = GetFirstNode (NotifyList); + !IsNull (NotifyList, Link); + Link = GetNextNode (NotifyList, Link)) { CurrentNotify = CR ( Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, @@ -1112,6 +1117,7 @@ USBKeyboardUnregisterKeyNotify ( EFI_STATUS Status; KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify; LIST_ENTRY *Link; + LIST_ENTRY *NotifyList; if (NotificationHandle == NULL) { return EFI_INVALID_PARAMETER; @@ -1137,9 +1143,10 @@ USBKeyboardUnregisterKeyNotify ( // // Traverse notify list of USB keyboard and remove the entry of NotificationHandle. // - for (Link = GetFirstNode (&UsbKeyboardDevice->NotifyList); - !IsNull (&UsbKeyboardDevice->NotifyList, Link); - Link = GetNextNode (&UsbKeyboardDevice->NotifyList, Link)) { + NotifyList = &UsbKeyboardDevice->NotifyList; + for (Link = GetFirstNode (NotifyList); + !IsNull (NotifyList, Link); + Link = GetNextNode (NotifyList, Link)) { CurrentNotify = CR ( Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c index 3acdd76187..79598c5a01 100644 --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c @@ -477,17 +477,19 @@ FindUsbNsKey ( ) { LIST_ENTRY *Link; + LIST_ENTRY *NsKeyList; USB_NS_KEY *UsbNsKey; - - Link = GetFirstNode (&UsbKeyboardDevice->NsKeyList); - while (!IsNull (&UsbKeyboardDevice->NsKeyList, Link)) { + + NsKeyList = &UsbKeyboardDevice->NsKeyList; + Link = GetFirstNode (NsKeyList); + while (!IsNull (NsKeyList, Link)) { UsbNsKey = USB_NS_KEY_FORM_FROM_LINK (Link); if (UsbNsKey->NsKey[0].Key == KeyDescriptor->Key) { return UsbNsKey; } - Link = GetNextNode (&UsbKeyboardDevice->NsKeyList, Link); + Link = GetNextNode (NsKeyList, Link); } return NULL; @@ -644,7 +646,7 @@ SetKeyboardLayoutEvent ( KeyDescriptor = GetKeyDescriptor (UsbKeyboardDevice, 0x28); CopyMem (TableEntry, KeyDescriptor, sizeof (EFI_KEY_DESCRIPTOR)); - gBS->FreePool (KeyboardLayout); + FreePool (KeyboardLayout); } /** @@ -1921,7 +1923,7 @@ USBKeyboardRepeatHandler ( ); // - // Set repeate rate for next repeat key generation. + // Set repeat rate for next repeat key generation. // gBS->SetTimer ( UsbKeyboardDevice->RepeatTimer,