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.cpp b/phosphor-regulators/src/device.cpp
index 1290077..8ae7afb 100644
--- a/phosphor-regulators/src/device.cpp
+++ b/phosphor-regulators/src/device.cpp
@@ -69,27 +69,34 @@
 
 void Device::configure(Services& services, System& system, Chassis& chassis)
 {
-    // If configuration changes are defined for this device, apply them
-    if (configuration)
+    // Verify device is present
+    if (isPresent(services, system, chassis))
     {
-        configuration->execute(services, system, chassis, *this);
-    }
+        // If configuration changes are defined for this device, apply them
+        if (configuration)
+        {
+            configuration->execute(services, system, chassis, *this);
+        }
 
-    // Configure rails
-    for (std::unique_ptr<Rail>& rail : rails)
-    {
-        rail->configure(services, system, chassis, *this);
+        // Configure rails
+        for (std::unique_ptr<Rail>& rail : rails)
+        {
+            rail->configure(services, system, chassis, *this);
+        }
     }
 }
 
 void Device::monitorSensors(Services& services, System& system,
                             Chassis& chassis)
 {
-
-    // Monitor sensors in each rail
-    for (std::unique_ptr<Rail>& rail : rails)
+    // Verify device is present
+    if (isPresent(services, system, chassis))
     {
-        rail->monitorSensors(services, system, chassis, *this);
+        // Monitor sensors in each rail
+        for (std::unique_ptr<Rail>& rail : rails)
+        {
+            rail->monitorSensors(services, system, chassis, *this);
+        }
     }
 }