[edk2-devel] [`edk2-devel][PATCH] UefiPayloadPkg: Use dummy constructor for PlatformHookLib

Guo Dong posted 1 patch 2 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20210925035932.81-1-guo.dong@intel.com
UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c   | 17 +++++++++++++++++
UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf |  2 +-
2 files changed, 18 insertions(+), 1 deletion(-)
[edk2-devel] [`edk2-devel][PATCH] UefiPayloadPkg: Use dummy constructor for PlatformHookLib
Posted by Guo Dong 2 years, 7 months ago
From: Guo Dong <guo.dong@intel.com>

The Library constructor is only used for library dependency.
So use a dummy function to make it clear instead of using an
actual function.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
---
 UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c   | 17 +++++++++++++++++
 UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c
index bd433bdbe0..004fcd8b7c 100644
--- a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c
+++ b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c
@@ -13,6 +13,23 @@
 #include <Library/PcdLib.h>
 #include <Library/HobLib.h>
 
+
+/** Library Constructor
+
+  @retval RETURN_SUCCESS  Success.
+**/
+EFI_STATUS
+EFIAPI
+PlatformHookSerialPortConstructor (
+  VOID
+  )
+{
+  // Nothing to do here. This constructor is added to
+  // enable the chain of constructor invocation for
+  // dependent libraries.
+  return RETURN_SUCCESS;
+}
+
 /**
   Performs platform specific initialization required for the CPU to access
   the hardware associated with a SerialPortLib instance.  This function does
diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf
index 2dfd8b1216..7ac6bfa1b1 100644
--- a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf
+++ b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf
@@ -14,7 +14,7 @@
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = PlatformHookLib
-  CONSTRUCTOR                    = PlatformHookSerialPortInitialize
+  CONSTRUCTOR                    = PlatformHookSerialPortConstructor
 
 [Sources]
   PlatformHookLib.c
-- 
2.32.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81117): https://edk2.groups.io/g/devel/message/81117
Mute This Topic: https://groups.io/mt/85855021/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [`edk2-devel][PATCH] UefiPayloadPkg: Use dummy constructor for PlatformHookLib
Posted by Ni, Ray 2 years, 7 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

-----Original Message-----
From: Dong, Guo <guo.dong@intel.com> 
Sent: Saturday, September 25, 2021 12:00 PM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@intel.com>
Subject: [`edk2-devel][PATCH] UefiPayloadPkg: Use dummy constructor for PlatformHookLib

From: Guo Dong <guo.dong@intel.com>

The Library constructor is only used for library dependency.
So use a dummy function to make it clear instead of using an
actual function.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
---
 UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c   | 17 +++++++++++++++++
 UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c
index bd433bdbe0..004fcd8b7c 100644
--- a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c
+++ b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.c
@@ -13,6 +13,23 @@
 #include <Library/PcdLib.h>

 #include <Library/HobLib.h>

 

+

+/** Library Constructor

+

+  @retval RETURN_SUCCESS  Success.

+**/

+EFI_STATUS

+EFIAPI

+PlatformHookSerialPortConstructor (

+  VOID

+  )

+{

+  // Nothing to do here. This constructor is added to

+  // enable the chain of constructor invocation for

+  // dependent libraries.

+  return RETURN_SUCCESS;

+}

+

 /**

   Performs platform specific initialization required for the CPU to access

   the hardware associated with a SerialPortLib instance.  This function does

diff --git a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf
index 2dfd8b1216..7ac6bfa1b1 100644
--- a/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf
+++ b/UefiPayloadPkg/Library/UniversalPayloadPlatformHookLib/PlatformHookLib.inf
@@ -14,7 +14,7 @@
   MODULE_TYPE                    = BASE

   VERSION_STRING                 = 1.0

   LIBRARY_CLASS                  = PlatformHookLib

-  CONSTRUCTOR                    = PlatformHookSerialPortInitialize

+  CONSTRUCTOR                    = PlatformHookSerialPortConstructor

 

 [Sources]

   PlatformHookLib.c

-- 
2.32.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81143): https://edk2.groups.io/g/devel/message/81143
Mute This Topic: https://groups.io/mt/85855021/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-