]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Hand/Handle.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Hand / Handle.c
index 92979281b74a2a76e0f77c067660d3542329d712..bd6c57843ee774cffd5628bcd3b3f06e603fcc86 100644 (file)
@@ -9,19 +9,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "DxeMain.h"\r
 #include "Handle.h"\r
 \r
-\r
 //\r
 // mProtocolDatabase     - A list of all protocols in the system.  (simple list for now)\r
 // gHandleList           - A list of all the handles in the system\r
 // gProtocolDatabaseLock - Lock to protect the mProtocolDatabase\r
 // gHandleDatabaseKey    -  The Key to show that the handle has been created/modified\r
 //\r
-LIST_ENTRY      mProtocolDatabase     = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);\r
-LIST_ENTRY      gHandleList           = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList);\r
-EFI_LOCK        gProtocolDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);\r
-UINT64          gHandleDatabaseKey    = 0;\r
-\r
-\r
+LIST_ENTRY  mProtocolDatabase     = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);\r
+LIST_ENTRY  gHandleList           = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList);\r
+EFI_LOCK    gProtocolDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);\r
+UINT64      gHandleDatabaseKey    = 0;\r
 \r
 /**\r
   Acquire lock on gProtocolDatabaseLock.\r
@@ -35,8 +32,6 @@ CoreAcquireProtocolLock (
   CoreAcquireLock (&gProtocolDatabaseLock);\r
 }\r
 \r
-\r
-\r
 /**\r
   Release lock on gProtocolDatabaseLock.\r
 \r
@@ -49,8 +44,6 @@ CoreReleaseProtocolLock (
   CoreReleaseLock (&gProtocolDatabaseLock);\r
 }\r
 \r
-\r
-\r
 /**\r
   Check whether a handle is a valid EFI_HANDLE\r
   The gProtocolDatabaseLock must be owned\r
@@ -63,21 +56,21 @@ CoreReleaseProtocolLock (
 **/\r
 EFI_STATUS\r
 CoreValidateHandle (\r
-  IN  EFI_HANDLE                UserHandle\r
+  IN  EFI_HANDLE  UserHandle\r
   )\r
 {\r
-  IHANDLE             *Handle;\r
-  LIST_ENTRY          *Link;\r
+  IHANDLE     *Handle;\r
+  LIST_ENTRY  *Link;\r
 \r
   if (UserHandle == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  ASSERT_LOCKED(&gProtocolDatabaseLock);\r
+  ASSERT_LOCKED (&gProtocolDatabaseLock);\r
 \r
   for (Link = gHandleList.BackLink; Link != &gHandleList; Link = Link->BackLink) {\r
     Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);\r
-    if (Handle == (IHANDLE *) UserHandle) {\r
+    if (Handle == (IHANDLE *)UserHandle) {\r
       return EFI_SUCCESS;\r
     }\r
   }\r
@@ -85,8 +78,6 @@ CoreValidateHandle (
   return EFI_INVALID_PARAMETER;\r
 }\r
 \r
-\r
-\r
 /**\r
   Finds the protocol entry for the requested protocol.\r
   The gProtocolDatabaseLock must be owned\r
@@ -99,15 +90,15 @@ CoreValidateHandle (
 **/\r
 PROTOCOL_ENTRY  *\r
 CoreFindProtocolEntry (\r
-  IN EFI_GUID   *Protocol,\r
-  IN BOOLEAN    Create\r
+  IN EFI_GUID  *Protocol,\r
+  IN BOOLEAN   Create\r
   )\r
 {\r
-  LIST_ENTRY          *Link;\r
-  PROTOCOL_ENTRY      *Item;\r
-  PROTOCOL_ENTRY      *ProtEntry;\r
+  LIST_ENTRY      *Link;\r
+  PROTOCOL_ENTRY  *Item;\r
+  PROTOCOL_ENTRY  *ProtEntry;\r
 \r
-  ASSERT_LOCKED(&gProtocolDatabaseLock);\r
+  ASSERT_LOCKED (&gProtocolDatabaseLock);\r
 \r
   //\r
   // Search the database for the matching GUID\r
@@ -116,11 +107,10 @@ CoreFindProtocolEntry (
   ProtEntry = NULL;\r
   for (Link = mProtocolDatabase.ForwardLink;\r
        Link != &mProtocolDatabase;\r
-       Link = Link->ForwardLink) {\r
-\r
-    Item = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);\r
+       Link = Link->ForwardLink)\r
+  {\r
+    Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);\r
     if (CompareGuid (&Item->ProtocolID, Protocol)) {\r
-\r
       //\r
       // This is the protocol entry\r
       //\r
@@ -135,7 +125,7 @@ CoreFindProtocolEntry (
   // allocate a new entry\r
   //\r
   if ((ProtEntry == NULL) && Create) {\r
-    ProtEntry = AllocatePool (sizeof(PROTOCOL_ENTRY));\r
+    ProtEntry = AllocatePool (sizeof (PROTOCOL_ENTRY));\r
 \r
     if (ProtEntry != NULL) {\r
       //\r
@@ -156,8 +146,6 @@ CoreFindProtocolEntry (
   return ProtEntry;\r
 }\r
 \r
-\r
-\r
 /**\r
   Finds the protocol instance for the requested handle and protocol.\r
   Note: This function doesn't do parameters checking, it's caller's responsibility\r
@@ -172,16 +160,16 @@ CoreFindProtocolEntry (
 **/\r
 PROTOCOL_INTERFACE *\r
 CoreFindProtocolInterface (\r
-  IN IHANDLE        *Handle,\r
-  IN EFI_GUID       *Protocol,\r
-  IN VOID           *Interface\r
+  IN IHANDLE   *Handle,\r
+  IN EFI_GUID  *Protocol,\r
+  IN VOID      *Interface\r
   )\r
 {\r
   PROTOCOL_INTERFACE  *Prot;\r
   PROTOCOL_ENTRY      *ProtEntry;\r
   LIST_ENTRY          *Link;\r
 \r
-  ASSERT_LOCKED(&gProtocolDatabaseLock);\r
+  ASSERT_LOCKED (&gProtocolDatabaseLock);\r
   Prot = NULL;\r
 \r
   //\r
@@ -190,17 +178,15 @@ CoreFindProtocolInterface (
 \r
   ProtEntry = CoreFindProtocolEntry (Protocol, FALSE);\r
   if (ProtEntry != NULL) {\r
-\r
     //\r
     // Look at each protocol interface for any matches\r
     //\r
-    for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link=Link->ForwardLink) {\r
-\r
+    for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {\r
       //\r
       // If this protocol interface matches, remove it\r
       //\r
-      Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);\r
-      if (Prot->Interface == Interface && Prot->Protocol == ProtEntry) {\r
+      Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);\r
+      if ((Prot->Interface == Interface) && (Prot->Protocol == ProtEntry)) {\r
         break;\r
       }\r
 \r
@@ -211,7 +197,6 @@ CoreFindProtocolInterface (
   return Prot;\r
 }\r
 \r
-\r
 /**\r
   Removes an event from a register protocol notify list on a protocol.\r
 \r
@@ -224,31 +209,31 @@ CoreFindProtocolInterface (
 **/\r
 EFI_STATUS\r
 CoreUnregisterProtocolNotifyEvent (\r
-  IN EFI_EVENT      Event\r
+  IN EFI_EVENT  Event\r
   )\r
 {\r
-  LIST_ENTRY         *Link;\r
-  PROTOCOL_ENTRY     *ProtEntry;\r
-  LIST_ENTRY         *NotifyLink;\r
-  PROTOCOL_NOTIFY    *ProtNotify;\r
+  LIST_ENTRY       *Link;\r
+  PROTOCOL_ENTRY   *ProtEntry;\r
+  LIST_ENTRY       *NotifyLink;\r
+  PROTOCOL_NOTIFY  *ProtNotify;\r
 \r
   CoreAcquireProtocolLock ();\r
 \r
   for ( Link =  mProtocolDatabase.ForwardLink;\r
         Link != &mProtocolDatabase;\r
-        Link =  Link->ForwardLink) {\r
-\r
-    ProtEntry = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);\r
+        Link =  Link->ForwardLink)\r
+  {\r
+    ProtEntry = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);\r
 \r
     for ( NotifyLink =  ProtEntry->Notify.ForwardLink;\r
           NotifyLink != &ProtEntry->Notify;\r
-          NotifyLink =  NotifyLink->ForwardLink) {\r
-\r
-      ProtNotify = CR(NotifyLink, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
+          NotifyLink =  NotifyLink->ForwardLink)\r
+    {\r
+      ProtNotify = CR (NotifyLink, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);\r
 \r
       if (ProtNotify->Event == Event) {\r
-        RemoveEntryList(&ProtNotify->Link);\r
-        CoreFreePool(ProtNotify);\r
+        RemoveEntryList (&ProtNotify->Link);\r
+        CoreFreePool (ProtNotify);\r
         CoreReleaseProtocolLock ();\r
         return EFI_SUCCESS;\r
       }\r
@@ -259,8 +244,6 @@ CoreUnregisterProtocolNotifyEvent (
   return EFI_NOT_FOUND;\r
 }\r
 \r
-\r
-\r
 /**\r
   Removes all the events in the protocol database that match Event.\r
 \r
@@ -272,10 +255,10 @@ CoreUnregisterProtocolNotifyEvent (
 **/\r
 EFI_STATUS\r
 CoreUnregisterProtocolNotify (\r
-  IN EFI_EVENT      Event\r
+  IN EFI_EVENT  Event\r
   )\r
 {\r
-  EFI_STATUS       Status;\r
+  EFI_STATUS  Status;\r
 \r
   do {\r
     Status = CoreUnregisterProtocolNotifyEvent (Event);\r
@@ -284,9 +267,6 @@ CoreUnregisterProtocolNotify (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
-\r
-\r
 /**\r
   Wrapper function to CoreInstallProtocolInterfaceNotify.  This is the public API which\r
   Calls the private one which contains a BOOLEAN parameter for notifications\r
@@ -304,22 +284,21 @@ CoreUnregisterProtocolNotify (
 EFI_STATUS\r
 EFIAPI\r
 CoreInstallProtocolInterface (\r
-  IN OUT EFI_HANDLE     *UserHandle,\r
-  IN EFI_GUID           *Protocol,\r
-  IN EFI_INTERFACE_TYPE InterfaceType,\r
-  IN VOID               *Interface\r
+  IN OUT EFI_HANDLE      *UserHandle,\r
+  IN EFI_GUID            *Protocol,\r
+  IN EFI_INTERFACE_TYPE  InterfaceType,\r
+  IN VOID                *Interface\r
   )\r
 {\r
   return CoreInstallProtocolInterfaceNotify (\r
-            UserHandle,\r
-            Protocol,\r
-            InterfaceType,\r
-            Interface,\r
-            TRUE\r
-            );\r
+           UserHandle,\r
+           Protocol,\r
+           InterfaceType,\r
+           Interface,\r
+           TRUE\r
+           );\r
 }\r
 \r
-\r
 /**\r
   Installs a protocol interface into the boot services environment.\r
 \r
@@ -339,11 +318,11 @@ CoreInstallProtocolInterface (
 **/\r
 EFI_STATUS\r
 CoreInstallProtocolInterfaceNotify (\r
-  IN OUT EFI_HANDLE     *UserHandle,\r
-  IN EFI_GUID           *Protocol,\r
-  IN EFI_INTERFACE_TYPE InterfaceType,\r
-  IN VOID               *Interface,\r
-  IN BOOLEAN            Notify\r
+  IN OUT EFI_HANDLE      *UserHandle,\r
+  IN EFI_GUID            *Protocol,\r
+  IN EFI_INTERFACE_TYPE  InterfaceType,\r
+  IN VOID                *Interface,\r
+  IN BOOLEAN             Notify\r
   )\r
 {\r
   PROTOCOL_INTERFACE  *Prot;\r
@@ -356,7 +335,7 @@ CoreInstallProtocolInterfaceNotify (
   // returns EFI_INVALID_PARAMETER if InterfaceType is invalid.\r
   // Also added check for invalid UserHandle and Protocol pointers.\r
   //\r
-  if (UserHandle == NULL || Protocol == NULL) {\r
+  if ((UserHandle == NULL) || (Protocol == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -367,10 +346,10 @@ CoreInstallProtocolInterfaceNotify (
   //\r
   // Print debug message\r
   //\r
-  DEBUG((DEBUG_INFO, "InstallProtocolInterface: %g %p\n", Protocol, Interface));\r
+  DEBUG ((DEBUG_INFO, "InstallProtocolInterface: %g %p\n", Protocol, Interface));\r
 \r
   Status = EFI_OUT_OF_RESOURCES;\r
-  Prot = NULL;\r
+  Prot   = NULL;\r
   Handle = NULL;\r
 \r
   if (*UserHandle != NULL) {\r
@@ -396,7 +375,7 @@ CoreInstallProtocolInterfaceNotify (
   //\r
   // Allocate a new protocol interface structure\r
   //\r
-  Prot = AllocateZeroPool (sizeof(PROTOCOL_INTERFACE));\r
+  Prot = AllocateZeroPool (sizeof (PROTOCOL_INTERFACE));\r
   if (Prot == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto Done;\r
@@ -407,7 +386,7 @@ CoreInstallProtocolInterfaceNotify (
   //\r
   Handle = (IHANDLE *)*UserHandle;\r
   if (Handle == NULL) {\r
-    Handle = AllocateZeroPool (sizeof(IHANDLE));\r
+    Handle = AllocateZeroPool (sizeof (IHANDLE));\r
     if (Handle == NULL) {\r
       Status = EFI_OUT_OF_RESOURCES;\r
       goto Done;\r
@@ -433,7 +412,7 @@ CoreInstallProtocolInterfaceNotify (
   } else {\r
     Status = CoreValidateHandle (Handle);\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG((DEBUG_ERROR, "InstallProtocolInterface: input handle at 0x%x is invalid\n", Handle));\r
+      DEBUG ((DEBUG_ERROR, "InstallProtocolInterface: input handle at 0x%x is invalid\n", Handle));\r
       goto Done;\r
     }\r
   }\r
@@ -447,8 +426,8 @@ CoreInstallProtocolInterfaceNotify (
   // Initialize the protocol interface structure\r
   //\r
   Prot->Signature = PROTOCOL_INTERFACE_SIGNATURE;\r
-  Prot->Handle = Handle;\r
-  Prot->Protocol = ProtEntry;\r
+  Prot->Handle    = Handle;\r
+  Prot->Protocol  = ProtEntry;\r
   Prot->Interface = Interface;\r
 \r
   //\r
@@ -475,6 +454,7 @@ CoreInstallProtocolInterfaceNotify (
   if (Notify) {\r
     CoreNotifyProtocolEntry (ProtEntry);\r
   }\r
+\r
   Status = EFI_SUCCESS;\r
 \r
 Done:\r
@@ -494,15 +474,13 @@ Done:
     if (Prot != NULL) {\r
       CoreFreePool (Prot);\r
     }\r
-    DEBUG((DEBUG_ERROR, "InstallProtocolInterface: %g %p failed with %r\n", Protocol, Interface, Status));\r
+\r
+    DEBUG ((DEBUG_ERROR, "InstallProtocolInterface: %g %p failed with %r\n", Protocol, Interface, Status));\r
   }\r
 \r
   return Status;\r
 }\r
 \r
-\r
-\r
-\r
 /**\r
   Installs a list of protocol interface into the boot services environment.\r
   This function calls InstallProtocolInterface() in a loop. If any error\r
@@ -528,7 +506,7 @@ Done:
 EFI_STATUS\r
 EFIAPI\r
 CoreInstallMultipleProtocolInterfaces (\r
-  IN OUT EFI_HANDLE           *Handle,\r
+  IN OUT EFI_HANDLE  *Handle,\r
   ...\r
   )\r
 {\r
@@ -549,7 +527,7 @@ CoreInstallMultipleProtocolInterfaces (
   //\r
   // Syncronize with notifcations.\r
   //\r
-  OldTpl = CoreRaiseTpl (TPL_NOTIFY);\r
+  OldTpl    = CoreRaiseTpl (TPL_NOTIFY);\r
   OldHandle = *Handle;\r
 \r
   //\r
@@ -573,8 +551,8 @@ CoreInstallMultipleProtocolInterfaces (
     if (CompareGuid (Protocol, &gEfiDevicePathProtocolGuid)) {\r
       DeviceHandle = NULL;\r
       DevicePath   = Interface;\r
-      Status = CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, &DeviceHandle);\r
-      if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(DevicePath)) {\r
+      Status       = CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, &DeviceHandle);\r
+      if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd (DevicePath)) {\r
         Status = EFI_ALREADY_STARTED;\r
         continue;\r
       }\r
@@ -585,6 +563,7 @@ CoreInstallMultipleProtocolInterfaces (
     //\r
     Status = CoreInstallProtocolInterface (Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);\r
   }\r
+\r
   VA_END (Args);\r
 \r
   //\r
@@ -595,11 +574,12 @@ CoreInstallMultipleProtocolInterfaces (
     // Reset the va_arg back to the first argument.\r
     //\r
     VA_START (Args, Handle);\r
-    for (; Index > 1; Index--) {\r
-      Protocol = VA_ARG (Args, EFI_GUID *);\r
+    for ( ; Index > 1; Index--) {\r
+      Protocol  = VA_ARG (Args, EFI_GUID *);\r
       Interface = VA_ARG (Args, VOID *);\r
       CoreUninstallProtocolInterface (*Handle, Protocol, Interface);\r
     }\r
+\r
     VA_END (Args);\r
 \r
     *Handle = OldHandle;\r
@@ -612,7 +592,6 @@ CoreInstallMultipleProtocolInterfaces (
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Attempts to disconnect all drivers that are using the protocol interface being queried.\r
   If failed, reconnect all drivers disconnected.\r
@@ -629,14 +608,14 @@ CoreInstallMultipleProtocolInterfaces (
 **/\r
 EFI_STATUS\r
 CoreDisconnectControllersUsingProtocolInterface (\r
-  IN EFI_HANDLE           UserHandle,\r
-  IN PROTOCOL_INTERFACE   *Prot\r
+  IN EFI_HANDLE          UserHandle,\r
+  IN PROTOCOL_INTERFACE  *Prot\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  BOOLEAN               ItemFound;\r
-  LIST_ENTRY            *Link;\r
-  OPEN_PROTOCOL_DATA    *OpenData;\r
+  EFI_STATUS          Status;\r
+  BOOLEAN             ItemFound;\r
+  LIST_ENTRY          *Link;\r
+  OPEN_PROTOCOL_DATA  *OpenData;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
@@ -654,6 +633,7 @@ CoreDisconnectControllersUsingProtocolInterface (
         if (!EFI_ERROR (Status)) {\r
           ItemFound = TRUE;\r
         }\r
+\r
         break;\r
       }\r
     }\r
@@ -666,7 +646,8 @@ CoreDisconnectControllersUsingProtocolInterface (
     for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList;) {\r
       OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);\r
       if ((OpenData->Attributes &\r
-          (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) != 0) {\r
+           (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) != 0)\r
+      {\r
         Link = RemoveEntryList (&OpenData->Link);\r
         Prot->OpenListCount--;\r
         CoreFreePool (OpenData);\r
@@ -689,8 +670,6 @@ CoreDisconnectControllersUsingProtocolInterface (
   return Status;\r
 }\r
 \r
-\r
-\r
 /**\r
   Uninstalls all instances of a protocol:interfacer from a handle.\r
   If the last protocol interface is remove from the handle, the\r
@@ -707,14 +686,14 @@ CoreDisconnectControllersUsingProtocolInterface (
 EFI_STATUS\r
 EFIAPI\r
 CoreUninstallProtocolInterface (\r
-  IN EFI_HANDLE       UserHandle,\r
-  IN EFI_GUID         *Protocol,\r
-  IN VOID             *Interface\r
+  IN EFI_HANDLE  UserHandle,\r
+  IN EFI_GUID    *Protocol,\r
+  IN VOID        *Interface\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  IHANDLE               *Handle;\r
-  PROTOCOL_INTERFACE    *Prot;\r
+  EFI_STATUS          Status;\r
+  IHANDLE             *Handle;\r
+  PROTOCOL_INTERFACE  *Prot;\r
 \r
   //\r
   // Check that Protocol is valid\r
@@ -803,8 +782,6 @@ Done:
   return Status;\r
 }\r
 \r
-\r
-\r
 /**\r
   Uninstalls a list of protocol interface in the boot services environment.\r
   This function calls UninstallProtocolInterface() in a loop. This is\r
@@ -830,15 +807,15 @@ Done:
 EFI_STATUS\r
 EFIAPI\r
 CoreUninstallMultipleProtocolInterfaces (\r
-  IN EFI_HANDLE           Handle,\r
+  IN EFI_HANDLE  Handle,\r
   ...\r
   )\r
 {\r
-  EFI_STATUS      Status;\r
-  VA_LIST         Args;\r
-  EFI_GUID        *Protocol;\r
-  VOID            *Interface;\r
-  UINTN           Index;\r
+  EFI_STATUS  Status;\r
+  VA_LIST     Args;\r
+  EFI_GUID    *Protocol;\r
+  VOID        *Interface;\r
+  UINTN       Index;\r
 \r
   VA_START (Args, Handle);\r
   for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {\r
@@ -857,6 +834,7 @@ CoreUninstallMultipleProtocolInterfaces (
     //\r
     Status = CoreUninstallProtocolInterface (Handle, Protocol, Interface);\r
   }\r
+\r
   VA_END (Args);\r
 \r
   //\r
@@ -868,11 +846,12 @@ CoreUninstallMultipleProtocolInterfaces (
     // Reset the va_arg back to the first argument.\r
     //\r
     VA_START (Args, Handle);\r
-    for (; Index > 1; Index--) {\r
-      Protocol = VA_ARG(Args, EFI_GUID *);\r
-      Interface = VA_ARG(Args, VOID *);\r
+    for ( ; Index > 1; Index--) {\r
+      Protocol  = VA_ARG (Args, EFI_GUID *);\r
+      Interface = VA_ARG (Args, VOID *);\r
       CoreInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);\r
     }\r
+\r
     VA_END (Args);\r
     Status = EFI_INVALID_PARAMETER;\r
   }\r
@@ -880,7 +859,6 @@ CoreUninstallMultipleProtocolInterfaces (
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Locate a certain GUID protocol interface in a Handle's protocols.\r
 \r
@@ -892,8 +870,8 @@ CoreUninstallMultipleProtocolInterfaces (
 **/\r
 PROTOCOL_INTERFACE  *\r
 CoreGetProtocolInterface (\r
-  IN  EFI_HANDLE                UserHandle,\r
-  IN  EFI_GUID                  *Protocol\r
+  IN  EFI_HANDLE  UserHandle,\r
+  IN  EFI_GUID    *Protocol\r
   )\r
 {\r
   EFI_STATUS          Status;\r
@@ -913,17 +891,16 @@ CoreGetProtocolInterface (
   // Look at each protocol interface for a match\r
   //\r
   for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {\r
-    Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);\r
+    Prot      = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);\r
     ProtEntry = Prot->Protocol;\r
     if (CompareGuid (&ProtEntry->ProtocolID, Protocol)) {\r
       return Prot;\r
     }\r
   }\r
+\r
   return NULL;\r
 }\r
 \r
-\r
-\r
 /**\r
   Queries a handle to determine if it supports a specified protocol.\r
 \r
@@ -942,23 +919,21 @@ CoreGetProtocolInterface (
 EFI_STATUS\r
 EFIAPI\r
 CoreHandleProtocol (\r
-  IN EFI_HANDLE       UserHandle,\r
-  IN EFI_GUID         *Protocol,\r
-  OUT VOID            **Interface\r
+  IN EFI_HANDLE  UserHandle,\r
+  IN EFI_GUID    *Protocol,\r
+  OUT VOID       **Interface\r
   )\r
 {\r
   return CoreOpenProtocol (\r
-          UserHandle,\r
-          Protocol,\r
-          Interface,\r
-          gDxeCoreImageHandle,\r
-          NULL,\r
-          EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL\r
-          );\r
+           UserHandle,\r
+           Protocol,\r
+           Interface,\r
+           gDxeCoreImageHandle,\r
+           NULL,\r
+           EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL\r
+           );\r
 }\r
 \r
-\r
-\r
 /**\r
   Locates the installed protocol handler for the handle, and\r
   invokes it to obtain the protocol interface. Usage information\r
@@ -982,12 +957,12 @@ CoreHandleProtocol (
 EFI_STATUS\r
 EFIAPI\r
 CoreOpenProtocol (\r
-  IN  EFI_HANDLE                UserHandle,\r
-  IN  EFI_GUID                  *Protocol,\r
-  OUT VOID                      **Interface OPTIONAL,\r
-  IN  EFI_HANDLE                ImageHandle,\r
-  IN  EFI_HANDLE                ControllerHandle,\r
-  IN  UINT32                    Attributes\r
+  IN  EFI_HANDLE  UserHandle,\r
+  IN  EFI_GUID    *Protocol,\r
+  OUT VOID        **Interface OPTIONAL,\r
+  IN  EFI_HANDLE  ImageHandle,\r
+  IN  EFI_HANDLE  ControllerHandle,\r
+  IN  UINT32      Attributes\r
   )\r
 {\r
   EFI_STATUS          Status;\r
@@ -1030,47 +1005,52 @@ CoreOpenProtocol (
   // Check for invalid Attributes\r
   //\r
   switch (Attributes) {\r
-  case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :\r
-    Status = CoreValidateHandle (ImageHandle);\r
-    if (EFI_ERROR (Status)) {\r
-      goto Done;\r
-    }\r
-    Status = CoreValidateHandle (ControllerHandle);\r
-    if (EFI_ERROR (Status)) {\r
-      goto Done;\r
-    }\r
-    if (UserHandle == ControllerHandle) {\r
+    case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER:\r
+      Status = CoreValidateHandle (ImageHandle);\r
+      if (EFI_ERROR (Status)) {\r
+        goto Done;\r
+      }\r
+\r
+      Status = CoreValidateHandle (ControllerHandle);\r
+      if (EFI_ERROR (Status)) {\r
+        goto Done;\r
+      }\r
+\r
+      if (UserHandle == ControllerHandle) {\r
+        Status = EFI_INVALID_PARAMETER;\r
+        goto Done;\r
+      }\r
+\r
+      break;\r
+    case EFI_OPEN_PROTOCOL_BY_DRIVER:\r
+    case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE:\r
+      Status = CoreValidateHandle (ImageHandle);\r
+      if (EFI_ERROR (Status)) {\r
+        goto Done;\r
+      }\r
+\r
+      Status = CoreValidateHandle (ControllerHandle);\r
+      if (EFI_ERROR (Status)) {\r
+        goto Done;\r
+      }\r
+\r
+      break;\r
+    case EFI_OPEN_PROTOCOL_EXCLUSIVE:\r
+      Status = CoreValidateHandle (ImageHandle);\r
+      if (EFI_ERROR (Status)) {\r
+        goto Done;\r
+      }\r
+\r
+      break;\r
+    case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:\r
+    case EFI_OPEN_PROTOCOL_GET_PROTOCOL:\r
+    case EFI_OPEN_PROTOCOL_TEST_PROTOCOL:\r
+      break;\r
+    default:\r
       Status = EFI_INVALID_PARAMETER;\r
       goto Done;\r
-    }\r
-    break;\r
-  case EFI_OPEN_PROTOCOL_BY_DRIVER :\r
-  case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE :\r
-    Status = CoreValidateHandle (ImageHandle);\r
-    if (EFI_ERROR (Status)) {\r
-      goto Done;\r
-    }\r
-    Status = CoreValidateHandle (ControllerHandle);\r
-    if (EFI_ERROR (Status)) {\r
-      goto Done;\r
-    }\r
-    break;\r
-  case EFI_OPEN_PROTOCOL_EXCLUSIVE :\r
-    Status = CoreValidateHandle (ImageHandle);\r
-    if (EFI_ERROR (Status)) {\r
-      goto Done;\r
-    }\r
-    break;\r
-  case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :\r
-  case EFI_OPEN_PROTOCOL_GET_PROTOCOL :\r
-  case EFI_OPEN_PROTOCOL_TEST_PROTOCOL :\r
-    break;\r
-  default:\r
-    Status = EFI_INVALID_PARAMETER;\r
-    goto Done;\r
   }\r
 \r
-\r
   //\r
   // Look at each protocol interface for a match\r
   //\r
@@ -1082,10 +1062,10 @@ CoreOpenProtocol (
 \r
   Status = EFI_SUCCESS;\r
 \r
-  ByDriver        = FALSE;\r
-  Exclusive       = FALSE;\r
+  ByDriver  = FALSE;\r
+  Exclusive = FALSE;\r
   for ( Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {\r
-    OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);\r
+    OpenData   = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);\r
     ExactMatch =  (BOOLEAN)((OpenData->AgentHandle == ImageHandle) &&\r
                             (OpenData->Attributes == Attributes)  &&\r
                             (OpenData->ControllerHandle == ControllerHandle));\r
@@ -1096,6 +1076,7 @@ CoreOpenProtocol (
         goto Done;\r
       }\r
     }\r
+\r
     if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) != 0) {\r
       Exclusive = TRUE;\r
     } else if (ExactMatch) {\r
@@ -1113,62 +1094,66 @@ CoreOpenProtocol (
   //\r
 \r
   switch (Attributes) {\r
-  case EFI_OPEN_PROTOCOL_BY_DRIVER :\r
-    if (Exclusive || ByDriver) {\r
-      Status = EFI_ACCESS_DENIED;\r
-      goto Done;\r
-    }\r
-    break;\r
-  case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE :\r
-  case EFI_OPEN_PROTOCOL_EXCLUSIVE :\r
-    if (Exclusive) {\r
-      Status = EFI_ACCESS_DENIED;\r
-      goto Done;\r
-    }\r
-    if (ByDriver) {\r
-      do {\r
-        Disconnect = FALSE;\r
-        for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {\r
-          OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);\r
-          if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {\r
-            Disconnect = TRUE;\r
-            CoreReleaseProtocolLock ();\r
-            Status = CoreDisconnectController (UserHandle, OpenData->AgentHandle, NULL);\r
-            CoreAcquireProtocolLock ();\r
-            if (EFI_ERROR (Status)) {\r
-              Status = EFI_ACCESS_DENIED;\r
-              goto Done;\r
-            } else {\r
-              break;\r
+    case EFI_OPEN_PROTOCOL_BY_DRIVER:\r
+      if (Exclusive || ByDriver) {\r
+        Status = EFI_ACCESS_DENIED;\r
+        goto Done;\r
+      }\r
+\r
+      break;\r
+    case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE:\r
+    case EFI_OPEN_PROTOCOL_EXCLUSIVE:\r
+      if (Exclusive) {\r
+        Status = EFI_ACCESS_DENIED;\r
+        goto Done;\r
+      }\r
+\r
+      if (ByDriver) {\r
+        do {\r
+          Disconnect = FALSE;\r
+          for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {\r
+            OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);\r
+            if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {\r
+              Disconnect = TRUE;\r
+              CoreReleaseProtocolLock ();\r
+              Status = CoreDisconnectController (UserHandle, OpenData->AgentHandle, NULL);\r
+              CoreAcquireProtocolLock ();\r
+              if (EFI_ERROR (Status)) {\r
+                Status = EFI_ACCESS_DENIED;\r
+                goto Done;\r
+              } else {\r
+                break;\r
+              }\r
             }\r
           }\r
-        }\r
-      } while (Disconnect);\r
-    }\r
-    break;\r
-  case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :\r
-  case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :\r
-  case EFI_OPEN_PROTOCOL_GET_PROTOCOL :\r
-  case EFI_OPEN_PROTOCOL_TEST_PROTOCOL :\r
-    break;\r
+        } while (Disconnect);\r
+      }\r
+\r
+      break;\r
+    case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER:\r
+    case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:\r
+    case EFI_OPEN_PROTOCOL_GET_PROTOCOL:\r
+    case EFI_OPEN_PROTOCOL_TEST_PROTOCOL:\r
+      break;\r
   }\r
 \r
   if (ImageHandle == NULL) {\r
     Status = EFI_SUCCESS;\r
     goto Done;\r
   }\r
+\r
   //\r
   // Create new entry\r
   //\r
-  OpenData = AllocatePool (sizeof(OPEN_PROTOCOL_DATA));\r
+  OpenData = AllocatePool (sizeof (OPEN_PROTOCOL_DATA));\r
   if (OpenData == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
   } else {\r
-    OpenData->Signature         = OPEN_PROTOCOL_DATA_SIGNATURE;\r
-    OpenData->AgentHandle       = ImageHandle;\r
-    OpenData->ControllerHandle  = ControllerHandle;\r
-    OpenData->Attributes        = Attributes;\r
-    OpenData->OpenCount         = 1;\r
+    OpenData->Signature        = OPEN_PROTOCOL_DATA_SIGNATURE;\r
+    OpenData->AgentHandle      = ImageHandle;\r
+    OpenData->ControllerHandle = ControllerHandle;\r
+    OpenData->Attributes       = Attributes;\r
+    OpenData->OpenCount        = 1;\r
     InsertTailList (&Prot->OpenList, &OpenData->Link);\r
     Prot->OpenListCount++;\r
     Status = EFI_SUCCESS;\r
@@ -1181,7 +1166,7 @@ Done:
     // Keep Interface unmodified in case of any Error\r
     // except EFI_ALREADY_STARTED and EFI_UNSUPPORTED.\r
     //\r
-    if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) {\r
+    if (!EFI_ERROR (Status) || (Status == EFI_ALREADY_STARTED)) {\r
       //\r
       // According to above logic, if 'Prot' is NULL, then the 'Status' must be\r
       // EFI_UNSUPPORTED. Here the 'Status' is not EFI_UNSUPPORTED, so 'Prot'\r
@@ -1211,8 +1196,6 @@ Done:
   return Status;\r
 }\r
 \r
-\r
-\r
 /**\r
   Closes a protocol on a handle that was opened using OpenProtocol().\r
 \r
@@ -1241,10 +1224,10 @@ Done:
 EFI_STATUS\r
 EFIAPI\r
 CoreCloseProtocol (\r
-  IN  EFI_HANDLE                UserHandle,\r
-  IN  EFI_GUID                  *Protocol,\r
-  IN  EFI_HANDLE                AgentHandle,\r
-  IN  EFI_HANDLE                ControllerHandle\r
+  IN  EFI_HANDLE  UserHandle,\r
+  IN  EFI_GUID    *Protocol,\r
+  IN  EFI_HANDLE  AgentHandle,\r
+  IN  EFI_HANDLE  ControllerHandle\r
   )\r
 {\r
   EFI_STATUS          Status;\r
@@ -1264,16 +1247,19 @@ CoreCloseProtocol (
   if (EFI_ERROR (Status)) {\r
     goto Done;\r
   }\r
+\r
   Status = CoreValidateHandle (AgentHandle);\r
   if (EFI_ERROR (Status)) {\r
     goto Done;\r
   }\r
+\r
   if (ControllerHandle != NULL) {\r
     Status = CoreValidateHandle (ControllerHandle);\r
     if (EFI_ERROR (Status)) {\r
       goto Done;\r
     }\r
   }\r
+\r
   if (Protocol == NULL) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto Done;\r
@@ -1282,7 +1268,7 @@ CoreCloseProtocol (
   //\r
   // Look at each protocol interface for a match\r
   //\r
-  Status = EFI_NOT_FOUND;\r
+  Status            = EFI_NOT_FOUND;\r
   ProtocolInterface = CoreGetProtocolInterface (UserHandle, Protocol);\r
   if (ProtocolInterface == NULL) {\r
     goto Done;\r
@@ -1294,12 +1280,12 @@ CoreCloseProtocol (
   Link = ProtocolInterface->OpenList.ForwardLink;\r
   while (Link != &ProtocolInterface->OpenList) {\r
     OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);\r
-    Link = Link->ForwardLink;\r
+    Link     = Link->ForwardLink;\r
     if ((OpenData->AgentHandle == AgentHandle) && (OpenData->ControllerHandle == ControllerHandle)) {\r
-        RemoveEntryList (&OpenData->Link);\r
-        ProtocolInterface->OpenListCount--;\r
-        CoreFreePool (OpenData);\r
-        Status = EFI_SUCCESS;\r
+      RemoveEntryList (&OpenData->Link);\r
+      ProtocolInterface->OpenListCount--;\r
+      CoreFreePool (OpenData);\r
+      Status = EFI_SUCCESS;\r
     }\r
   }\r
 \r
@@ -1311,9 +1297,6 @@ Done:
   return Status;\r
 }\r
 \r
-\r
-\r
-\r
 /**\r
   Return information about Opened protocols in the system\r
 \r
@@ -1332,22 +1315,22 @@ Done:
 EFI_STATUS\r
 EFIAPI\r
 CoreOpenProtocolInformation (\r
-  IN  EFI_HANDLE                          UserHandle,\r
-  IN  EFI_GUID                            *Protocol,\r
-  OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
-  OUT UINTN                               *EntryCount\r
+  IN  EFI_HANDLE                           UserHandle,\r
+  IN  EFI_GUID                             *Protocol,\r
+  OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY  **EntryBuffer,\r
+  OUT UINTN                                *EntryCount\r
   )\r
 {\r
-  EFI_STATUS                          Status;\r
-  PROTOCOL_INTERFACE                  *ProtocolInterface;\r
-  LIST_ENTRY                          *Link;\r
-  OPEN_PROTOCOL_DATA                  *OpenData;\r
-  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *Buffer;\r
-  UINTN                               Count;\r
-  UINTN                               Size;\r
+  EFI_STATUS                           Status;\r
+  PROTOCOL_INTERFACE                   *ProtocolInterface;\r
+  LIST_ENTRY                           *Link;\r
+  OPEN_PROTOCOL_DATA                   *OpenData;\r
+  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY  *Buffer;\r
+  UINTN                                Count;\r
+  UINTN                                Size;\r
 \r
   *EntryBuffer = NULL;\r
-  *EntryCount = 0;\r
+  *EntryCount  = 0;\r
 \r
   //\r
   // Lock the protocol database\r
@@ -1357,7 +1340,7 @@ CoreOpenProtocolInformation (
   //\r
   // Look at each protocol interface for a match\r
   //\r
-  Status = EFI_NOT_FOUND;\r
+  Status            = EFI_NOT_FOUND;\r
   ProtocolInterface = CoreGetProtocolInterface (UserHandle, Protocol);\r
   if (ProtocolInterface == NULL) {\r
     goto Done;\r
@@ -1367,17 +1350,18 @@ CoreOpenProtocolInformation (
   // Count the number of Open Entries\r
   //\r
   for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;\r
-        (Link != &ProtocolInterface->OpenList) ;\r
-        Link = Link->ForwardLink  ) {\r
+        (Link != &ProtocolInterface->OpenList);\r
+        Link = Link->ForwardLink  )\r
+  {\r
     Count++;\r
   }\r
 \r
   ASSERT (Count == ProtocolInterface->OpenListCount);\r
 \r
   if (Count == 0) {\r
-    Size = sizeof(EFI_OPEN_PROTOCOL_INFORMATION_ENTRY);\r
+    Size = sizeof (EFI_OPEN_PROTOCOL_INFORMATION_ENTRY);\r
   } else {\r
-    Size = Count * sizeof(EFI_OPEN_PROTOCOL_INFORMATION_ENTRY);\r
+    Size = Count * sizeof (EFI_OPEN_PROTOCOL_INFORMATION_ENTRY);\r
   }\r
 \r
   Buffer = AllocatePool (Size);\r
@@ -1389,7 +1373,8 @@ CoreOpenProtocolInformation (
   Status = EFI_SUCCESS;\r
   for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;\r
         (Link != &ProtocolInterface->OpenList);\r
-        Link = Link->ForwardLink, Count++  ) {\r
+        Link = Link->ForwardLink, Count++  )\r
+  {\r
     OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);\r
 \r
     Buffer[Count].AgentHandle      = OpenData->AgentHandle;\r
@@ -1399,7 +1384,7 @@ CoreOpenProtocolInformation (
   }\r
 \r
   *EntryBuffer = Buffer;\r
-  *EntryCount = Count;\r
+  *EntryCount  = Count;\r
 \r
 Done:\r
   //\r
@@ -1409,9 +1394,6 @@ Done:
   return Status;\r
 }\r
 \r
-\r
-\r
-\r
 /**\r
   Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
   from pool.\r
@@ -1438,17 +1420,17 @@ Done:
 EFI_STATUS\r
 EFIAPI\r
 CoreProtocolsPerHandle (\r
-  IN EFI_HANDLE       UserHandle,\r
-  OUT EFI_GUID        ***ProtocolBuffer,\r
-  OUT UINTN           *ProtocolBufferCount\r
+  IN EFI_HANDLE  UserHandle,\r
+  OUT EFI_GUID   ***ProtocolBuffer,\r
+  OUT UINTN      *ProtocolBufferCount\r
   )\r
 {\r
-  EFI_STATUS                          Status;\r
-  IHANDLE                             *Handle;\r
-  PROTOCOL_INTERFACE                  *Prot;\r
-  LIST_ENTRY                          *Link;\r
-  UINTN                               ProtocolCount;\r
-  EFI_GUID                            **Buffer;\r
+  EFI_STATUS          Status;\r
+  IHANDLE             *Handle;\r
+  PROTOCOL_INTERFACE  *Prot;\r
+  LIST_ENTRY          *Link;\r
+  UINTN               ProtocolCount;\r
+  EFI_GUID            **Buffer;\r
 \r
   if (ProtocolBuffer == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -1489,15 +1471,17 @@ CoreProtocolsPerHandle (
     goto Done;\r
   }\r
 \r
-  *ProtocolBuffer = Buffer;\r
+  *ProtocolBuffer      = Buffer;\r
   *ProtocolBufferCount = ProtocolCount;\r
 \r
   for ( Link = Handle->Protocols.ForwardLink, ProtocolCount = 0;\r
         Link != &Handle->Protocols;\r
-        Link = Link->ForwardLink, ProtocolCount++) {\r
-    Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);\r
+        Link = Link->ForwardLink, ProtocolCount++)\r
+  {\r
+    Prot                  = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);\r
     Buffer[ProtocolCount] = &(Prot->Protocol->ProtocolID);\r
   }\r
+\r
   Status = EFI_SUCCESS;\r
 \r
 Done:\r
@@ -1505,8 +1489,6 @@ Done:
   return Status;\r
 }\r
 \r
-\r
-\r
 /**\r
   return handle database key.\r
 \r
@@ -1522,8 +1504,6 @@ CoreGetHandleDatabaseKey (
   return gHandleDatabaseKey;\r
 }\r
 \r
-\r
-\r
 /**\r
   Go connect any handles that were created or modified while a image executed.\r
 \r
@@ -1536,11 +1516,11 @@ CoreConnectHandlesByKey (
   UINT64  Key\r
   )\r
 {\r
-  UINTN           Count;\r
-  LIST_ENTRY      *Link;\r
-  EFI_HANDLE      *HandleBuffer;\r
-  IHANDLE         *Handle;\r
-  UINTN           Index;\r
+  UINTN       Count;\r
+  LIST_ENTRY  *Link;\r
+  EFI_HANDLE  *HandleBuffer;\r
+  IHANDLE     *Handle;\r
+  UINTN       Index;\r
 \r
   //\r
   // Lock the protocol database\r
@@ -1579,5 +1559,5 @@ CoreConnectHandlesByKey (
     CoreConnectController (HandleBuffer[Index], NULL, NULL, TRUE);\r
   }\r
 \r
-  CoreFreePool(HandleBuffer);\r
+  CoreFreePool (HandleBuffer);\r
 }\r