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
This commit is contained in:
gikidy 2008-12-26 09:18:12 +00:00
parent f51f406037
commit e15c65a371
2 changed files with 28 additions and 19 deletions

View File

@ -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,

View File

@ -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,