]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
NetworkPkg: Apply uncrustify changes
[mirror_edk2.git] / NetworkPkg / Dhcp6Dxe / Dhcp6Impl.c
index bb4c1d12a987c13697db6a2d4bb5bcb79b9e17a8..61b41d0f768f41d389ef999705cd0fc3c1326e14 100644 (file)
 //\r
 //   ALL_DHCP_Relay_Agents_and_Servers address: FF02::1:2\r
 //\r
-EFI_IPv6_ADDRESS   mAllDhcpRelayAndServersAddress = {{0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2}};\r
+EFI_IPv6_ADDRESS  mAllDhcpRelayAndServersAddress = {\r
+  { 0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2 }\r
+};\r
 \r
-EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {\r
+EFI_DHCP6_PROTOCOL  gDhcp6ProtocolTemplate = {\r
   EfiDhcp6GetModeData,\r
   EfiDhcp6Configure,\r
   EfiDhcp6Start,\r
@@ -61,14 +63,14 @@ EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp6Start (\r
-  IN EFI_DHCP6_PROTOCOL        *This\r
+  IN EFI_DHCP6_PROTOCOL  *This\r
   )\r
 {\r
-  EFI_STATUS                   Status;\r
-  EFI_TPL                      OldTpl;\r
-  DHCP6_INSTANCE               *Instance;\r
-  DHCP6_SERVICE                *Service;\r
-  EFI_STATUS                   MediaStatus;\r
+  EFI_STATUS      Status;\r
+  EFI_TPL         OldTpl;\r
+  DHCP6_INSTANCE  *Instance;\r
+  DHCP6_SERVICE   *Service;\r
+  EFI_STATUS      MediaStatus;\r
 \r
   if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -93,7 +95,7 @@ EfiDhcp6Start (
     return EFI_ALREADY_STARTED;\r
   }\r
 \r
-  OldTpl           = gBS->RaiseTPL (TPL_CALLBACK);\r
+  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
   // Check Media Status.\r
@@ -119,7 +121,7 @@ EfiDhcp6Start (
   //\r
   // Register receive callback for the stateful exchange process.\r
   //\r
-  Status = UdpIoRecvDatagram(\r
+  Status = UdpIoRecvDatagram (\r
              Service->UdpIo,\r
              Dhcp6ReceivePacket,\r
              Service,\r
@@ -136,10 +138,10 @@ EfiDhcp6Start (
   // Poll udp out of the net tpl if synchronous call.\r
   //\r
   if (Instance->Config->IaInfoEvent == NULL) {\r
-\r
     while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
       Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
     }\r
+\r
     return Instance->UdpSts;\r
   }\r
 \r
@@ -151,7 +153,6 @@ ON_ERROR:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Stops the DHCPv6 standard S.A.R.R. process.\r
 \r
@@ -170,14 +171,14 @@ ON_ERROR:
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp6Stop (\r
-  IN EFI_DHCP6_PROTOCOL        *This\r
+  IN EFI_DHCP6_PROTOCOL  *This\r
   )\r
 {\r
-  EFI_TPL                      OldTpl;\r
-  EFI_STATUS                   Status;\r
-  EFI_UDP6_PROTOCOL            *Udp6;\r
-  DHCP6_INSTANCE               *Instance;\r
-  DHCP6_SERVICE                *Service;\r
+  EFI_TPL            OldTpl;\r
+  EFI_STATUS         Status;\r
+  EFI_UDP6_PROTOCOL  *Udp6;\r
+  DHCP6_INSTANCE     *Instance;\r
+  DHCP6_SERVICE      *Service;\r
 \r
   if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -200,10 +201,11 @@ EfiDhcp6Stop (
   //\r
   // No valid REPLY message received yet, cleanup this instance directly.\r
   //\r
-  if (Instance->IaCb.Ia->State == Dhcp6Init ||\r
-      Instance->IaCb.Ia->State == Dhcp6Selecting ||\r
-      Instance->IaCb.Ia->State == Dhcp6Requesting\r
-      ) {\r
+  if ((Instance->IaCb.Ia->State == Dhcp6Init) ||\r
+      (Instance->IaCb.Ia->State == Dhcp6Selecting) ||\r
+      (Instance->IaCb.Ia->State == Dhcp6Requesting)\r
+      )\r
+  {\r
     goto ON_EXIT;\r
   }\r
 \r
@@ -213,7 +215,7 @@ EfiDhcp6Stop (
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   Instance->UdpSts = EFI_ALREADY_STARTED;\r
-  Status = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia);\r
+  Status           = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia);\r
   gBS->RestoreTPL (OldTpl);\r
   if (EFI_ERROR (Status)) {\r
     goto ON_EXIT;\r
@@ -227,6 +229,7 @@ EfiDhcp6Stop (
     while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
       Udp6->Poll (Udp6);\r
     }\r
+\r
     Status = Instance->UdpSts;\r
   }\r
 \r
@@ -241,7 +244,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Returns the current operating mode data for the Dhcp6 instance.\r
 \r
@@ -260,26 +262,26 @@ ON_EXIT:
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp6GetModeData (\r
-  IN  EFI_DHCP6_PROTOCOL       *This,\r
-  OUT EFI_DHCP6_MODE_DATA      *Dhcp6ModeData      OPTIONAL,\r
-  OUT EFI_DHCP6_CONFIG_DATA    *Dhcp6ConfigData    OPTIONAL\r
+  IN  EFI_DHCP6_PROTOCOL     *This,\r
+  OUT EFI_DHCP6_MODE_DATA    *Dhcp6ModeData      OPTIONAL,\r
+  OUT EFI_DHCP6_CONFIG_DATA  *Dhcp6ConfigData    OPTIONAL\r
   )\r
 {\r
-  EFI_TPL                      OldTpl;\r
-  EFI_DHCP6_IA                 *Ia;\r
-  DHCP6_INSTANCE               *Instance;\r
-  DHCP6_SERVICE                *Service;\r
-  UINT32                       IaSize;\r
-  UINT32                       IdSize;\r
-\r
-  if (This == NULL || (Dhcp6ModeData == NULL && Dhcp6ConfigData == NULL)) {\r
+  EFI_TPL         OldTpl;\r
+  EFI_DHCP6_IA    *Ia;\r
+  DHCP6_INSTANCE  *Instance;\r
+  DHCP6_SERVICE   *Service;\r
+  UINT32          IaSize;\r
+  UINT32          IdSize;\r
+\r
+  if ((This == NULL) || ((Dhcp6ModeData == NULL) && (Dhcp6ConfigData == NULL))) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   Instance = DHCP6_INSTANCE_FROM_THIS (This);\r
   Service  = Instance->Service;\r
 \r
-  if (Instance->Config == NULL && Dhcp6ConfigData != NULL) {\r
+  if ((Instance->Config == NULL) && (Dhcp6ConfigData != NULL)) {\r
     return EFI_ACCESS_DENIED;\r
   }\r
 \r
@@ -291,7 +293,7 @@ EfiDhcp6GetModeData (
   // User needs a copy of instance config data.\r
   //\r
   if (Dhcp6ConfigData != NULL) {\r
-    ZeroMem (Dhcp6ConfigData, sizeof(EFI_DHCP6_CONFIG_DATA));\r
+    ZeroMem (Dhcp6ConfigData, sizeof (EFI_DHCP6_CONFIG_DATA));\r
     //\r
     // Duplicate config data, including all reference buffers.\r
     //\r
@@ -347,6 +349,7 @@ EfiDhcp6GetModeData (
         if (Dhcp6ModeData->Ia->ReplyPacket == NULL) {\r
           goto ON_ERROR;\r
         }\r
+\r
         CopyMem (\r
           Dhcp6ModeData->Ia->ReplyPacket,\r
           Ia->ReplyPacket,\r
@@ -365,15 +368,16 @@ ON_ERROR:
   if (Dhcp6ConfigData != NULL) {\r
     Dhcp6CleanupConfigData (Dhcp6ConfigData);\r
   }\r
+\r
   if (Dhcp6ModeData != NULL) {\r
     Dhcp6CleanupModeData (Dhcp6ModeData);\r
   }\r
+\r
   gBS->RestoreTPL (OldTpl);\r
 \r
   return EFI_OUT_OF_RESOURCES;\r
 }\r
 \r
-\r
 /**\r
   Initializes, changes, or resets the operational settings for the Dhcp6 instance.\r
 \r
@@ -405,17 +409,17 @@ ON_ERROR:
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp6Configure (\r
-  IN EFI_DHCP6_PROTOCOL        *This,\r
-  IN EFI_DHCP6_CONFIG_DATA     *Dhcp6CfgData    OPTIONAL\r
+  IN EFI_DHCP6_PROTOCOL     *This,\r
+  IN EFI_DHCP6_CONFIG_DATA  *Dhcp6CfgData    OPTIONAL\r
   )\r
 {\r
-  EFI_TPL                      OldTpl;\r
-  EFI_STATUS                   Status;\r
-  LIST_ENTRY                   *Entry;\r
-  DHCP6_INSTANCE               *Other;\r
-  DHCP6_INSTANCE               *Instance;\r
-  DHCP6_SERVICE                *Service;\r
-  UINTN                        Index;\r
+  EFI_TPL         OldTpl;\r
+  EFI_STATUS      Status;\r
+  LIST_ENTRY      *Entry;\r
+  DHCP6_INSTANCE  *Other;\r
+  DHCP6_INSTANCE  *Instance;\r
+  DHCP6_SERVICE   *Service;\r
+  UINTN           Index;\r
 \r
   if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -428,36 +432,40 @@ EfiDhcp6Configure (
   // Check the parameter of configure data.\r
   //\r
   if (Dhcp6CfgData != NULL) {\r
-    if (Dhcp6CfgData->OptionCount > 0 && Dhcp6CfgData->OptionList == NULL) {\r
+    if ((Dhcp6CfgData->OptionCount > 0) && (Dhcp6CfgData->OptionList == NULL)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
+\r
     if (Dhcp6CfgData->OptionList != NULL) {\r
       for (Index = 0; Index < Dhcp6CfgData->OptionCount; Index++) {\r
-        if (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId ||\r
-            Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit ||\r
-            Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept ||\r
-            Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana ||\r
-            Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata\r
-            ) {\r
+        if ((Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId) ||\r
+            (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit) ||\r
+            (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept) ||\r
+            (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana) ||\r
+            (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata)\r
+            )\r
+        {\r
           return EFI_INVALID_PARAMETER;\r
         }\r
       }\r
     }\r
 \r
-    if (Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA &&\r
-        Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA\r
-        ) {\r
+    if ((Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA) &&\r
+        (Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA)\r
+        )\r
+    {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
-    if (Dhcp6CfgData->IaInfoEvent == NULL && Dhcp6CfgData->SolicitRetransmission == NULL) {\r
+    if ((Dhcp6CfgData->IaInfoEvent == NULL) && (Dhcp6CfgData->SolicitRetransmission == NULL)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
-    if (Dhcp6CfgData->SolicitRetransmission != NULL &&\r
-        Dhcp6CfgData->SolicitRetransmission->Mrc == 0 &&\r
-        Dhcp6CfgData->SolicitRetransmission->Mrd == 0\r
-        ) {\r
+    if ((Dhcp6CfgData->SolicitRetransmission != NULL) &&\r
+        (Dhcp6CfgData->SolicitRetransmission->Mrc == 0) &&\r
+        (Dhcp6CfgData->SolicitRetransmission->Mrd == 0)\r
+        )\r
+    {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
@@ -466,10 +474,11 @@ EfiDhcp6Configure (
     //\r
     NET_LIST_FOR_EACH (Entry, &Service->Child) {\r
       Other = NET_LIST_USER_STRUCT (Entry, DHCP6_INSTANCE, Link);\r
-      if (Other->IaCb.Ia != NULL &&\r
-          Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type &&\r
-          Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId\r
-          ) {\r
+      if ((Other->IaCb.Ia != NULL) &&\r
+          (Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type) &&\r
+          (Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId)\r
+          )\r
+      {\r
         return EFI_INVALID_PARAMETER;\r
       }\r
     }\r
@@ -496,7 +505,7 @@ EfiDhcp6Configure (
     }\r
 \r
     Status = Dhcp6CopyConfigData (Instance->Config, Dhcp6CfgData);\r
-    if (EFI_ERROR(Status)) {\r
+    if (EFI_ERROR (Status)) {\r
       FreePool (Instance->Config);\r
       gBS->RestoreTPL (OldTpl);\r
       return EFI_OUT_OF_RESOURCES;\r
@@ -506,21 +515,20 @@ EfiDhcp6Configure (
     // Initialize the Ia descriptor from the config data, and leave the other\r
     // fields of the Ia as default value 0.\r
     //\r
-    Instance->IaCb.Ia = AllocateZeroPool (sizeof(EFI_DHCP6_IA));\r
+    Instance->IaCb.Ia = AllocateZeroPool (sizeof (EFI_DHCP6_IA));\r
     if (Instance->IaCb.Ia == NULL) {\r
       Dhcp6CleanupConfigData (Instance->Config);\r
       FreePool (Instance->Config);\r
       gBS->RestoreTPL (OldTpl);\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
+\r
     CopyMem (\r
       &Instance->IaCb.Ia->Descriptor,\r
       &Dhcp6CfgData->IaDescriptor,\r
-      sizeof(EFI_DHCP6_IA_DESCRIPTOR)\r
+      sizeof (EFI_DHCP6_IA_DESCRIPTOR)\r
       );\r
-\r
   } else {\r
-\r
     if (Instance->Config == NULL) {\r
       ASSERT (Instance->IaCb.Ia == NULL);\r
       gBS->RestoreTPL (OldTpl);\r
@@ -548,7 +556,6 @@ EfiDhcp6Configure (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Request configuration information without the assignment of any\r
   Ia addresses of the client.\r
@@ -604,29 +611,29 @@ EfiDhcp6InfoRequest (
   IN VOID                      *CallbackContext OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS                   Status;\r
-  DHCP6_INSTANCE               *Instance;\r
-  DHCP6_SERVICE                *Service;\r
-  UINTN                        Index;\r
-  EFI_EVENT                    Timer;\r
-  EFI_STATUS                   TimerStatus;\r
-  UINTN                        GetMappingTimeOut;\r
-\r
-  if (This == NULL || OptionRequest == NULL || Retransmission == NULL || ReplyCallback == NULL) {\r
+  EFI_STATUS      Status;\r
+  DHCP6_INSTANCE  *Instance;\r
+  DHCP6_SERVICE   *Service;\r
+  UINTN           Index;\r
+  EFI_EVENT       Timer;\r
+  EFI_STATUS      TimerStatus;\r
+  UINTN           GetMappingTimeOut;\r
+\r
+  if ((This == NULL) || (OptionRequest == NULL) || (Retransmission == NULL) || (ReplyCallback == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (Retransmission != NULL && Retransmission->Mrc == 0 && Retransmission->Mrd == 0) {\r
+  if ((Retransmission != NULL) && (Retransmission->Mrc == 0) && (Retransmission->Mrd == 0)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (OptionCount > 0 && OptionList == NULL) {\r
+  if ((OptionCount > 0) && (OptionList == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   if (OptionList != NULL) {\r
     for (Index = 0; Index < OptionCount; Index++) {\r
-      if (OptionList[Index]->OpCode == Dhcp6OptClientId || OptionList[Index]->OpCode == Dhcp6OptRequestOption) {\r
+      if ((OptionList[Index]->OpCode == Dhcp6OptClientId) || (OptionList[Index]->OpCode == Dhcp6OptRequestOption)) {\r
         return EFI_INVALID_PARAMETER;\r
       }\r
     }\r
@@ -651,8 +658,8 @@ EfiDhcp6InfoRequest (
     // The link local address is not ready, wait for some time and restart\r
     // the DHCP6 information request process.\r
     //\r
-    Status = Dhcp6GetMappingTimeOut(Service->Ip6Cfg, &GetMappingTimeOut);\r
-    if (EFI_ERROR(Status)) {\r
+    Status = Dhcp6GetMappingTimeOut (Service->Ip6Cfg, &GetMappingTimeOut);\r
+    if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
 \r
@@ -689,6 +696,7 @@ EfiDhcp6InfoRequest (
 \r
     gBS->CloseEvent (Timer);\r
   }\r
+\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -697,17 +705,16 @@ EfiDhcp6InfoRequest (
   // Poll udp out of the net tpl if synchronous call.\r
   //\r
   if (TimeoutEvent == NULL) {\r
-\r
     while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
       Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
     }\r
+\r
     return Instance->UdpSts;\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Manually extend the valid and preferred lifetimes for the IPv6 addresses\r
   of the configured IA and update other configuration parameters by sending a\r
@@ -756,14 +763,14 @@ EfiDhcp6InfoRequest (
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp6RenewRebind (\r
-  IN EFI_DHCP6_PROTOCOL        *This,\r
-  IN BOOLEAN                   RebindRequest\r
+  IN EFI_DHCP6_PROTOCOL  *This,\r
+  IN BOOLEAN             RebindRequest\r
   )\r
 {\r
-  EFI_STATUS                   Status;\r
-  EFI_TPL                      OldTpl;\r
-  DHCP6_INSTANCE               *Instance;\r
-  DHCP6_SERVICE                *Service;\r
+  EFI_STATUS      Status;\r
+  EFI_TPL         OldTpl;\r
+  DHCP6_INSTANCE  *Instance;\r
+  DHCP6_SERVICE   *Service;\r
 \r
   if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -784,9 +791,10 @@ EfiDhcp6RenewRebind (
   //\r
   // The instance has already entered renewing or rebinding state.\r
   //\r
-  if ((Instance->IaCb.Ia->State == Dhcp6Rebinding && RebindRequest) ||\r
-      (Instance->IaCb.Ia->State == Dhcp6Renewing && !RebindRequest)\r
-      ) {\r
+  if (((Instance->IaCb.Ia->State == Dhcp6Rebinding) && RebindRequest) ||\r
+      ((Instance->IaCb.Ia->State == Dhcp6Renewing) && !RebindRequest)\r
+      )\r
+  {\r
     return EFI_ALREADY_STARTED;\r
   }\r
 \r
@@ -809,7 +817,7 @@ EfiDhcp6RenewRebind (
   //\r
   // Register receive callback for the stateful exchange process.\r
   //\r
-  Status = UdpIoRecvDatagram(\r
+  Status = UdpIoRecvDatagram (\r
              Service->UdpIo,\r
              Dhcp6ReceivePacket,\r
              Service,\r
@@ -826,10 +834,10 @@ EfiDhcp6RenewRebind (
   // Poll udp out of the net tpl if synchronous call.\r
   //\r
   if (Instance->Config->IaInfoEvent == NULL) {\r
-\r
     while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
       Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
     }\r
+\r
     return Instance->UdpSts;\r
   }\r
 \r
@@ -841,7 +849,6 @@ ON_ERROR:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Inform that one or more addresses assigned by a server are already\r
   in use by another node.\r
@@ -877,18 +884,18 @@ ON_ERROR:
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp6Decline (\r
-  IN EFI_DHCP6_PROTOCOL        *This,\r
-  IN UINT32                    AddressCount,\r
-  IN EFI_IPv6_ADDRESS          *Addresses\r
+  IN EFI_DHCP6_PROTOCOL  *This,\r
+  IN UINT32              AddressCount,\r
+  IN EFI_IPv6_ADDRESS    *Addresses\r
   )\r
 {\r
-  EFI_STATUS                   Status;\r
-  EFI_TPL                      OldTpl;\r
-  EFI_DHCP6_IA                 *DecIa;\r
-  DHCP6_INSTANCE               *Instance;\r
-  DHCP6_SERVICE                *Service;\r
+  EFI_STATUS      Status;\r
+  EFI_TPL         OldTpl;\r
+  EFI_DHCP6_IA    *DecIa;\r
+  DHCP6_INSTANCE  *Instance;\r
+  DHCP6_SERVICE   *Service;\r
 \r
-  if (This == NULL || AddressCount == 0 || Addresses == NULL) {\r
+  if ((This == NULL) || (AddressCount == 0) || (Addresses == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -913,7 +920,7 @@ EfiDhcp6Decline (
   //\r
   Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);\r
 \r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
@@ -943,7 +950,7 @@ EfiDhcp6Decline (
   //\r
   // Register receive callback for the stateful exchange process.\r
   //\r
-  Status = UdpIoRecvDatagram(\r
+  Status = UdpIoRecvDatagram (\r
              Service->UdpIo,\r
              Dhcp6ReceivePacket,\r
              Service,\r
@@ -961,10 +968,10 @@ EfiDhcp6Decline (
   // Poll udp out of the net tpl if synchronous call.\r
   //\r
   if (Instance->Config->IaInfoEvent == NULL) {\r
-\r
     while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
       Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
     }\r
+\r
     return Instance->UdpSts;\r
   }\r
 \r
@@ -975,12 +982,12 @@ ON_ERROR:
   if (DecIa != NULL) {\r
     FreePool (DecIa);\r
   }\r
+\r
   gBS->RestoreTPL (OldTpl);\r
 \r
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Release one or more addresses associated with the configured Ia\r
   for current instance.\r
@@ -1018,18 +1025,18 @@ ON_ERROR:
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp6Release (\r
-  IN EFI_DHCP6_PROTOCOL        *This,\r
-  IN UINT32                    AddressCount,\r
-  IN EFI_IPv6_ADDRESS          *Addresses\r
+  IN EFI_DHCP6_PROTOCOL  *This,\r
+  IN UINT32              AddressCount,\r
+  IN EFI_IPv6_ADDRESS    *Addresses\r
   )\r
 {\r
-  EFI_STATUS                   Status;\r
-  EFI_TPL                      OldTpl;\r
-  EFI_DHCP6_IA                 *RelIa;\r
-  DHCP6_INSTANCE               *Instance;\r
-  DHCP6_SERVICE                *Service;\r
+  EFI_STATUS      Status;\r
+  EFI_TPL         OldTpl;\r
+  EFI_DHCP6_IA    *RelIa;\r
+  DHCP6_INSTANCE  *Instance;\r
+  DHCP6_SERVICE   *Service;\r
 \r
-  if (This == NULL || (AddressCount != 0 && Addresses == NULL)) {\r
+  if ((This == NULL) || ((AddressCount != 0) && (Addresses == NULL))) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -1054,7 +1061,7 @@ EfiDhcp6Release (
   //\r
   Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);\r
 \r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
@@ -1084,7 +1091,7 @@ EfiDhcp6Release (
   //\r
   // Register receive callback for the stateful exchange process.\r
   //\r
-  Status = UdpIoRecvDatagram(\r
+  Status = UdpIoRecvDatagram (\r
              Service->UdpIo,\r
              Dhcp6ReceivePacket,\r
              Service,\r
@@ -1105,6 +1112,7 @@ EfiDhcp6Release (
     while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
       Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
     }\r
+\r
     return Instance->UdpSts;\r
   }\r
 \r
@@ -1115,12 +1123,12 @@ ON_ERROR:
   if (RelIa != NULL) {\r
     FreePool (RelIa);\r
   }\r
+\r
   gBS->RestoreTPL (OldTpl);\r
 \r
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Parse the option data in the Dhcp6 packet.\r
 \r
@@ -1146,21 +1154,21 @@ EfiDhcp6Parse (
   OUT EFI_DHCP6_PACKET_OPTION  *PacketOptionList[]  OPTIONAL\r
   )\r
 {\r
-  UINT32                       OptCnt;\r
-  UINT32                       OptLen;\r
-  UINT16                       DataLen;\r
-  UINT8                        *Start;\r
-  UINT8                        *End;\r
+  UINT32  OptCnt;\r
+  UINT32  OptLen;\r
+  UINT16  DataLen;\r
+  UINT8   *Start;\r
+  UINT8   *End;\r
 \r
-  if (This == NULL || Packet == NULL || OptionCount == NULL) {\r
+  if ((This == NULL) || (Packet == NULL) || (OptionCount == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (*OptionCount != 0 && PacketOptionList == NULL) {\r
+  if ((*OptionCount != 0) && (PacketOptionList == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (Packet->Length > Packet->Size || Packet->Length < sizeof (EFI_DHCP6_HEADER)) {\r
+  if ((Packet->Length > Packet->Size) || (Packet->Length < sizeof (EFI_DHCP6_HEADER))) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -1185,7 +1193,7 @@ EfiDhcp6Parse (
   // Calculate the number of option in the packet.\r
   //\r
   while (Start < End) {\r
-    DataLen = ((EFI_DHCP6_PACKET_OPTION *) Start)->OpLen;\r
+    DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;\r
     Start  += (NTOHS (DataLen) + 4);\r
     OptCnt++;\r
   }\r
@@ -1208,13 +1216,11 @@ EfiDhcp6Parse (
   Start  = Packet->Dhcp6.Option;\r
 \r
   while (Start < End) {\r
-\r
-    PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *) Start;\r
-    DataLen = ((EFI_DHCP6_PACKET_OPTION *) Start)->OpLen;\r
-    Start  += (NTOHS (DataLen) + 4);\r
+    PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *)Start;\r
+    DataLen                  = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;\r
+    Start                   += (NTOHS (DataLen) + 4);\r
     OptCnt++;\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
-\r