psu-ng: Limit tracing/logging read failures
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I433f164b82e9c5e6529d197354f4ab1169417540
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index ab1caf9..77d533a 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -35,11 +35,13 @@
{
using namespace phosphor::pmbus;
- if (present)
+ if ((present) && (readFail < LOG_LIMIT))
{
try
{
statusWord = pmbusIntf->read(STATUS_WORD, Type::Debug);
+ // Read worked, reset the fail count.
+ readFail = 0;
if (statusWord)
{
@@ -94,6 +96,7 @@
}
catch (ReadFailure& e)
{
+ readFail++;
phosphor::logging::commit<ReadFailure>();
}
}
@@ -129,6 +132,7 @@
inputFault = false;
mfrFault = false;
vinUVFault = false;
+ readFail = 0;
faultLogged = false;
// The PMBus device driver does not allow for writing CLEAR_FAULTS