diff mbox

[edk2,1/5] ArmVirtPkg/QemuFwCfgLib: remove superfluous InternalQemuFwCfgIsAvailable()

Message ID 20161201175633.2538-2-lersek@redhat.com
State Superseded
Headers show

Commit Message

Laszlo Ersek Dec. 1, 2016, 5:56 p.m. UTC
InternalQemuFwCfgIsAvailable() is an API that is incorrectly exposed by
the "OvmfPkg/Include/Library/QemuFwCfgLib.h" library class header; the API
is meant to be used internally to library instances (if it's needed at
all). ArmVirtPkg's instance has no use for it actually, so simplify the
code and remove the function definition.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 31 ++++----------------
 1 file changed, 6 insertions(+), 25 deletions(-)

-- 
2.9.2


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

Comments

Leif Lindholm Dec. 2, 2016, 10:58 a.m. UTC | #1
On Thu, Dec 01, 2016 at 06:56:29PM +0100, Laszlo Ersek wrote:
> InternalQemuFwCfgIsAvailable() is an API that is incorrectly exposed by

> the "OvmfPkg/Include/Library/QemuFwCfgLib.h" library class header; the API

> is meant to be used internally to library instances (if it's needed at

> all). ArmVirtPkg's instance has no use for it actually, so simplify the

> code and remove the function definition.

> 

> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Laszlo Ersek <lersek@redhat.com>


Looks sane to me.
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> ---

>  ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 31 ++++----------------

>  1 file changed, 6 insertions(+), 25 deletions(-)

> 

> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c

> index 8ecbe3fb5fe6..2fd8d9050566 100644

> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c

> +++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c

> @@ -75,25 +75,6 @@ typedef struct {

>  

>  

>  /**

> -  Returns a boolean indicating if the firmware configuration interface is

> -  available for library-internal purposes.

> -

> -  This function never changes fw_cfg state.

> -

> -  @retval TRUE   The interface is available internally.

> -  @retval FALSE  The interface is not available internally.

> -**/

> -BOOLEAN

> -EFIAPI

> -InternalQemuFwCfgIsAvailable (

> -  VOID

> -  )

> -{

> -  return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0);

> -}

> -

> -

> -/**

>    Returns a boolean indicating if the firmware configuration interface

>    is available or not.

>  

> @@ -109,7 +90,7 @@ QemuFwCfgIsAvailable (

>    VOID

>    )

>  {

> -  return InternalQemuFwCfgIsAvailable ();

> +  return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0);

>  }

>  

>  

> @@ -187,7 +168,7 @@ QemuFwCfgInitialize (

>      FwCfgDmaAddress = 0;

>    }

>  

> -  if (InternalQemuFwCfgIsAvailable ()) {

> +  if (QemuFwCfgIsAvailable ()) {

>      UINT32 Signature;

>  

>      QemuFwCfgSelectItem (QemuFwCfgItemSignature);

> @@ -231,7 +212,7 @@ QemuFwCfgSelectItem (

>    IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem

>    )

>  {

> -  if (InternalQemuFwCfgIsAvailable ()) {

> +  if (QemuFwCfgIsAvailable ()) {

>      MmioWrite16 (mFwCfgSelectorAddress, SwapBytes16 ((UINT16)QemuFwCfgItem));

>    }

>  }

> @@ -360,7 +341,7 @@ QemuFwCfgReadBytes (

>    IN VOID  *Buffer

>    )

>  {

> -  if (InternalQemuFwCfgIsAvailable ()) {

> +  if (QemuFwCfgIsAvailable ()) {

>      InternalQemuFwCfgReadBytes (Size, Buffer);

>    } else {

>      ZeroMem (Buffer, Size);

> @@ -384,7 +365,7 @@ QemuFwCfgWriteBytes (

>    IN VOID                   *Buffer

>    )

>  {

> -  if (InternalQemuFwCfgIsAvailable ()) {

> +  if (QemuFwCfgIsAvailable ()) {

>      UINTN Idx;

>  

>      for (Idx = 0; Idx < Size; ++Idx) {

> @@ -494,7 +475,7 @@ QemuFwCfgFindFile (

>    UINT32 Count;

>    UINT32 Idx;

>  

> -  if (!InternalQemuFwCfgIsAvailable ()) {

> +  if (!QemuFwCfgIsAvailable ()) {

>      return RETURN_UNSUPPORTED;

>    }

>  

> -- 

> 2.9.2

> 

> 

> _______________________________________________

> edk2-devel mailing list

> edk2-devel@lists.01.org

> https://lists.01.org/mailman/listinfo/edk2-devel

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

Patch

diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 8ecbe3fb5fe6..2fd8d9050566 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -75,25 +75,6 @@  typedef struct {
 
 
 /**
-  Returns a boolean indicating if the firmware configuration interface is
-  available for library-internal purposes.
-
-  This function never changes fw_cfg state.
-
-  @retval TRUE   The interface is available internally.
-  @retval FALSE  The interface is not available internally.
-**/
-BOOLEAN
-EFIAPI
-InternalQemuFwCfgIsAvailable (
-  VOID
-  )
-{
-  return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0);
-}
-
-
-/**
   Returns a boolean indicating if the firmware configuration interface
   is available or not.
 
@@ -109,7 +90,7 @@  QemuFwCfgIsAvailable (
   VOID
   )
 {
-  return InternalQemuFwCfgIsAvailable ();
+  return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0);
 }
 
 
@@ -187,7 +168,7 @@  QemuFwCfgInitialize (
     FwCfgDmaAddress = 0;
   }
 
-  if (InternalQemuFwCfgIsAvailable ()) {
+  if (QemuFwCfgIsAvailable ()) {
     UINT32 Signature;
 
     QemuFwCfgSelectItem (QemuFwCfgItemSignature);
@@ -231,7 +212,7 @@  QemuFwCfgSelectItem (
   IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem
   )
 {
-  if (InternalQemuFwCfgIsAvailable ()) {
+  if (QemuFwCfgIsAvailable ()) {
     MmioWrite16 (mFwCfgSelectorAddress, SwapBytes16 ((UINT16)QemuFwCfgItem));
   }
 }
@@ -360,7 +341,7 @@  QemuFwCfgReadBytes (
   IN VOID  *Buffer
   )
 {
-  if (InternalQemuFwCfgIsAvailable ()) {
+  if (QemuFwCfgIsAvailable ()) {
     InternalQemuFwCfgReadBytes (Size, Buffer);
   } else {
     ZeroMem (Buffer, Size);
@@ -384,7 +365,7 @@  QemuFwCfgWriteBytes (
   IN VOID                   *Buffer
   )
 {
-  if (InternalQemuFwCfgIsAvailable ()) {
+  if (QemuFwCfgIsAvailable ()) {
     UINTN Idx;
 
     for (Idx = 0; Idx < Size; ++Idx) {
@@ -494,7 +475,7 @@  QemuFwCfgFindFile (
   UINT32 Count;
   UINT32 Idx;
 
-  if (!InternalQemuFwCfgIsAvailable ()) {
+  if (!QemuFwCfgIsAvailable ()) {
     return RETURN_UNSUPPORTED;
   }