public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Tomas Pilar (tpilar)" <Tomas.Pilar@arm.com>
To: <devel@edk2.groups.io>
Cc: <Sami.Mujawar@arm.com>, <nd@arm.com>, Ray Ni <ray.ni@intel.com>,
	"Zhichao Gao" <zhichao.gao@intel.com>
Subject: [PATCH v2 2/8] ShellPkg/AcpiView: Declutter error counters
Date: Sun, 12 Jul 2020 11:32:09 +0100	[thread overview]
Message-ID: <20200712103215.855-3-Tomas.Pilar@arm.com> (raw)
In-Reply-To: <20200712103215.855-1-Tomas.Pilar@arm.com>

Remove superfluous accessor methods for error and warning
counters.

Change-Id: I23df0aa10cfc757f37d83dee7ecce8a188a3ad1c
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Tomas Pilar <tomas.pilar@arm.com>
---
 .../UefiShellAcpiViewCommandLib/AcpiParser.c  | 54 ++-----------------
 .../UefiShellAcpiViewCommandLib/AcpiParser.h  |  4 ++
 .../UefiShellAcpiViewCommandLib/AcpiView.c    | 12 ++---
 .../UefiShellAcpiViewCommandLib/AcpiView.h    | 36 -------------
 4 files changed, 14 insertions(+), 92 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
index 3a029b01cc20..7017fa93efae 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -13,8 +13,10 @@
 #include "AcpiViewConfig.h"
 
 STATIC UINT32   gIndent;
-STATIC UINT32   mTableErrorCount;
-STATIC UINT32   mTableWarningCount;
+
+// Publicly accessible error and warning counters.
+UINT32   mTableErrorCount;
+UINT32   mTableWarningCount;
 
 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
 
@@ -25,54 +27,6 @@ STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {
   PARSE_ACPI_HEADER (&AcpiHdrInfo)
 };
 
-/**
-  This function resets the ACPI table error counter to Zero.
-**/
-VOID
-ResetErrorCount (
-  VOID
-  )
-{
-  mTableErrorCount = 0;
-}
-
-/**
-  This function returns the ACPI table error count.
-
-  @retval Returns the count of errors detected in the ACPI tables.
-**/
-UINT32
-GetErrorCount (
-  VOID
-  )
-{
-  return mTableErrorCount;
-}
-
-/**
-  This function resets the ACPI table warning counter to Zero.
-**/
-VOID
-ResetWarningCount (
-  VOID
-  )
-{
-  mTableWarningCount = 0;
-}
-
-/**
-  This function returns the ACPI table warning count.
-
-  @retval Returns the count of warning detected in the ACPI tables.
-**/
-UINT32
-GetWarningCount (
-  VOID
-  )
-{
-  return mTableWarningCount;
-}
-
 /**
   This function increments the ACPI table error counter.
 **/
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
index f81ccac7e118..84eae61c8889 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -16,6 +16,10 @@
 /// that allows us to process the log options.
 #define RSDP_TABLE_INFO  SIGNATURE_32('R', 'S', 'D', 'P')
 
+// Publicly accessible error and warning counters.
+extern UINT32   mTableErrorCount;
+extern UINT32   mTableWarningCount;
+
 /**
   This function increments the ACPI table error counter.
 **/
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
index d0a0edc45f3b..16f498b8c328 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -197,8 +197,8 @@ AcpiView (
   mBinTableCount = 0;
 
   // Reset The error/warning counters
-  ResetErrorCount ();
-  ResetWarningCount ();
+  mTableErrorCount = 0;
+  mTableWarningCount = 0;
 
   // Search the table for an entry that matches the ACPI Table Guid
   FoundAcpiTable = FALSE;
@@ -276,7 +276,7 @@ AcpiView (
       Print (L"\nTable Statistics:\n");
 
       if (mConfig.ColourHighlighting) {
-        PrintAttribute = (GetErrorCount () > 0) ?
+        PrintAttribute = ((mTableErrorCount) > 0) ?
                             EFI_TEXT_ATTR (
                               EFI_RED,
                               ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
@@ -284,10 +284,10 @@ AcpiView (
                             OriginalAttribute;
         gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
       }
-      Print (L"\t%d Error(s)\n", GetErrorCount ());
+      Print (L"\t%d Error(s)\n", mTableErrorCount);
 
       if (mConfig.ColourHighlighting) {
-        PrintAttribute = (GetWarningCount () > 0) ?
+        PrintAttribute = (mTableWarningCount > 0) ?
                             EFI_TEXT_ATTR (
                               EFI_RED,
                               ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
@@ -296,7 +296,7 @@ AcpiView (
 
         gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
       }
-      Print (L"\t%d Warning(s)\n", GetWarningCount ());
+      Print (L"\t%d Warning(s)\n", mTableWarningCount);
 
       if (mConfig.ColourHighlighting) {
         gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
index d5b95f5ee707..6fefe98a4463 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
@@ -23,42 +23,6 @@
 **/
 #define RSDP_LENGTH_OFFSET   20
 
-/**
-  This function resets the ACPI table error counter to Zero.
-**/
-VOID
-ResetErrorCount (
-  VOID
-  );
-
-/**
-  This function returns the ACPI table error count.
-
-  @retval Returns the count of errors detected in the ACPI tables.
-**/
-UINT32
-GetErrorCount (
-  VOID
-  );
-
-/**
-  This function resets the ACPI table warning counter to Zero.
-**/
-VOID
-ResetWarningCount (
-  VOID
-  );
-
-/**
-  This function returns the ACPI table warning count.
-
-  @retval Returns the count of warning detected in the ACPI tables.
-**/
-UINT32
-GetWarningCount (
-  VOID
-  );
-
 /**
   This function processes the table reporting options for the ACPI table.
 
-- 
2.24.1.windows.2



  parent reply	other threads:[~2020-07-12 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-12 10:32 [PATCH v2 0/8] ShellPkg/AcpiView: Refactor Error Logging Tomas Pilar (tpilar)
2020-07-12 10:32 ` [PATCH v2 1/8] ShellPkg/AcpiView: Extract configuration struct Tomas Pilar (tpilar)
2020-07-12 10:32 ` Tomas Pilar (tpilar) [this message]
2020-07-12 10:32 ` [PATCH v2 3/8] ShellPkg/AcpiView: Modify error message Tomas Pilar (tpilar)
2020-07-12 10:32 ` [PATCH v2 4/8] ShellPkg/AcpiView: Create a logging facility Tomas Pilar (tpilar)
2020-07-12 10:32 ` [PATCH v2 5/8] ShellPkg/AcpiView: Refactor PrintFieldName Tomas Pilar (tpilar)
2020-07-12 10:32 ` [PATCH v2 6/8] ShellPkg/AcpiView: Refactor dump helpers Tomas Pilar (tpilar)
2020-07-12 10:32 ` [PATCH v2 7/8] ShellPkg/AcpiView: Refactor AcpiView Tomas Pilar (tpilar)
2020-07-12 10:32 ` [PATCH v2 8/8] ShellPkg/AcpiView: Refactor table parsers Tomas Pilar (tpilar)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200712103215.855-3-Tomas.Pilar@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox