regulators: Only configure/monitor if present
Enhance the configure and monitor operations to only be performed if the
device is present.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I57fed4f92937b808ac6f8c37899e28d6009747e6
diff --git a/phosphor-regulators/src/device.hpp b/phosphor-regulators/src/device.hpp
index 75ff904..8ef37fb 100644
--- a/phosphor-regulators/src/device.hpp
+++ b/phosphor-regulators/src/device.hpp
@@ -184,6 +184,25 @@
}
/**
+ * Returns whether this device is present.
+ *
+ * @return true if device is present, false otherwise
+ */
+ bool isPresent(Services& services, System& system, Chassis& chassis)
+ {
+ if (presenceDetection)
+ {
+ // Execute presence detection to determine if device is present
+ return presenceDetection->execute(services, system, chassis, *this);
+ }
+ else
+ {
+ // No presence detection defined; assume device is present
+ return true;
+ }
+ }
+
+ /**
* Returns whether this device is a voltage regulator.
*
* @return true if device is a voltage regulator, false otherwise