REF: https://bugzilla.tianocore.org/show_bug.cgi?id=298

Then this event empty function can be used to remove
the duplication in drivers and other libraries.

Cc: Liming Gao <liming....@intel.com>
Cc: Michael Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.z...@intel.com>
---
 MdePkg/Include/Library/UefiLib.h         | 18 +++++++++++++-
 MdePkg/Library/UefiLib/UefiLib.c         | 42 +++++++++++++++-----------------
 MdePkg/Library/UefiLib/UefiLibInternal.h | 20 +--------------
 MdePkg/Library/UefiLib/UefiNotTiano.c    | 10 ++++----
 4 files changed, 43 insertions(+), 47 deletions(-)

diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h
index e8a6b8498e65..0b14792a0a7f 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -12,7 +12,7 @@
   of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is
   defined, then debug and assert related macros wrapped by it are the NULL 
implementations.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -241,6 +241,22 @@ EfiEventGroupSignal (
   IN CONST EFI_GUID *EventGroup
   );
 
+/**
+  An empty function that can be used as NotifyFunction parameter of
+  CreateEvent() or CreateEventEx().
+
+  @param Event              Event whose notification function is being invoked.
+  @param Context            The pointer to the notification function's context,
+                            which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+EfiEventEmptyFunction (
+  IN EFI_EVENT              Event,
+  IN VOID                   *Context
+  );
+
 /** 
   Returns the current TPL.
 
diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index 96d375fb6f2e..a7eee01240c1 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -5,7 +5,7 @@
   EFI Driver Model related protocols, manage Unicode string tables for UEFI 
Drivers, 
   and print messages on the console output and standard error devices.
 
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -332,7 +332,7 @@ EfiEventGroupSignal (
   Status = gBS->CreateEventEx (
                   EVT_NOTIFY_SIGNAL,
                   TPL_CALLBACK,
-                  InternalEmptyFunction,
+                  EfiEventEmptyFunction,
                   NULL,
                   EventGroup,
                   &Event
@@ -347,6 +347,24 @@ EfiEventGroupSignal (
   return Status;
 }
 
+/**
+  An empty function that can be used as NotifyFunction parameter of
+  CreateEvent() or CreateEventEx().
+
+  @param Event              Event whose notification function is being invoked.
+  @param Context            The pointer to the notification function's context,
+                            which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+EfiEventEmptyFunction (
+  IN EFI_EVENT              Event,
+  IN VOID                   *Context
+  )
+{
+}
+
 /** 
   Returns the current TPL.
 
@@ -1587,23 +1605,3 @@ GetBestLanguage (
   //
   return NULL;
 }
-
-/**
-  An empty function to pass error checking of CreateEventEx ().
-
-  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
-  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
-
-  @param  Event                 Event whose notification function is being 
invoked.
-  @param  Context               The pointer to the notification function's 
context,
-                                which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-InternalEmptyFunction (
-  IN EFI_EVENT                Event,
-  IN VOID                     *Context
-  )
-{
-}
diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h 
b/MdePkg/Library/UefiLib/UefiLibInternal.h
index 2311f27f1e6d..412ad1b89c9d 100644
--- a/MdePkg/Library/UefiLib/UefiLibInternal.h
+++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
@@ -1,7 +1,7 @@
 /** @file
   Internal include file for UefiLib.
 
-  Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
    This program and the accompanying materials
    are licensed and made available under the terms and conditions of the BSD 
License
    which accompanies this distribution. The full text of the license may be 
found at
@@ -41,22 +41,4 @@
 #include <Library/PrintLib.h>
 #include <Library/DevicePathLib.h>
 
-/**
-  An empty function to pass error checking of CreateEventEx ().
-
-  This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error
-  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
-
-  @param  Event                 Event whose notification function is being 
invoked.
-  @param  Context               The pointer to the notification function's 
context,
-                                which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-InternalEmptyFunction (
-  IN EFI_EVENT                Event,
-  IN VOID                     *Context
-  );
-
 #endif
diff --git a/MdePkg/Library/UefiLib/UefiNotTiano.c 
b/MdePkg/Library/UefiLib/UefiNotTiano.c
index 46fa737c0fd3..fc3a6ea74a0e 100644
--- a/MdePkg/Library/UefiLib/UefiNotTiano.c
+++ b/MdePkg/Library/UefiLib/UefiNotTiano.c
@@ -6,7 +6,7 @@
   (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) way. This module is a DXE driver as
   it contains DXE enum extensions for EFI event services.
 
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -46,7 +46,7 @@ EfiCreateEventLegacyBoot (
 {
   return EfiCreateEventLegacyBootEx (
            TPL_CALLBACK,
-           InternalEmptyFunction,
+           EfiEventEmptyFunction,
            NULL,
            LegacyBootEvent
            );
@@ -99,7 +99,7 @@ EfiCreateEventLegacyBootEx (
       // CreateEventEx will check NotifyFunction is NULL or not and return 
error.
       // Use dummy routine for the case NotifyFunction is NULL.
       //
-      WorkerNotifyFunction = InternalEmptyFunction;
+      WorkerNotifyFunction = EfiEventEmptyFunction;
     } else {
       WorkerNotifyFunction = NotifyFunction;
     }
@@ -141,7 +141,7 @@ EfiCreateEventReadyToBoot (
 {
   return EfiCreateEventReadyToBootEx (
            TPL_CALLBACK,
-           InternalEmptyFunction,
+           EfiEventEmptyFunction,
            NULL,
            ReadyToBootEvent
            );
@@ -194,7 +194,7 @@ EfiCreateEventReadyToBootEx (
       // CreateEventEx will check NotifyFunction is NULL or not and return 
error.
       // Use dummy routine for the case NotifyFunction is NULL.
       //
-      WorkerNotifyFunction = InternalEmptyFunction;
+      WorkerNotifyFunction = EfiEventEmptyFunction;
     } else {
       WorkerNotifyFunction = NotifyFunction;
     }
-- 
2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to