psu-ng: Refactor clearing fault member variables
Consolidated the copy/paste of clearing the fault member variables into
a helper function that both analyze() and clearFaults() can use.
Change-Id: Ib56718b0d4cc36edd000b9ba1f52fb42047e2a8c
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 8e82927..2e7c63b 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -104,6 +104,28 @@
void onOffConfig(uint8_t data);
/**
+ * Clears all the member variables that indicate if a fault bit was seen as
+ * on in the STATUS_WORD or STATUS_MFR_SPECIFIC response.
+ */
+ void clearFaultFlags()
+ {
+ inputFault = false;
+ mfrFault = false;
+ statusMFR = 0;
+ vinUVFault = false;
+ cmlFault = false;
+ voutOVFault = false;
+ ioutOCFault = false;
+ voutUVFault = false;
+ fanFault = false;
+ tempFault = false;
+ pgoodFault = 0;
+ psKillFault = false;
+ ps12VcsFault = false;
+ psCS12VFault = false;
+ }
+
+ /**
* Write PMBus CLEAR_FAULTS
*
* This function will be called in various situations in order to clear