psu-ng: Refactor input fault detection

Split off input fault checking of STATUS_WORD into its own function.

Change-Id: I72a299ec1e905c9d59460b37f594997eee124e27
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 13d11f7..1726c4b 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -205,6 +205,23 @@
     }
 }
 
+void PowerSupply::analyzeInputFault()
+{
+    if (statusWord & phosphor::pmbus::status_word::INPUT_FAULT_WARN)
+    {
+        if (!inputFault)
+        {
+            log<level::ERR>(fmt::format("INPUT fault: STATUS_WORD = {:#04x}, "
+                                        "STATUS_MFR_SPECIFIC = {:#02x}, "
+                                        "STATUS_INPUT = {:#02x}",
+                                        statusWord, statusMFR, statusInput)
+                                .c_str());
+        }
+
+        inputFault = true;
+    }
+}
+
 void PowerSupply::analyzeTemperatureFault()
 {
     if (statusWord & phosphor::pmbus::status_word::TEMPERATURE_FAULT_WARN)
@@ -317,20 +334,7 @@
 
                 analyzeCMLFault();
 
-                if (statusWord & status_word::INPUT_FAULT_WARN)
-                {
-                    if (!inputFault)
-                    {
-                        log<level::ERR>(
-                            fmt::format("INPUT fault: STATUS_WORD = {:#04x}, "
-                                        "STATUS_MFR_SPECIFIC = {:#02x}, "
-                                        "STATUS_INPUT = {:#02x}",
-                                        statusWord, statusMFR, statusInput)
-                                .c_str());
-                    }
-
-                    inputFault = true;
-                }
+                analyzeInputFault();
 
                 if (statusWord & status_word::VOUT_OV_FAULT)
                 {
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index 1d1e105..2ceac89 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -496,6 +496,14 @@
     void analyzeCMLFault();
 
     /**
+     * @brief Examine STATUS_WORD for INPUT bit on.
+     *
+     * "An input voltage, input current, or input power fault or warning has
+     * occurred."
+     */
+    void analyzeInputFault();
+
+    /**
      * @brief Examine STATUS_WORD for temperature fault.
      */
     void analyzeTemperatureFault();