regulators: Add clearErrorHistory to Rail class

Add a clearErrorHistory() method to the Rail class.  The method should
clear all data on previously logged errors.  If the error occurs again
in the future, it will be logged again.

This method is normally called when the system is being powered on.  For
code that runs repeatedly, errors are only logged once per boot.

When the system is powered off, hardware may be replaced that fixes the
problem.  Thus, errors are cleared during power on.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I41e56162165186acb7a7872a288f0582874aa87d
diff --git a/phosphor-regulators/src/rail.cpp b/phosphor-regulators/src/rail.cpp
index ee24427..560ec9f 100644
--- a/phosphor-regulators/src/rail.cpp
+++ b/phosphor-regulators/src/rail.cpp
@@ -23,6 +23,15 @@
 namespace phosphor::power::regulators
 {
 
+void Rail::clearErrorHistory()
+{
+    // If sensor monitoring is defined for this rail, clear its error history
+    if (sensorMonitoring)
+    {
+        sensorMonitoring->clearErrorHistory();
+    }
+}
+
 void Rail::configure(Services& services, System& system, Chassis& chassis,
                      Device& device)
 {