regulators: Add closeDevices() to Chassis class
Add a closeDevices() method to the Chassis class. This will close all
devices within the chassis. The devices should be closed when monitoring
is disabled and the system is being powered off.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I713bf470392aa49632a34fa42bf849fa2f1c4c01
diff --git a/phosphor-regulators/src/chassis.cpp b/phosphor-regulators/src/chassis.cpp
index 3390ec5..a0d0c2b 100644
--- a/phosphor-regulators/src/chassis.cpp
+++ b/phosphor-regulators/src/chassis.cpp
@@ -31,6 +31,18 @@
}
}
+void Chassis::closeDevices()
+{
+ // Log debug message in journal
+ journal::logDebug("Closing devices in chassis " + std::to_string(number));
+
+ // Close devices
+ for (std::unique_ptr<Device>& device : devices)
+ {
+ device->close();
+ }
+}
+
void Chassis::configure(System& system)
{
// Log info message in journal; important for verifying success of boot