psu-ng: Refactor PowerSupply::isFaulted
Refactor the isFaulted() function to check the various possible faults,
return true if any of the faults are detected. This should avoid needing
an extra flag to set/clear in addition to the one for the specific
fault.
Tested:
Verified input fault command logs error.
Verified OV/OC fault logs error.
Change-Id: I111705a175a49b01352ac86178620d6f2cb1231f
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index 0cc80d9..8d072c7 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -181,7 +181,8 @@
*/
bool isFaulted() const
{
- return (faultFound || hasCommFault());
+ return (hasCommFault() || vinUVFault || inputFault || voutOVFault ||
+ mfrFault);
}
/**
@@ -307,9 +308,6 @@
/** @brief Will be updated to the latest/last value read from STATUS_VOUT.*/
uint64_t statusVout = 0;
- /** @brief True if a fault has already been found and not cleared */
- bool faultFound = false;
-
/** @brief True if an error for a fault has already been logged. */
bool faultLogged = false;