psu-ng: Refactor PGOOD and UNIT_IS_OFF fault

Split the code for detecting PGOOD and/or UNIT_IS_OFF fault into its own
private member function.

The analyze() function is getting a bit long and hard to read.

Change-Id: I48771a5d4e8991ce37b54bd6ad4c3e938924418e
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index 04762b3..6fd412a 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -189,6 +189,28 @@
     }
 }
 
+void PowerSupply::analyzePgoodFault()
+{
+    if ((statusWord & phosphor::pmbus::status_word::POWER_GOOD_NEGATED) ||
+        (statusWord & phosphor::pmbus::status_word::UNIT_IS_OFF))
+    {
+        if (pgoodFault < DEGLITCH_LIMIT)
+        {
+            log<level::ERR>(fmt::format("PGOOD fault: "
+                                        "STATUS_WORD = {:#04x}, "
+                                        "STATUS_MFR_SPECIFIC = {:#02x}",
+                                        statusWord, statusMFR)
+                                .c_str());
+
+            pgoodFault++;
+        }
+    }
+    else
+    {
+        pgoodFault = 0;
+    }
+}
+
 void PowerSupply::determineMFRFault()
 {
     if (bindPath.string().find("ibm-cffps") != std::string::npos)
@@ -367,25 +389,7 @@
                     tempFault = true;
                 }
 
-                if ((statusWord & status_word::POWER_GOOD_NEGATED) ||
-                    (statusWord & status_word::UNIT_IS_OFF))
-                {
-                    if (pgoodFault < DEGLITCH_LIMIT)
-                    {
-                        log<level::ERR>(
-                            fmt::format("PGOOD fault: "
-                                        "STATUS_WORD = {:#04x}, "
-                                        "STATUS_MFR_SPECIFIC = {:#02x}",
-                                        statusWord, statusMFR)
-                                .c_str());
-
-                        pgoodFault++;
-                    }
-                }
-                else
-                {
-                    pgoodFault = 0;
-                }
+                analyzePgoodFault();
 
                 analyzeMFRFault();