]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Bus / I2c / I2cDxe / I2cBus.c
index cad5ad7d44a012c7dfbacb38fa7b222706628fe6..99d920849083e9fc6b2cbd8287ca92feb491cc7a 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
-  This file implements I2C IO Protocol which enables the user to manipulate a single \r
+  This file implements I2C IO Protocol which enables the user to manipulate a single\r
   I2C device independent of the host controller and I2C design.\r
 \r
-  Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -76,7 +76,7 @@ VENDOR_DEVICE_PATH gVendorDevicePathTemplate = {
 };\r
 \r
 //\r
-// Driver name table \r
+// Driver name table\r
 //\r
 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mI2cBusDriverNameTable[] = {\r
   { "eng;en", (CHAR16 *) L"I2C Bus Driver" },\r
@@ -241,12 +241,12 @@ I2cBusComponentNameGetControllerName (
 /**\r
   Check if the child of I2C controller has been created.\r
 \r
-  @param[in] This                         A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.   \r
+  @param[in] This                         A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
   @param[in] Controller                   I2C controller handle.\r
   @param[in] RemainingDevicePath          A pointer to the remaining portion of a device path.\r
   @param[in] RemainingHasControllerNode   Indicate if RemainingDevicePath contains CONTROLLER_DEVICE_PATH.\r
   @param[in] RemainingControllerNumber    Controller number in CONTROLLER_DEVICE_PATH.\r
-  \r
+\r
   @retval EFI_SUCCESS                     The child of I2C controller is not created.\r
   @retval Others                          The child of I2C controller has been created or other errors happen.\r
 \r
@@ -266,11 +266,11 @@ CheckRemainingDevicePath (
   UINTN                                   EntryCount;\r
   UINTN                                   Index;\r
   BOOLEAN                                 SystemHasControllerNode;\r
-  UINT32                                  SystemControllerNumber;  \r
+  UINT32                                  SystemControllerNumber;\r
 \r
   SystemHasControllerNode = FALSE;\r
   SystemControllerNumber    = 0;\r
-  \r
+\r
   Status = gBS->OpenProtocolInformation (\r
                   Controller,\r
                   &gEfiI2cHostProtocolGuid,\r
@@ -280,7 +280,7 @@ CheckRemainingDevicePath (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   for (Index = 0; Index < EntryCount; Index++) {\r
     if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {\r
       Status = gBS->OpenProtocol (\r
@@ -294,7 +294,7 @@ CheckRemainingDevicePath (
       if (!EFI_ERROR (Status)) {\r
         //\r
         // Find vendor device path node and compare\r
-        //    \r
+        //\r
         while (!IsDevicePathEnd (SystemDevicePath)) {\r
           if ((DevicePathType (SystemDevicePath) == HARDWARE_DEVICE_PATH) &&\r
               (DevicePathSubType (SystemDevicePath) == HW_VENDOR_DP)) {\r
@@ -469,7 +469,7 @@ I2cBusDriverSupported (
   //\r
   // Determine if the I2C Host Protocol is available\r
   //\r
-  Status = gBS->OpenProtocol ( \r
+  Status = gBS->OpenProtocol (\r
                   Controller,\r
                   &gEfiI2cHostProtocolGuid,\r
                   (VOID **) &I2cHost,\r
@@ -489,7 +489,7 @@ I2cBusDriverSupported (
 \r
 \r
   if (Status == EFI_ALREADY_STARTED) {\r
-    if ((RemainingDevicePath == NULL) || \r
+    if ((RemainingDevicePath == NULL) ||\r
         ((RemainingDevicePath != NULL) && IsDevicePathEnd (RemainingDevicePath))) {\r
       //\r
       // If RemainingDevicePath is NULL or is the End of Device Path Node, return EFI_SUCCESS.\r
@@ -498,7 +498,7 @@ I2cBusDriverSupported (
     } else {\r
       //\r
       // Test if the child with the RemainingDevicePath has already been created.\r
-      //    \r
+      //\r
       Status = CheckRemainingDevicePath (\r
                  This,\r
                  Controller,\r
@@ -647,7 +647,7 @@ I2cBusDriverStart (
       Status = EFI_OUT_OF_RESOURCES;\r
       goto Error;\r
     }\r
-    \r
+\r
     /*\r
        +----------------+\r
     .->| I2C_BUS_CONTEXT|<----- This file Protocol (gEfiCallerIdGuid) installed on I2C Controller handle\r
@@ -660,7 +660,7 @@ I2cBusDriverStart (
        | I2C IO Protocol Structure  | <----- I2C IO Protocol\r
        |                            |\r
        +----------------------------+\r
-    \r
+\r
     */\r
     I2cBusContext->I2cHost      = I2cHost;\r
     I2cBusContext->I2cEnumerate = I2cEnumerate;\r
@@ -672,9 +672,9 @@ I2cBusDriverStart (
     // Parent controller device path used to create children device path\r
     //\r
     I2cBusContext->ParentDevicePath = ParentDevicePath;\r
-    \r
+\r
     I2cBusContext->DriverBindingHandle = This->DriverBindingHandle;\r
-    \r
+\r
     Status = gBS->InstallMultipleProtocolInterfaces (\r
                     &Controller,\r
                     &gEfiCallerIdGuid,\r
@@ -698,7 +698,7 @@ Error:
   if (EFI_ERROR (Status)) {\r
     DEBUG ((EFI_D_ERROR, "I2cBus: Start() function failed, Status = %r\n", Status));\r
     if (ParentDevicePath != NULL) {\r
-      gBS->CloseProtocol ( \r
+      gBS->CloseProtocol (\r
             Controller,\r
             &gEfiDevicePathProtocolGuid,\r
             This->DriverBindingHandle,\r
@@ -716,14 +716,14 @@ Error:
     }\r
 \r
     if (I2cEnumerate != NULL) {\r
-      gBS->CloseProtocol ( \r
+      gBS->CloseProtocol (\r
             Controller,\r
             &gEfiI2cEnumerateProtocolGuid,\r
             This->DriverBindingHandle,\r
             Controller\r
             );\r
     }\r
-    \r
+\r
     if (I2cBusContext != NULL) {\r
       Status = gBS->UninstallMultipleProtocolInterfaces (\r
                       &Controller,\r
@@ -783,7 +783,7 @@ I2cBusDriverStop (
   UINTN                       Index;\r
 \r
   if (NumberOfChildren == 0) {\r
-    gBS->CloseProtocol ( \r
+    gBS->CloseProtocol (\r
           Controller,\r
           &gEfiDevicePathProtocolGuid,\r
           This->DriverBindingHandle,\r
@@ -880,14 +880,14 @@ RegisterI2cDevice (
   // Default DeviceIndex\r
   //\r
   RemainingPathDeviceIndex = 0;\r
-  \r
+\r
   //\r
   // Determine the controller number in Controller Node Device Path when RemainingDevicePath is not NULL.\r
   //\r
   if (RemainingDevicePath != NULL) {\r
     //\r
     // Check if there is a controller node appended after vendor node\r
-    //    \r
+    //\r
     DevPathNode = NextDevicePathNode (RemainingDevicePath);\r
     if ((DevicePathType (DevPathNode) == HARDWARE_DEVICE_PATH) &&\r
         (DevicePathSubType(DevPathNode) == HW_CONTROLLER_DP)) {\r
@@ -965,7 +965,7 @@ RegisterI2cDevice (
       //\r
       if ((!CompareGuid (&((VENDOR_DEVICE_PATH *)RemainingDevicePath)->Guid, Device->DeviceGuid)) ||\r
           (RemainingPathDeviceIndex != Device->DeviceIndex)) {\r
-        continue; \r
+        continue;\r
       }\r
     }\r
 \r
@@ -1015,7 +1015,7 @@ RegisterI2cDevice (
       ReleaseI2cDeviceContext (I2cDeviceContext);\r
       continue;\r
     }\r
-    \r
+\r
     //\r
     // Create the child handle\r
     //\r
@@ -1040,7 +1040,7 @@ RegisterI2cDevice (
       // Free resources for this I2C device\r
       //\r
       ReleaseI2cDeviceContext (I2cDeviceContext);\r
-      continue;      \r
+      continue;\r
     }\r
 \r
     if (RemainingDevicePath != NULL) {\r
@@ -1074,7 +1074,7 @@ RegisterI2cDevice (
 \r
   The upper layer driver writer provides the following to the platform\r
   vendor:\r
-  \r
+\r
   1.  Vendor specific GUID for the I2C part\r
   2.  Guidance on proper construction of the slave address array when the\r
       I2C device uses more than one slave address.  The I2C bus protocol\r
@@ -1192,7 +1192,7 @@ ReleaseI2cDeviceContext (
   if (I2cDeviceContext == NULL) {\r
     return;\r
   }\r
-  \r
+\r
   if (I2cDeviceContext->DevicePath != NULL) {\r
     FreePool (I2cDeviceContext->DevicePath);\r
   }\r
@@ -1282,12 +1282,12 @@ UnRegisterI2cDevice (
           );\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Free resources for this I2C device\r
   //\r
   ReleaseI2cDeviceContext (I2cDeviceContext);\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -1310,12 +1310,12 @@ I2cBusDevicePathAppend (
   )\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *PreviousDevicePath;\r
-  \r
+\r
   PreviousDevicePath = NULL;\r
 \r
   //\r
   // Build vendor device path\r
-  //  \r
+  //\r
   CopyMem (&gVendorDevicePathTemplate.Guid, I2cDeviceContext->I2cDevice->DeviceGuid, sizeof (EFI_GUID));\r
   I2cDeviceContext->DevicePath                    = AppendDevicePathNode (\r
                                                       I2cDeviceContext->I2cBusContext->ParentDevicePath,\r
@@ -1325,13 +1325,13 @@ I2cBusDevicePathAppend (
   if (I2cDeviceContext->DevicePath == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   if ((BuildControllerNode) && (I2cDeviceContext->DevicePath != NULL)) {\r
     //\r
     // Build the final I2C device path with controller node\r
     //\r
     PreviousDevicePath = I2cDeviceContext->DevicePath;\r
-    gControllerDevicePathTemplate.ControllerNumber = I2cDeviceContext->I2cDevice->DeviceIndex; \r
+    gControllerDevicePathTemplate.ControllerNumber = I2cDeviceContext->I2cDevice->DeviceIndex;\r
     I2cDeviceContext->DevicePath          = AppendDevicePathNode (\r
                                               I2cDeviceContext->DevicePath,\r
                                               (EFI_DEVICE_PATH_PROTOCOL *) &gControllerDevicePathTemplate\r
@@ -1379,7 +1379,7 @@ InitializeI2cBus(
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  \r
+\r
   return Status;\r
 }\r
 \r