Re: [edk2-devel] [PATCH 28/43] OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections

2021-05-27 Thread Philippe Mathieu-Daudé
On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> - In every C file, list every necessary public #include individually, with
>   an example identifier that's actually consumed.
> 
> - Place all public #includes first, all module-private #includes second.
>   Separate them with a single empty line. Keep each section sorted in
>   itself.
> 
> - Sort all sections in the INF file, except [Defines].
> 
> - Add unlisted lib classes.
> 
> - Remove unnecessary #include directives, add unlisted #include
>   directives.
> 
> Cc: Anthony Perard 
> Cc: Ard Biesheuvel 
> Cc: Jordan Justen 
> Cc: Julien Grall 
> Cc: Philippe Mathieu-Daudé 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek 
> ---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |  7 +++---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 22 +++---
>  OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 24 
> +---
>  3 files changed, 23 insertions(+), 30 deletions(-)

Reviewed-by: Philippe Mathieu-Daude 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75770): https://edk2.groups.io/g/devel/message/75770
Mute This Topic: https://groups.io/mt/83110898/21656
Mute #includes:https://edk2.groups.io/g/devel/mutehashtag/includes
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 28/43] OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections

2021-05-26 Thread Laszlo Ersek
- In every C file, list every necessary public #include individually, with
  an example identifier that's actually consumed.

- Place all public #includes first, all module-private #includes second.
  Separate them with a single empty line. Keep each section sorted in
  itself.

- Sort all sections in the INF file, except [Defines].

- Add unlisted lib classes.

- Remove unnecessary #include directives, add unlisted #include
  directives.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Philippe Mathieu-Daudé 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |  7 +++---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 22 +++---
 OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 24 +---
 3 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index 4610a0c1490b..622780888472 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -22,32 +22,33 @@ [Defines]
 # tools.
 #
 #  VALID_ARCHITECTURES   = IA32 X64 EBC
 #
 
 [Sources]
+  PciHostBridge.h
   PciHostBridgeLib.c
   XenSupport.c
-  PciHostBridge.h
 
 [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
+  BaseLib
   BaseMemoryLib
   DebugLib
   MemoryAllocationLib
   PcdLib
   PciHostBridgeUtilityLib
   PciLib
 
 [Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 7d9fb0fb293a..6db91fb7e20c 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -4,29 +4,23 @@
   Copyright (C) 2016, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
-#include 
+#include  // PCI_MAX_BUS
+#include   // INTEL_Q35_MCH_DEVIC...
+#include // ZeroMem()
+#include// PcdGet64()
+#include  // PCI_ROOT_BRIDGE_APE...
+#include   // PciHostBridgeUtilit...
+#include  // EFI_PCI_HOST_BRIDGE...
+#include  // EFI_PCI_ATTRIBUTE_I...
 
-#include 
-#include 
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include "PciHostBridge.h"
 
-
 STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };
 
 
 /**
   Return all the root bridge instances in an array.
 
diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c 
b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
index 9ef39f01821b..07c498dd0ea2 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
@@ -3,27 +3,25 @@
 
   Copyright (c) 2016, Intel Corporation. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
-#include 
 
-#include 
-#include 
+#include // EFI_PCI_COMMAND_IO_SPACE
+#include  // INTEL_Q35_MCH_DEVICE_ID
+#include  // DisableInterrupts()
+#include// ZeroMem()
+#include // ASSERT()
+#include  // ReallocatePool()
+#include   // PcdGet16()
+#include // PCI_ROOT_BRIDGE_APERTURE
+#include  // PciHostBridgeUtilityInitRoot...
+#include   // PciRead32()
+#include // EFI_PCI_ATTRIBUTE_ISA_IO
 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include "PciHostBridge.h"
 
 STATIC
 VOID
 PcatPciRootBridgeBarExisted (
   IN  UINTN  Address,
-- 
2.19.1.3.g30247aa5d201




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75699): https://edk2.groups.io/g/devel/message/75699
Mute This Topic: https://groups.io/mt/83110898/21656
Mute #includes:https://edk2.groups.io/g/devel/mutehashtag/includes
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-