[USBPORT] Removing optional braces.
authorVadim Galyant <vgal@rambler.ru>
Wed, 10 Jan 2018 18:14:22 +0000 (03:14 +0900)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Jan 2018 18:35:59 +0000 (19:35 +0100)
drivers/usb/usbport/usb2.c

index 8158c70..4de18b7 100644 (file)
@@ -199,10 +199,6 @@ USB2_GetHsOverhead(IN PUSB2_TT_ENDPOINT TtEndpoint,
             *OverheadSS = HostDelay + USB2_HS_SS_INTERRUPT_IN_OVERHEAD;
             *OverheadCS = HostDelay + USB2_HS_CS_INTERRUPT_IN_OVERHEAD;
         }
             *OverheadSS = HostDelay + USB2_HS_SS_INTERRUPT_IN_OVERHEAD;
             *OverheadCS = HostDelay + USB2_HS_CS_INTERRUPT_IN_OVERHEAD;
         }
-
-        //DPRINT("USB2_GetHsOverhead: *OverheadSS - %X, *OverheadCS - %X\n",
-        //       *OverheadSS,
-        //       *OverheadCS);
     }
 }
 
     }
 }
 
@@ -536,9 +532,7 @@ USB2_DeallocateHS(IN PUSB2_TT_ENDPOINT TtEndpoint,
     uframe = TtEndpoint->StartMicroframe;
 
     if (TtEndpoint->StartMicroframe == 0xFF)
     uframe = TtEndpoint->StartMicroframe;
 
     if (TtEndpoint->StartMicroframe == 0xFF)
-    {
         USB2_GetPrevMicroFrame(&frame, &uframe);
         USB2_GetPrevMicroFrame(&frame, &uframe);
-    }
 
     for (ix = 0; ix < TtEndpoint->Nums.NumStarts; ix++)
     {
 
     for (ix = 0; ix < TtEndpoint->Nums.NumStarts; ix++)
     {
@@ -566,9 +560,7 @@ USB2_DeallocateHS(IN PUSB2_TT_ENDPOINT TtEndpoint,
         uframe = TtEndpoint->StartMicroframe;
 
         if (TtEndpoint->StartMicroframe == 0xFF)
         uframe = TtEndpoint->StartMicroframe;
 
         if (TtEndpoint->StartMicroframe == 0xFF)
-        {
             USB2_GetPrevMicroFrame(&frame, &uframe);
             USB2_GetPrevMicroFrame(&frame, &uframe);
-        }
 
         DataTime = 0;
 
 
         DataTime = 0;
 
@@ -577,13 +569,9 @@ USB2_DeallocateHS(IN PUSB2_TT_ENDPOINT TtEndpoint,
             DataSize = PktSizeBitStuff - DataTime;
 
             if (DataSize <= USB2_FS_RAW_BYTES_IN_MICROFRAME)
             DataSize = PktSizeBitStuff - DataTime;
 
             if (DataSize <= USB2_FS_RAW_BYTES_IN_MICROFRAME)
-            {
                 CurrentDataTime = PktSizeBitStuff - DataTime;
                 CurrentDataTime = PktSizeBitStuff - DataTime;
-            }
             else
             else
-            {
                 CurrentDataTime = USB2_FS_RAW_BYTES_IN_MICROFRAME;
                 CurrentDataTime = USB2_FS_RAW_BYTES_IN_MICROFRAME;
-            }
 
             HcExtension->TimeUsed[frame][uframe] -= CurrentDataTime;
             USB2_IncMicroFrame(&frame, &uframe);
 
             HcExtension->TimeUsed[frame][uframe] -= CurrentDataTime;
             USB2_IncMicroFrame(&frame, &uframe);
@@ -598,13 +586,9 @@ USB2_DeallocateHS(IN PUSB2_TT_ENDPOINT TtEndpoint,
         for (ix = 0; ix < TtEndpoint->Nums.NumCompletes; ix++)
         {
             if (PktSizeBitStuff >= USB2_FS_RAW_BYTES_IN_MICROFRAME)
         for (ix = 0; ix < TtEndpoint->Nums.NumCompletes; ix++)
         {
             if (PktSizeBitStuff >= USB2_FS_RAW_BYTES_IN_MICROFRAME)
-            {
                 CurrentDataTime = USB2_FS_RAW_BYTES_IN_MICROFRAME;
                 CurrentDataTime = USB2_FS_RAW_BYTES_IN_MICROFRAME;
-            }
             else
             else
-            {
                 CurrentDataTime = PktSizeBitStuff;
                 CurrentDataTime = PktSizeBitStuff;
-            }
 
             Tt->TimeCS[frame][uframe] -= CurrentDataTime;
 
 
             Tt->TimeCS[frame][uframe] -= CurrentDataTime;
 
@@ -727,13 +711,9 @@ USB2_CommonFrames(IN PUSB2_TT_ENDPOINT NextTtEndpoint,
     }
 
     if (NextTtEndpoint->ActualPeriod < TtEndpoint->ActualPeriod)
     }
 
     if (NextTtEndpoint->ActualPeriod < TtEndpoint->ActualPeriod)
-    {
         Frame = TtEndpoint->StartFrame % TtEndpoint->ActualPeriod;
         Frame = TtEndpoint->StartFrame % TtEndpoint->ActualPeriod;
-    }
     else
     else
-    {
         Frame = NextTtEndpoint->StartFrame % TtEndpoint->ActualPeriod;
         Frame = NextTtEndpoint->StartFrame % TtEndpoint->ActualPeriod;
-    }
 
     return (Frame == TtEndpoint->StartFrame);
 }
 
     return (Frame == TtEndpoint->StartFrame);
 }
@@ -821,9 +801,7 @@ USB2_GetCMASK(IN PUSB2_TT_ENDPOINT TtEndpoint)
     Direction = TtEndpoint->TtEndpointParams.Direction;
 
     if (DeviceSpeed == UsbHighSpeed)
     Direction = TtEndpoint->TtEndpointParams.Direction;
 
     if (DeviceSpeed == UsbHighSpeed)
-    {
         return 0;
         return 0;
-    }
 
     if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT)
     {
 
     if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT)
     {
@@ -837,9 +815,7 @@ USB2_GetCMASK(IN PUSB2_TT_ENDPOINT TtEndpoint)
     else
     {
         if (Direction == USBPORT_TRANSFER_DIRECTION_OUT)
     else
     {
         if (Direction == USBPORT_TRANSFER_DIRECTION_OUT)
-        {
             return 0;
             return 0;
-        }
 
         USB2_ConvertFrame(TtEndpoint->StartFrame,
                           TtEndpoint->StartMicroframe,
 
         USB2_ConvertFrame(TtEndpoint->StartFrame,
                           TtEndpoint->StartMicroframe,
@@ -856,9 +832,7 @@ USB2_GetCMASK(IN PUSB2_TT_ENDPOINT TtEndpoint)
             NumCompletes--;
 
             if (!NumCompletes)
             NumCompletes--;
 
             if (!NumCompletes)
-            {
                 return MaskCS;
                 return MaskCS;
-            }
         }
 
         for (; NumCompletes; NumCompletes--)
         }
 
         for (; NumCompletes; NumCompletes--)
@@ -926,8 +900,8 @@ USB2_RebalanceEndpoint(IN PDEVICE_OBJECT FdoDevice,
 
         if (Endpoint->EndpointProperties.Period != NewPeriod)
         {
 
         if (Endpoint->EndpointProperties.Period != NewPeriod)
         {
+            ASSERT(Endpoint->EndpointProperties.Period);
             Factor = USB2_FRAMES / Endpoint->EndpointProperties.Period;
             Factor = USB2_FRAMES / Endpoint->EndpointProperties.Period;
-            ASSERT(Factor);
 
             for (ix = 0; ix < Factor; ix++)
             {
 
             for (ix = 0; ix < Factor; ix++)
             {
@@ -940,8 +914,8 @@ USB2_RebalanceEndpoint(IN PDEVICE_OBJECT FdoDevice,
             Endpoint->EndpointProperties.ScheduleOffset = ScheduleOffset;
             Endpoint->EndpointProperties.UsbBandwidth = EndpointBandwidth;
 
             Endpoint->EndpointProperties.ScheduleOffset = ScheduleOffset;
             Endpoint->EndpointProperties.UsbBandwidth = EndpointBandwidth;
 
+            ASSERT(NewPeriod);
             Factor = USB2_FRAMES / NewPeriod;
             Factor = USB2_FRAMES / NewPeriod;
-            ASSERT(Factor);
 
             for (ix = 0; ix < Factor; ix++)
             {
 
             for (ix = 0; ix < Factor; ix++)
             {
@@ -1135,13 +1109,9 @@ USB2_DeallocateEndpointBudget(IN PUSB2_TT_ENDPOINT TtEndpoint,
         }
 
         if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT)
         }
 
         if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT)
-        {
             endpoint = Tt->FrameBudget[frame].IntEndpoint;
             endpoint = Tt->FrameBudget[frame].IntEndpoint;
-        }
         else
         else
-        {
             endpoint = Tt->FrameBudget[frame].IsoEndpoint;
             endpoint = Tt->FrameBudget[frame].IsoEndpoint;
-        }
 
         nextEndpoint = endpoint->NextTtEndpoint;
 
 
         nextEndpoint = endpoint->NextTtEndpoint;
 
@@ -1481,13 +1451,9 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint,
     }
 
     if (Speed == UsbLowSpeed)
     }
 
     if (Speed == UsbLowSpeed)
-    {
         TtEndpoint->CalcBusTime = TtEndpoint->MaxPacketSize * 8 + Overhead;
         TtEndpoint->CalcBusTime = TtEndpoint->MaxPacketSize * 8 + Overhead;
-    }
     else
     else
-    {
         TtEndpoint->CalcBusTime = TtEndpoint->MaxPacketSize + Overhead;
         TtEndpoint->CalcBusTime = TtEndpoint->MaxPacketSize + Overhead;
-    }
 
     LatestStart = USB2_HUB_DELAY + USB2_FS_SOF_TIME;
 
 
     LatestStart = USB2_HUB_DELAY + USB2_FS_SOF_TIME;
 
@@ -1514,9 +1480,7 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint,
              nextEndpoint = nextEndpoint->NextTtEndpoint)
         {
             if (USB2_CheckTtEndpointInsert(nextEndpoint, TtEndpoint))
              nextEndpoint = nextEndpoint->NextTtEndpoint)
         {
             if (USB2_CheckTtEndpointInsert(nextEndpoint, TtEndpoint))
-            {
                 break;
                 break;
-            }
 
             prevEndpoint = nextEndpoint;
         }
 
             prevEndpoint = nextEndpoint;
         }
@@ -1526,8 +1490,7 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint,
                                       prevEndpoint,
                                       frame);
 
                                       prevEndpoint,
                                       frame);
 
-        if (StartTime > LatestStart)
-            LatestStart = StartTime;
+        LatestStart = max(LatestStart, StartTime);
     }
 
     TtEndpoint->StartTime = LatestStart;
     }
 
     TtEndpoint->StartTime = LatestStart;
@@ -2026,8 +1989,8 @@ USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,
         ScheduleOffset = Endpoint->TtEndpoint->StartFrame;
         EndpointProperties->ScheduleOffset = ScheduleOffset;
 
         ScheduleOffset = Endpoint->TtEndpoint->StartFrame;
         EndpointProperties->ScheduleOffset = ScheduleOffset;
 
+        ASSERT(ActualPeriod);
         Factor = USB2_FRAMES / ActualPeriod;
         Factor = USB2_FRAMES / ActualPeriod;
-        ASSERT(Factor);
 
         n = ScheduleOffset * Factor;
 
 
         n = ScheduleOffset * Factor;
 
@@ -2183,9 +2146,7 @@ USBPORT_FreeBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,
     USB2_Rebalance(FdoDevice, &RebalanceList);
 
     if (!TtExtension)
     USB2_Rebalance(FdoDevice, &RebalanceList);
 
     if (!TtExtension)
-    {
         return;
         return;
-    }
 
     for (ix = 0; ix < USB2_FRAMES; ix++)
     {
 
     for (ix = 0; ix < USB2_FRAMES; ix++)
     {