monitor: Clang format updates

Used `format-code.sh` build script to make changes to conform to clang
format.

Tested: Compiled

Change-Id: Ieead1449cfd4b61333a135740dce03789218f92b
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/monitor/argument.cpp b/monitor/argument.cpp
index c756649..90afd10 100644
--- a/monitor/argument.cpp
+++ b/monitor/argument.cpp
@@ -13,10 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "argument.hpp"
+
+#include <algorithm>
 #include <iostream>
 #include <iterator>
-#include <algorithm>
-#include "argument.hpp"
 
 namespace phosphor
 {
@@ -72,12 +73,11 @@
     std::cerr << std::flush;
 }
 
-const option ArgumentParser::options[] =
-{
-    { "init", no_argument, NULL, 'i' },
-    { "monitor", no_argument, NULL, 'm' },
-    { "help", no_argument, NULL, 'h' },
-    { 0, 0, 0, 0 },
+const option ArgumentParser::options[] = {
+    {"init", no_argument, NULL, 'i'},
+    {"monitor", no_argument, NULL, 'm'},
+    {"help", no_argument, NULL, 'h'},
+    {0, 0, 0, 0},
 };
 
 const char* ArgumentParser::optionstr = "imh?";
@@ -85,6 +85,6 @@
 const std::string ArgumentParser::true_string = "true";
 const std::string ArgumentParser::empty_string = "";
 
-}
-}
-}
+} // namespace util
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/conditions.cpp b/monitor/conditions.cpp
index c046f0c..09f5852 100644
--- a/monitor/conditions.cpp
+++ b/monitor/conditions.cpp
@@ -1,7 +1,9 @@
-#include <algorithm>
 #include "conditions.hpp"
+
 #include "sdbusplus.hpp"
 
+#include <algorithm>
+
 namespace phosphor
 {
 namespace fan
@@ -13,19 +15,14 @@
 
 Condition propertiesMatch(std::vector<PropertyState>&& propStates)
 {
-    return [pStates = std::move(propStates)](sdbusplus::bus::bus& bus)
-    {
+    return [pStates = std::move(propStates)](sdbusplus::bus::bus& bus) {
         return std::all_of(
-            pStates.begin(),
-            pStates.end(),
-            [&bus](const auto& p)
-        {
-            return util::SDBusPlus::getPropertyVariant<PropertyValue>(
-                bus,
-                std::get<propObj>(p.first),
-                std::get<propIface>(p.first),
-                std::get<propName>(p.first)) == p.second;
-        });
+            pStates.begin(), pStates.end(), [&bus](const auto& p) {
+                return util::SDBusPlus::getPropertyVariant<PropertyValue>(
+                           bus, std::get<propObj>(p.first),
+                           std::get<propIface>(p.first),
+                           std::get<propName>(p.first)) == p.second;
+            });
     };
 }
 
diff --git a/monitor/fan.cpp b/monitor/fan.cpp
index 014080d..bbf8202 100644
--- a/monitor/fan.cpp
+++ b/monitor/fan.cpp
@@ -13,12 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <algorithm>
-#include <phosphor-logging/log.hpp>
 #include "fan.hpp"
+
+#include "sdbusplus.hpp"
 #include "types.hpp"
 #include "utility.hpp"
-#include "sdbusplus.hpp"
+
+#include <phosphor-logging/log.hpp>
+
+#include <algorithm>
 
 namespace phosphor
 {
@@ -29,11 +32,8 @@
 
 using namespace phosphor::logging;
 
-Fan::Fan(Mode mode,
-         sdbusplus::bus::bus& bus,
-         const sdeventplus::Event&  event,
-         std::unique_ptr<trust::Manager>& trust,
-         const FanDefinition& def) :
+Fan::Fan(Mode mode, sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
+         std::unique_ptr<trust::Manager>& trust, const FanDefinition& def) :
     _bus(bus),
     _name(std::get<fanNameField>(def)),
     _deviation(std::get<fanDeviationField>(def)),
@@ -46,41 +46,30 @@
     {
         try
         {
-            _sensors.emplace_back(
-                    std::make_shared<TachSensor>(
-                            mode,
-                            bus,
-                            *this,
-                            std::get<sensorNameField>(s),
-                            std::get<hasTargetField>(s),
-                            std::get<funcDelay>(def),
-                            std::get<targetInterfaceField>(s),
-                            std::get<factorField>(s),
-                            std::get<offsetField>(s),
-                            std::get<timeoutField>(def),
-                            event));
+            _sensors.emplace_back(std::make_shared<TachSensor>(
+                mode, bus, *this, std::get<sensorNameField>(s),
+                std::get<hasTargetField>(s), std::get<funcDelay>(def),
+                std::get<targetInterfaceField>(s), std::get<factorField>(s),
+                std::get<offsetField>(s), std::get<timeoutField>(def), event));
 
             _trustManager->registerSensor(_sensors.back());
         }
         catch (InvalidSensorError& e)
-        {
-
-        }
+        {}
     }
 
-    //Start from a known state of functional
+    // Start from a known state of functional
     updateInventory(true);
 
     // Check current tach state when entering monitor mode
     if (mode != Mode::init)
     {
-        //The TachSensors will now have already read the input
-        //and target values, so check them.
+        // The TachSensors will now have already read the input
+        // and target values, so check them.
         tachChanged();
     }
 }
 
-
 void Fan::tachChanged()
 {
     for (auto& s : _sensors)
@@ -89,7 +78,6 @@
     }
 }
 
-
 void Fan::tachChanged(TachSensor& sensor)
 {
     if (_trustManager->active())
@@ -100,11 +88,11 @@
         }
     }
 
-    //If this sensor is out of range at this moment, start
-    //its timer, at the end of which the inventory
-    //for the fan may get updated to not functional.
+    // If this sensor is out of range at this moment, start
+    // its timer, at the end of which the inventory
+    // for the fan may get updated to not functional.
 
-    //If this sensor is OK, put everything back into a good state.
+    // If this sensor is OK, put everything back into a good state.
 
     if (outOfRange(sensor))
     {
@@ -128,17 +116,13 @@
     }
 }
 
-
 uint64_t Fan::findTargetSpeed()
 {
     uint64_t target = 0;
-    //The sensor doesn't support a target,
-    //so get it from another sensor.
+    // The sensor doesn't support a target,
+    // so get it from another sensor.
     auto s = std::find_if(_sensors.begin(), _sensors.end(),
-                          [](const auto& s)
-                          {
-                              return s->hasTarget();
-                          });
+                          [](const auto& s) { return s->hasTarget(); });
 
     if (s != _sensors.end())
     {
@@ -148,19 +132,15 @@
     return target;
 }
 
-
 bool Fan::tooManySensorsNonfunctional()
 {
-    size_t numFailed =  std::count_if(_sensors.begin(), _sensors.end(),
-                                      [](const auto& s)
-                                      {
-                                          return !s->functional();
-                                      });
+    size_t numFailed =
+        std::count_if(_sensors.begin(), _sensors.end(),
+                      [](const auto& s) { return !s->functional(); });
 
     return (numFailed >= _numSensorFailsForNonFunc);
 }
 
-
 bool Fan::outOfRange(const TachSensor& sensor)
 {
     auto actual = static_cast<uint64_t>(sensor.getInput());
@@ -184,13 +164,12 @@
     return false;
 }
 
-
 void Fan::timerExpired(TachSensor& sensor)
 {
     sensor.setFunctional(!sensor.functional());
 
-    //If the fan was nonfunctional and enough sensors are now OK,
-    //the fan can go back to functional
+    // If the fan was nonfunctional and enough sensors are now OK,
+    // the fan can go back to functional
     if (!_functional && !tooManySensorsNonfunctional())
     {
         log<level::INFO>("Setting a fan back to functional",
@@ -199,45 +178,38 @@
         updateInventory(true);
     }
 
-    //If the fan is currently functional, but too many
-    //contained sensors are now nonfunctional, update
-    //the whole fan nonfunctional.
+    // If the fan is currently functional, but too many
+    // contained sensors are now nonfunctional, update
+    // the whole fan nonfunctional.
     if (_functional && tooManySensorsNonfunctional())
     {
         log<level::ERR>("Setting a fan to nonfunctional",
-                entry("FAN=%s", _name.c_str()),
-                entry("TACH_SENSOR=%s", sensor.name().c_str()),
-                entry("ACTUAL_SPEED=%lld", sensor.getInput()),
-                entry("TARGET_SPEED=%lld", sensor.getTarget()));
+                        entry("FAN=%s", _name.c_str()),
+                        entry("TACH_SENSOR=%s", sensor.name().c_str()),
+                        entry("ACTUAL_SPEED=%lld", sensor.getInput()),
+                        entry("TARGET_SPEED=%lld", sensor.getTarget()));
 
         updateInventory(false);
     }
 }
 
-
 void Fan::updateInventory(bool functional)
 {
-    auto objectMap = util::getObjMap<bool>(
-            _name,
-            util::OPERATIONAL_STATUS_INTF,
-            util::FUNCTIONAL_PROPERTY,
-            functional);
+    auto objectMap =
+        util::getObjMap<bool>(_name, util::OPERATIONAL_STATUS_INTF,
+                              util::FUNCTIONAL_PROPERTY, functional);
     auto response = util::SDBusPlus::lookupAndCallMethod(
-            _bus,
-            util::INVENTORY_PATH,
-            util::INVENTORY_INTF,
-            "Notify",
-            objectMap);
+        _bus, util::INVENTORY_PATH, util::INVENTORY_INTF, "Notify", objectMap);
     if (response.is_method_error())
     {
         log<level::ERR>("Error in Notify call to update inventory");
         return;
     }
 
-    //This will always track the current state of the inventory.
+    // This will always track the current state of the inventory.
     _functional = functional;
 }
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/fan.hpp b/monitor/fan.hpp
index a581b3b..5136cee 100644
--- a/monitor/fan.hpp
+++ b/monitor/fan.hpp
@@ -1,13 +1,15 @@
 #pragma once
 
-#include <sdbusplus/bus.hpp>
-#include <sdeventplus/event.hpp>
-#include <tuple>
-#include <vector>
 #include "tach_sensor.hpp"
 #include "trust_manager.hpp"
 #include "types.hpp"
 
+#include <sdbusplus/bus.hpp>
+#include <sdeventplus/event.hpp>
+
+#include <tuple>
+#include <vector>
+
 namespace phosphor
 {
 namespace fan
@@ -21,7 +23,8 @@
  * An exception type for sensors that don't exist or
  * are otherwise inaccessible.
  */
-class InvalidSensorError : public std::exception {};
+class InvalidSensorError : public std::exception
+{};
 
 /**
  * @class Fan
@@ -64,140 +67,135 @@
     using Object = sdbusplus::message::object_path;
     using ObjectMap = std::map<Object, InterfaceMap>;
 
-    public:
+  public:
+    Fan() = delete;
+    Fan(const Fan&) = delete;
+    Fan(Fan&&) = default;
+    Fan& operator=(const Fan&) = delete;
+    Fan& operator=(Fan&&) = default;
+    ~Fan() = default;
 
-        Fan() = delete;
-        Fan(const Fan&) = delete;
-        Fan(Fan&&) = default;
-        Fan& operator=(const Fan&) = delete;
-        Fan& operator=(Fan&&) = default;
-        ~Fan() = default;
+    /**
+     * @brief Constructor
+     *
+     * @param mode - mode of fan monitor
+     * @param bus - the dbus object
+     * @param event - event loop reference
+     * @param trust - the tach trust manager
+     * @param def - the fan definition structure
+     */
+    Fan(Mode mode, sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
+        std::unique_ptr<trust::Manager>& trust, const FanDefinition& def);
 
-        /**
-         * @brief Constructor
-         *
-         * @param mode - mode of fan monitor
-         * @param bus - the dbus object
-         * @param event - event loop reference
-         * @param trust - the tach trust manager
-         * @param def - the fan definition structure
-         */
-        Fan(Mode mode,
-            sdbusplus::bus::bus& bus,
-            const sdeventplus::Event& event,
-            std::unique_ptr<trust::Manager>& trust,
-            const FanDefinition& def);
+    /**
+     * @brief Callback function for when an input sensor changes
+     *
+     * Starts a timer, where if it expires then the sensor
+     * was out of range for too long and can be considered not functional.
+     */
+    void tachChanged(TachSensor& sensor);
 
-        /**
-         * @brief Callback function for when an input sensor changes
-         *
-         * Starts a timer, where if it expires then the sensor
-         * was out of range for too long and can be considered not functional.
-         */
-        void tachChanged(TachSensor& sensor);
+    /**
+     * @brief Calls tachChanged(sensor) on each sensor
+     */
+    void tachChanged();
 
-        /**
-         * @brief Calls tachChanged(sensor) on each sensor
-         */
-        void tachChanged();
+    /**
+     * @brief The callback function for the timer
+     *
+     * Sets the sensor to not functional.
+     * If enough sensors are now not functional,
+     * updates the functional status of the whole
+     * fan in the inventory.
+     *
+     * @param[in] sensor - the sensor whose timer expired
+     */
+    void timerExpired(TachSensor& sensor);
 
-        /**
-         * @brief The callback function for the timer
-         *
-         * Sets the sensor to not functional.
-         * If enough sensors are now not functional,
-         * updates the functional status of the whole
-         * fan in the inventory.
-         *
-         * @param[in] sensor - the sensor whose timer expired
-         */
-        void timerExpired(TachSensor& sensor);
+    /**
+     * @brief Get the name of the fan
+     *
+     * @return - The fan name
+     */
+    inline const std::string& getName() const
+    {
+        return _name;
+    }
 
-        /**
-         * @brief Get the name of the fan
-         *
-         * @return - The fan name
-         */
-        inline const std::string& getName() const
-        {
-            return _name;
-        }
+    /**
+     * @brief Finds the target speed of this fan
+     *
+     * Finds the target speed from the list of sensors that make up this
+     * fan. At least one sensor should contain a target speed value.
+     *
+     * @return - The target speed found from the list of sensors on the fan
+     */
+    uint64_t findTargetSpeed();
 
-        /**
-         * @brief Finds the target speed of this fan
-         *
-         * Finds the target speed from the list of sensors that make up this
-         * fan. At least one sensor should contain a target speed value.
-         *
-         * @return - The target speed found from the list of sensors on the fan
-         */
-        uint64_t findTargetSpeed();
+  private:
+    /**
+     * @brief Returns true if the sensor input is not within
+     * some deviation of the target.
+     *
+     * @param[in] sensor - the sensor to check
+     */
+    bool outOfRange(const TachSensor& sensor);
 
-    private:
+    /**
+     * @brief Returns true if too many sensors are nonfunctional
+     *        as defined by _numSensorFailsForNonFunc
+     */
+    bool tooManySensorsNonfunctional();
 
-        /**
-         * @brief Returns true if the sensor input is not within
-         * some deviation of the target.
-         *
-         * @param[in] sensor - the sensor to check
-         */
-        bool outOfRange(const TachSensor& sensor);
+    /**
+     * @brief Updates the Functional property in the inventory
+     *        for the fan based on the value passed in.
+     *
+     * @param[in] functional - If the Functional property should
+     *                         be set to true or false.
+     */
+    void updateInventory(bool functional);
 
-        /**
-         * @brief Returns true if too many sensors are nonfunctional
-         *        as defined by _numSensorFailsForNonFunc
-         */
-        bool tooManySensorsNonfunctional();
+    /**
+     * @brief the dbus object
+     */
+    sdbusplus::bus::bus& _bus;
 
-        /**
-         * @brief Updates the Functional property in the inventory
-         *        for the fan based on the value passed in.
-         *
-         * @param[in] functional - If the Functional property should
-         *                         be set to true or false.
-         */
-        void updateInventory(bool functional);
+    /**
+     * @brief The inventory name of the fan
+     */
+    const std::string _name;
 
-        /**
-         * @brief the dbus object
-         */
-        sdbusplus::bus::bus& _bus;
+    /**
+     * @brief The percentage that the input speed must be below
+     *        the target speed to be considered an error.
+     *        Between 0 and 100.
+     */
+    const size_t _deviation;
 
-        /**
-         * @brief The inventory name of the fan
-         */
-        const std::string _name;
+    /**
+     * The number of sensors that must be nonfunctional at the
+     * same time in order for the fan to be set to nonfunctional
+     * in the inventory.
+     */
+    const size_t _numSensorFailsForNonFunc;
 
-        /**
-         * @brief The percentage that the input speed must be below
-         *        the target speed to be considered an error.
-         *        Between 0 and 100.
-         */
-        const size_t _deviation;
+    /**
+     * @brief The current functional state of the fan
+     */
+    bool _functional = true;
 
-        /**
-         * The number of sensors that must be nonfunctional at the
-         * same time in order for the fan to be set to nonfunctional
-         * in the inventory.
-         */
-        const size_t _numSensorFailsForNonFunc;
+    /**
+     * The sensor objects for the fan
+     */
+    std::vector<std::shared_ptr<TachSensor>> _sensors;
 
-        /**
-         * @brief The current functional state of the fan
-         */
-        bool _functional = true;
-
-        /**
-         * The sensor objects for the fan
-         */
-        std::vector<std::shared_ptr<TachSensor>> _sensors;
-
-        /**
-         * The tach trust manager object
-         */
-        std::unique_ptr<trust::Manager>& _trustManager;
+    /**
+     * The tach trust manager object
+     */
+    std::unique_ptr<trust::Manager>& _trustManager;
 };
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/fan_defs.hpp b/monitor/fan_defs.hpp
index b766f8e..264e1f6 100644
--- a/monitor/fan_defs.hpp
+++ b/monitor/fan_defs.hpp
@@ -2,8 +2,7 @@
 
 #include "types.hpp"
 
-extern const std::vector<phosphor::fan::monitor::FanDefinition>
-fanDefinitions;
+extern const std::vector<phosphor::fan::monitor::FanDefinition> fanDefinitions;
 
 extern const std::vector<phosphor::fan::monitor::CreateGroupFunction>
-trustGroups;
+    trustGroups;
diff --git a/monitor/main.cpp b/monitor/main.cpp
index cba3832..74cc62d 100644
--- a/monitor/main.cpp
+++ b/monitor/main.cpp
@@ -13,14 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus.hpp>
-#include <sdeventplus/event.hpp>
 #include "argument.hpp"
 #include "fan.hpp"
 #include "fan_defs.hpp"
 #include "trust_manager.hpp"
 
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+#include <sdeventplus/event.hpp>
+
 using namespace phosphor::fan::monitor;
 using namespace phosphor::logging;
 
@@ -53,10 +54,10 @@
     }
 
     std::unique_ptr<phosphor::fan::trust::Manager> trust =
-            std::make_unique<phosphor::fan::trust::Manager>(trustGroups);
+        std::make_unique<phosphor::fan::trust::Manager>(trustGroups);
 
-    //Attach the event object to the bus object so we can
-    //handle both sd_events (for the timers) and dbus signals.
+    // Attach the event object to the bus object so we can
+    // handle both sd_events (for the timers) and dbus signals.
     bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
 
     for (const auto& fanDef : fanDefinitions)
@@ -71,8 +72,8 @@
                 continue;
             }
         }
-        fans.emplace_back(std::make_unique<Fan>(
-                mode, bus, event, trust, fanDef));
+        fans.emplace_back(
+            std::make_unique<Fan>(mode, bus, event, trust, fanDef));
     }
 
     if (mode == Mode::init)
diff --git a/monitor/nonzero_speed_trust.hpp b/monitor/nonzero_speed_trust.hpp
index c5b67fd..9001579 100644
--- a/monitor/nonzero_speed_trust.hpp
+++ b/monitor/nonzero_speed_trust.hpp
@@ -18,48 +18,41 @@
  */
 class NonzeroSpeed : public Group
 {
-    public:
+  public:
+    NonzeroSpeed() = delete;
+    ~NonzeroSpeed() = default;
+    NonzeroSpeed(const NonzeroSpeed&) = delete;
+    NonzeroSpeed& operator=(const NonzeroSpeed&) = delete;
+    NonzeroSpeed(NonzeroSpeed&&) = default;
+    NonzeroSpeed& operator=(NonzeroSpeed&&) = default;
 
-        NonzeroSpeed() = delete;
-        ~NonzeroSpeed() = default;
-        NonzeroSpeed(const NonzeroSpeed&) = delete;
-        NonzeroSpeed& operator=(const NonzeroSpeed&) = delete;
-        NonzeroSpeed(NonzeroSpeed&&) = default;
-        NonzeroSpeed& operator=(NonzeroSpeed&&) = default;
+    /**
+     * Constructor
+     *
+     * @param[in] names - the names of the sensors and its inclusion in
+     * determining trust for the group
+     */
+    explicit NonzeroSpeed(const std::vector<GroupDefinition>& names) :
+        Group(names)
+    {}
 
-        /**
-         * Constructor
-         *
-         * @param[in] names - the names of the sensors and its inclusion in
-         * determining trust for the group
-         */
-        explicit NonzeroSpeed(const std::vector<GroupDefinition>& names) :
-                Group(names)
-        {
-        }
-
-    private:
-
-        /**
-         * Determines if the group is trusted by checking
-         * if any sensor included in the trust determination
-         * has a nonzero speed. If all the speeds of these sensors
-         * are zero, then no sensors in the group are trusted.
-         *
-         * @return bool - if group is trusted or not
-         */
-        bool checkGroupTrust() override
-        {
-            return std::any_of(
-                    _sensors.begin(),
-                    _sensors.end(),
-                    [](const auto& s)
-                    {
-                        return s.inTrust && s.sensor->getInput() != 0;
-                    });
-        }
+  private:
+    /**
+     * Determines if the group is trusted by checking
+     * if any sensor included in the trust determination
+     * has a nonzero speed. If all the speeds of these sensors
+     * are zero, then no sensors in the group are trusted.
+     *
+     * @return bool - if group is trusted or not
+     */
+    bool checkGroupTrust() override
+    {
+        return std::any_of(_sensors.begin(), _sensors.end(), [](const auto& s) {
+            return s.inTrust && s.sensor->getInput() != 0;
+        });
+    }
 };
 
-}
-}
-}
+} // namespace trust
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 33904bd..42b826f 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -13,15 +13,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <experimental/filesystem>
-#include <functional>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
+#include "tach_sensor.hpp"
+
 #include "fan.hpp"
 #include "sdbusplus.hpp"
-#include "tach_sensor.hpp"
 #include "utility.hpp"
 
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+
+#include <experimental/filesystem>
+#include <functional>
+
 namespace phosphor
 {
 namespace fan
@@ -34,8 +37,8 @@
 constexpr auto FAN_VALUE_PROPERTY = "Value";
 
 using namespace std::experimental::filesystem;
-using InternalFailure = sdbusplus::xyz::openbmc_project::Common::
-                            Error::InternalFailure;
+using InternalFailure =
+    sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
 
 /**
  * @brief Helper function to read a property
@@ -46,19 +49,15 @@
  * @param[in] bus - the dbus object
  * @param[out] value - filled in with the property value
  */
-template<typename T>
-static void readProperty(const std::string& interface,
-                         const std::string& propertyName,
-                         const std::string& path,
-                         sdbusplus::bus::bus& bus,
-                         T& value)
+template <typename T>
+static void
+    readProperty(const std::string& interface, const std::string& propertyName,
+                 const std::string& path, sdbusplus::bus::bus& bus, T& value)
 {
     try
     {
-        value = util::SDBusPlus::getProperty<T>(bus,
-                                                path,
-                                                interface,
-                                                propertyName);
+        value =
+            util::SDBusPlus::getProperty<T>(bus, path, interface, propertyName);
     }
     catch (std::exception& e)
     {
@@ -66,28 +65,15 @@
     }
 }
 
-
-TachSensor::TachSensor(Mode mode,
-                       sdbusplus::bus::bus& bus,
-                       Fan& fan,
-                       const std::string& id,
-                       bool hasTarget,
-                       size_t funcDelay,
-                       const std::string& interface,
-                       double factor,
-                       int64_t offset,
-                       size_t timeout,
+TachSensor::TachSensor(Mode mode, sdbusplus::bus::bus& bus, Fan& fan,
+                       const std::string& id, bool hasTarget, size_t funcDelay,
+                       const std::string& interface, double factor,
+                       int64_t offset, size_t timeout,
                        const sdeventplus::Event& event) :
     _bus(bus),
-    _fan(fan),
-    _name(FAN_SENSOR_PATH + id),
-    _invName(path(fan.getName()) / id),
-    _hasTarget(hasTarget),
-    _funcDelay(funcDelay),
-    _interface(interface),
-    _factor(factor),
-    _offset(offset),
-    _timeout(timeout),
+    _fan(fan), _name(FAN_SENSOR_PATH + id), _invName(path(fan.getName()) / id),
+    _hasTarget(hasTarget), _funcDelay(funcDelay), _interface(interface),
+    _factor(factor), _offset(offset), _timeout(timeout),
     _timerMode(TimerMode::func),
     _timer(event, std::bind(&Fan::timerExpired, &fan, std::ref(*this)))
 {
@@ -102,50 +88,41 @@
             // Use getProperty directly to allow a missing sensor object
             // to abort construction.
             _tachInput = util::SDBusPlus::getProperty<decltype(_tachInput)>(
-                    _bus,
-                    _name,
-                    FAN_SENSOR_VALUE_INTF,
-                    FAN_VALUE_PROPERTY);
+                _bus, _name, FAN_SENSOR_VALUE_INTF, FAN_VALUE_PROPERTY);
         }
         catch (std::exception& e)
         {
             log<level::INFO>("Not monitoring a tach sensor",
-                    entry("SENSOR=%s", _name.c_str()));
+                             entry("SENSOR=%s", _name.c_str()));
             throw InvalidSensorError();
         }
 
         if (_hasTarget)
         {
-            readProperty(_interface,
-                         FAN_TARGET_PROPERTY,
-                         _name,
-                         _bus,
+            readProperty(_interface, FAN_TARGET_PROPERTY, _name, _bus,
                          _tachTarget);
         }
 
         auto match = getMatchString(FAN_SENSOR_VALUE_INTF);
 
         tachSignal = std::make_unique<sdbusplus::server::match::match>(
-                _bus,
-                match.c_str(),
-                [this](auto& msg){ this->handleTachChange(msg); });
+            _bus, match.c_str(),
+            [this](auto& msg) { this->handleTachChange(msg); });
 
         if (_hasTarget)
         {
             match = getMatchString(_interface);
 
             targetSignal = std::make_unique<sdbusplus::server::match::match>(
-                    _bus,
-                    match.c_str(),
-                    [this](auto& msg){ this->handleTargetChange(msg); });
+                _bus, match.c_str(),
+                [this](auto& msg) { this->handleTargetChange(msg); });
         }
     }
 }
 
 std::string TachSensor::getMatchString(const std::string& interface)
 {
-    return sdbusplus::bus::match::rules::propertiesChanged(
-            _name, interface);
+    return sdbusplus::bus::match::rules::propertiesChanged(_name, interface);
 }
 
 uint64_t TachSensor::getTarget() const
@@ -174,11 +151,10 @@
  * @param[in] propertName - the name of the property
  * @param[out] value - the value to store the property value in
  */
-template<typename T>
+template <typename T>
 static void readPropertyFromMessage(sdbusplus::message::message& msg,
                                     const std::string& interface,
-                                    const std::string& propertyName,
-                                    T& value)
+                                    const std::string& propertyName, T& value)
 {
     std::string sensor;
     std::map<std::string, std::variant<T>> data;
@@ -194,28 +170,21 @@
     }
 }
 
-
 void TachSensor::handleTargetChange(sdbusplus::message::message& msg)
 {
-    readPropertyFromMessage(msg,
-                            _interface,
-                            FAN_TARGET_PROPERTY,
-                            _tachTarget);
+    readPropertyFromMessage(msg, _interface, FAN_TARGET_PROPERTY, _tachTarget);
 
-    //Check all tach sensors on the fan against the target
+    // Check all tach sensors on the fan against the target
     _fan.tachChanged();
 }
 
-
 void TachSensor::handleTachChange(sdbusplus::message::message& msg)
 {
-   readPropertyFromMessage(msg,
-                           FAN_SENSOR_VALUE_INTF,
-                           FAN_VALUE_PROPERTY,
-                           _tachInput);
+    readPropertyFromMessage(msg, FAN_SENSOR_VALUE_INTF, FAN_VALUE_PROPERTY,
+                            _tachInput);
 
-   //Check just this sensor against the target
-   _fan.tachChanged(*this);
+    // Check just this sensor against the target
+    _fan.tachChanged(*this);
 }
 
 void TachSensor::startTimer(TimerMode mode)
@@ -231,40 +200,34 @@
 {
     using namespace std::chrono;
 
-    switch(mode)
+    switch (mode)
     {
-        case TimerMode::nonfunc :
-                return duration_cast<microseconds>(seconds(_timeout));
-        case TimerMode::func :
-                return duration_cast<microseconds>(seconds(_funcDelay));
-        default :
-                // Log an internal error for undefined timer mode
-                log<level::ERR>("Undefined timer mode",
-                        entry("TIMER_MODE=%u", mode));
-                elog<InternalFailure>();
-                return duration_cast<microseconds>(seconds(0));
+        case TimerMode::nonfunc:
+            return duration_cast<microseconds>(seconds(_timeout));
+        case TimerMode::func:
+            return duration_cast<microseconds>(seconds(_funcDelay));
+        default:
+            // Log an internal error for undefined timer mode
+            log<level::ERR>("Undefined timer mode",
+                            entry("TIMER_MODE=%u", mode));
+            elog<InternalFailure>();
+            return duration_cast<microseconds>(seconds(0));
     }
 }
 
 void TachSensor::updateInventory(bool functional)
 {
-    auto objectMap = util::getObjMap<bool>(
-            _invName,
-            util::OPERATIONAL_STATUS_INTF,
-            util::FUNCTIONAL_PROPERTY,
-            functional);
+    auto objectMap =
+        util::getObjMap<bool>(_invName, util::OPERATIONAL_STATUS_INTF,
+                              util::FUNCTIONAL_PROPERTY, functional);
     auto response = util::SDBusPlus::lookupAndCallMethod(
-            _bus,
-            util::INVENTORY_PATH,
-            util::INVENTORY_INTF,
-            "Notify",
-            objectMap);
+        _bus, util::INVENTORY_PATH, util::INVENTORY_INTF, "Notify", objectMap);
     if (response.is_method_error())
     {
         log<level::ERR>("Error in notify update of tach sensor inventory");
     }
 }
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp
index b2b9c50..7ad3c79 100644
--- a/monitor/tach_sensor.hpp
+++ b/monitor/tach_sensor.hpp
@@ -1,12 +1,13 @@
 #pragma once
 
-#include <chrono>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server.hpp>
 #include <sdeventplus/clock.hpp>
 #include <sdeventplus/event.hpp>
 #include <sdeventplus/utility/timer.hpp>
 
+#include <chrono>
+
 namespace phosphor
 {
 namespace fan
@@ -54,268 +55,259 @@
  */
 class TachSensor
 {
-    public:
+  public:
+    TachSensor() = delete;
+    TachSensor(const TachSensor&) = delete;
+    // TachSensor is not moveable since the this pointer is used as systemd
+    // callback context.
+    TachSensor(TachSensor&&) = delete;
+    TachSensor& operator=(const TachSensor&) = delete;
+    TachSensor& operator=(TachSensor&&) = delete;
+    ~TachSensor() = default;
 
-        TachSensor() = delete;
-        TachSensor(const TachSensor&) = delete;
-        // TachSensor is not moveable since the this pointer is used as systemd
-        // callback context.
-        TachSensor(TachSensor&&) = delete;
-        TachSensor& operator=(const TachSensor&) = delete;
-        TachSensor& operator=(TachSensor&&) = delete;
-        ~TachSensor() = default;
+    /**
+     * @brief Constructor
+     *
+     * @param[in] mode - mode of fan monitor
+     * @param[in] bus - the dbus object
+     * @param[in] fan - the parent fan object
+     * @param[in] id - the id of the sensor
+     * @param[in] hasTarget - if the sensor supports
+     *                        setting the speed
+     * @param[in] funcDelay - Delay to mark functional
+     * @param[in] interface - the interface of the target
+     * @param[in] factor - the factor of the sensor target
+     * @param[in] offset - the offset of the sensor target
+     * @param[in] timeout - Normal timeout value to use
+     * @param[in] event - Event loop reference
+     */
+    TachSensor(Mode mode, sdbusplus::bus::bus& bus, Fan& fan,
+               const std::string& id, bool hasTarget, size_t funcDelay,
+               const std::string& interface, double factor, int64_t offset,
+               size_t timeout, const sdeventplus::Event& event);
 
-        /**
-         * @brief Constructor
-         *
-         * @param[in] mode - mode of fan monitor
-         * @param[in] bus - the dbus object
-         * @param[in] fan - the parent fan object
-         * @param[in] id - the id of the sensor
-         * @param[in] hasTarget - if the sensor supports
-         *                        setting the speed
-         * @param[in] funcDelay - Delay to mark functional
-         * @param[in] interface - the interface of the target
-         * @param[in] factor - the factor of the sensor target
-         * @param[in] offset - the offset of the sensor target
-         * @param[in] timeout - Normal timeout value to use
-         * @param[in] event - Event loop reference
-         */
-        TachSensor(Mode mode,
-                   sdbusplus::bus::bus& bus,
-                   Fan& fan,
-                   const std::string& id,
-                   bool hasTarget,
-                   size_t funcDelay,
-                   const std::string& interface,
-                   double factor,
-                   int64_t offset,
-                   size_t timeout,
-                   const sdeventplus::Event& event);
+    /**
+     * @brief Returns the target speed value
+     */
+    uint64_t getTarget() const;
 
-        /**
-         * @brief Returns the target speed value
-         */
-        uint64_t getTarget() const;
+    /**
+     * @brief Returns the input speed value
+     */
+    inline int64_t getInput() const
+    {
+        return _tachInput;
+    }
 
-        /**
-         * @brief Returns the input speed value
-         */
-        inline int64_t getInput() const
-        {
-            return _tachInput;
-        }
+    /**
+     * @brief Returns true if sensor has a target
+     */
+    inline bool hasTarget() const
+    {
+        return _hasTarget;
+    }
 
-        /**
-         * @brief Returns true if sensor has a target
-         */
-        inline bool hasTarget() const
-        {
-            return _hasTarget;
-        }
+    /**
+     * @brief Returns the interface of the sensor target
+     */
+    inline std::string getInterface() const
+    {
+        return _interface;
+    }
 
-        /**
-         * @brief Returns the interface of the sensor target
-         */
-        inline std::string getInterface() const
-        {
-            return _interface;
-        }
+    /**
+     * @brief Returns the factor of the sensor target
+     */
+    inline double getFactor() const
+    {
+        return _factor;
+    }
 
-        /**
-         * @brief Returns the factor of the sensor target
-         */
-        inline double getFactor() const
-        {
-            return _factor;
-        }
+    /**
+     * @brief Returns the offset of the sensor target
+     */
+    inline int64_t getOffset() const
+    {
+        return _offset;
+    }
 
-        /**
-         * @brief Returns the offset of the sensor target
-         */
-        inline int64_t getOffset() const
-        {
-            return _offset;
-        }
+    /**
+     * Returns true if the hardware behind this
+     * sensor is considered working OK/functional.
+     */
+    inline bool functional() const
+    {
+        return _functional;
+    }
 
-        /**
-         * Returns true if the hardware behind this
-         * sensor is considered working OK/functional.
-         */
-        inline bool functional() const
-        {
-            return _functional;
-        }
+    /**
+     * Set the functional status and update inventory to match
+     */
+    void setFunctional(bool functional);
 
-        /**
-         * Set the functional status and update inventory to match
-         */
-        void setFunctional(bool functional);
+    /**
+     * @brief Says if the timer is running or not
+     *
+     * @return bool - if timer is currently running
+     */
+    inline bool timerRunning()
+    {
+        return _timer.isEnabled();
+    }
 
-        /**
-         * @brief Says if the timer is running or not
-         *
-         * @return bool - if timer is currently running
-         */
-        inline bool timerRunning()
-        {
-            return _timer.isEnabled();
-        }
+    /**
+     * @brief Stops the timer when the given mode differs and starts
+     * the associated timer for the mode given if not already running
+     *
+     * @param[in] mode - mode of timer to start
+     */
+    void startTimer(TimerMode mode);
 
-        /**
-         * @brief Stops the timer when the given mode differs and starts
-         * the associated timer for the mode given if not already running
-         *
-         * @param[in] mode - mode of timer to start
-         */
-        void startTimer(TimerMode mode);
+    /**
+     * @brief Stops the timer
+     */
+    inline void stopTimer()
+    {
+        _timer.setEnabled(false);
+    }
 
-        /**
-         * @brief Stops the timer
-         */
-        inline void stopTimer()
-        {
-            _timer.setEnabled(false);
-        }
+    /**
+     * @brief Return the given timer mode's delay time
+     *
+     * @param[in] mode - mode of timer to get delay time for
+     */
+    std::chrono::microseconds getDelay(TimerMode mode);
 
-        /**
-         * @brief Return the given timer mode's delay time
-         *
-         * @param[in] mode - mode of timer to get delay time for
-         */
-        std::chrono::microseconds getDelay(TimerMode mode);
+    /**
+     * Returns the sensor name
+     */
+    inline const std::string& name() const
+    {
+        return _name;
+    };
 
-        /**
-         * Returns the sensor name
-         */
-        inline const std::string& name() const
-        {
-            return _name;
-        };
+  private:
+    /**
+     * @brief Returns the match string to use for matching
+     *        on a properties changed signal.
+     */
+    std::string getMatchString(const std::string& interface);
 
-    private:
+    /**
+     * @brief Reads the Target property and stores in _tachTarget.
+     *        Also calls Fan::tachChanged().
+     *
+     * @param[in] msg - the dbus message
+     */
+    void handleTargetChange(sdbusplus::message::message& msg);
 
-        /**
-         * @brief Returns the match string to use for matching
-         *        on a properties changed signal.
-         */
-        std::string getMatchString(const std::string& interface);
+    /**
+     * @brief Reads the Value property and stores in _tachInput.
+     *        Also calls Fan::tachChanged().
+     *
+     * @param[in] msg - the dbus message
+     */
+    void handleTachChange(sdbusplus::message::message& msg);
 
-        /**
-         * @brief Reads the Target property and stores in _tachTarget.
-         *        Also calls Fan::tachChanged().
-         *
-         * @param[in] msg - the dbus message
-         */
-        void handleTargetChange(sdbusplus::message::message& msg);
+    /**
+     * @brief Updates the Functional property in the inventory
+     *        for this tach sensor based on the value passed in.
+     *
+     * @param[in] functional - If the Functional property should
+     *                         be set to true or false.
+     */
+    void updateInventory(bool functional);
 
-        /**
-         * @brief Reads the Value property and stores in _tachInput.
-         *        Also calls Fan::tachChanged().
-         *
-         * @param[in] msg - the dbus message
-         */
-        void handleTachChange(sdbusplus::message::message& msg);
+    /**
+     * @brief the dbus object
+     */
+    sdbusplus::bus::bus& _bus;
 
-        /**
-         * @brief Updates the Functional property in the inventory
-         *        for this tach sensor based on the value passed in.
-         *
-         * @param[in] functional - If the Functional property should
-         *                         be set to true or false.
-         */
-        void updateInventory(bool functional);
+    /**
+     * @brief Reference to the parent Fan object
+     */
+    Fan& _fan;
 
-        /**
-         * @brief the dbus object
-         */
-        sdbusplus::bus::bus& _bus;
+    /**
+     * @brief The name of the sensor, including the full path
+     *
+     * For example /xyz/openbmc_project/sensors/fan_tach/fan0
+     */
+    const std::string _name;
 
-        /**
-         * @brief Reference to the parent Fan object
-         */
-        Fan& _fan;
+    /**
+     * @brief The inventory name of the sensor, including the full path
+     */
+    const std::string _invName;
 
-        /**
-         * @brief The name of the sensor, including the full path
-         *
-         * For example /xyz/openbmc_project/sensors/fan_tach/fan0
-         */
-        const std::string _name;
+    /**
+     * @brief If functional (not too slow).  The parent
+     *        fan object sets this.
+     */
+    bool _functional;
 
-        /**
-         * @brief The inventory name of the sensor, including the full path
-         */
-        const std::string _invName;
+    /**
+     * @brief If the sensor has a Target property (can set speed)
+     */
+    const bool _hasTarget;
 
-        /**
-         * @brief If functional (not too slow).  The parent
-         *        fan object sets this.
-         */
-        bool _functional;
+    /**
+     * @brief Amount of time to delay updating to functional
+     */
+    const size_t _funcDelay;
 
-        /**
-         * @brief If the sensor has a Target property (can set speed)
-         */
-        const bool _hasTarget;
+    /**
+     * @brief The interface that the target implements
+     */
+    const std::string _interface;
 
-        /**
-         * @brief Amount of time to delay updating to functional
-         */
-        const size_t _funcDelay;
+    /**
+     * @brief The factor of target to get fan rpm
+     */
+    const double _factor;
 
-        /**
-         * @brief The interface that the target implements
-         */
-        const std::string _interface;
+    /**
+     * @brief The offset of target to get fan rpm
+     */
+    const int64_t _offset;
 
-        /**
-         * @brief The factor of target to get fan rpm
-         */
-        const double _factor;
+    /**
+     * @brief The input speed, from the Value dbus property
+     */
+    int64_t _tachInput = 0;
 
-        /**
-         * @brief The offset of target to get fan rpm
-         */
-        const int64_t _offset;
+    /**
+     * @brief The current target speed, from the Target dbus property
+     *        (if applicable)
+     */
+    uint64_t _tachTarget = 0;
 
-        /**
-         * @brief The input speed, from the Value dbus property
-         */
-        int64_t _tachInput = 0;
+    /**
+     * @brief The timeout value to use
+     */
+    const size_t _timeout;
 
-        /**
-         * @brief The current target speed, from the Target dbus property
-         *        (if applicable)
-         */
-        uint64_t _tachTarget = 0;
+    /**
+     * @brief Mode that current timer is in
+     */
+    TimerMode _timerMode;
 
-        /**
-         * @brief The timeout value to use
-         */
-        const size_t _timeout;
+    /**
+     * The timer object
+     */
+    sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> _timer;
 
-        /**
-         * @brief Mode that current timer is in
-         */
-        TimerMode _timerMode;
+    /**
+     * @brief The match object for the Value properties changed signal
+     */
+    std::unique_ptr<sdbusplus::server::match::match> tachSignal;
 
-        /**
-         * The timer object
-         */
-        sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> _timer;
-
-        /**
-         * @brief The match object for the Value properties changed signal
-         */
-        std::unique_ptr<sdbusplus::server::match::match> tachSignal;
-
-        /**
-         * @brief The match object for the Target properties changed signal
-         */
-        std::unique_ptr<sdbusplus::server::match::match> targetSignal;
+    /**
+     * @brief The match object for the Target properties changed signal
+     */
+    std::unique_ptr<sdbusplus::server::match::match> targetSignal;
 };
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/trust_group.hpp b/monitor/trust_group.hpp
index 07d6a0e..e9367e2 100644
--- a/monitor/trust_group.hpp
+++ b/monitor/trust_group.hpp
@@ -1,7 +1,8 @@
 #pragma once
-#include <memory>
 #include "tach_sensor.hpp"
 
+#include <memory>
+
 namespace phosphor
 {
 namespace fan
@@ -11,8 +12,7 @@
 
 constexpr auto sensorName = 0;
 constexpr auto inTrust = 1;
-using GroupDefinition = std::tuple<std::string,
-                                        bool>;
+using GroupDefinition = std::tuple<std::string, bool>;
 
 struct GroupSensor
 {
@@ -42,213 +42,192 @@
  */
 class Group
 {
-    public:
+  public:
+    Group() = delete;
+    virtual ~Group() = default;
+    Group(const Group&) = delete;
+    Group& operator=(const Group&) = delete;
+    Group(Group&&) = default;
+    Group& operator=(Group&&) = default;
 
-        Group() = delete;
-        virtual ~Group() = default;
-        Group(const Group&) = delete;
-        Group& operator=(const Group&) = delete;
-        Group(Group&&) = default;
-        Group& operator=(Group&&) = default;
+    /**
+     * Constructor
+     *
+     * @param[in] names - the names and inclusion of sensors in the group
+     */
+    explicit Group(const std::vector<GroupDefinition>& names) : _names(names)
+    {}
 
-        /**
-         * Constructor
-         *
-         * @param[in] names - the names and inclusion of sensors in the group
-         */
-        explicit Group(const std::vector<GroupDefinition>& names) :
-                _names(names)
+    /**
+     * Used to register a TachSensor object with the group.
+     * It's only added to the group if the sensor's name is
+     * in the group's list of names.
+     *
+     * @param[in] sensor - the TachSensor to register
+     */
+    void registerSensor(std::shared_ptr<monitor::TachSensor>& sensor)
+    {
+        auto found = std::find_if(
+            _names.begin(), _names.end(), [&sensor](const auto& name) {
+                return monitor::FAN_SENSOR_PATH + std::get<sensorName>(name) ==
+                       sensor->name();
+            });
+
+        if (found != _names.end())
         {
+            _sensors.push_back({sensor, std::get<inTrust>(*found)});
         }
+    }
 
-        /**
-         * Used to register a TachSensor object with the group.
-         * It's only added to the group if the sensor's name is
-         * in the group's list of names.
-         *
-         * @param[in] sensor - the TachSensor to register
-         */
-        void registerSensor(std::shared_ptr<monitor::TachSensor>& sensor)
-        {
-            auto found = std::find_if(
-                    _names.begin(),
-                    _names.end(),
-                    [&sensor](const auto& name)
-                    {
-                        return monitor::FAN_SENSOR_PATH +
-                                std::get<sensorName>(name) == sensor->name();
-                    });
+    /**
+     * Says if a sensor belongs to the group.
+     *
+     * After all sensors have registered, this can be
+     * used to say if a TachSensor is in the group.
+     *
+     * @param[in] sensor - the TachSensor object
+     */
+    bool inGroup(const monitor::TachSensor& sensor)
+    {
+        return (std::find_if(_sensors.begin(), _sensors.end(),
+                             [&sensor](const auto& s) {
+                                 return sensor.name() == s.sensor->name();
+                             }) != _sensors.end());
+    }
 
-            if (found != _names.end())
+    /**
+     * Stops the timers on all sensors in the group.
+     *
+     * Called when the group just changed to not trusted,
+     * so that its sensors' timers can't fire a callback
+     * that may cause them to be considered faulted.
+     */
+    void stopTimers()
+    {
+        std::for_each(_sensors.begin(), _sensors.end(),
+                      [](const auto& s) { s.sensor->stopTimer(); });
+    }
+
+    /**
+     * Starts the timers on all functional sensors in the group if
+     * their target and input values do not match.
+     *
+     * Called when the group just changed to trusted.
+     */
+    void startTimers()
+    {
+        std::for_each(_sensors.begin(), _sensors.end(), [](const auto& s) {
+            // If a sensor isn't functional, then its timer
+            // already expired so don't bother starting it again
+            if (s.sensor->functional() &&
+                static_cast<uint64_t>(s.sensor->getInput()) !=
+                    s.sensor->getTarget())
             {
-                _sensors.push_back({sensor, std::get<inTrust>(*found)});
+                s.sensor->startTimer(
+                    phosphor::fan::monitor::TimerMode::nonfunc);
             }
-        }
+        });
+    }
 
-        /**
-         * Says if a sensor belongs to the group.
-         *
-         * After all sensors have registered, this can be
-         * used to say if a TachSensor is in the group.
-         *
-         * @param[in] sensor - the TachSensor object
-         */
-         bool inGroup(const monitor::TachSensor& sensor)
-         {
-             return (std::find_if(
-                     _sensors.begin(),
-                     _sensors.end(),
-                     [&sensor](const auto& s)
-                     {
-                         return sensor.name() == s.sensor->name();
-                     }) != _sensors.end());
-         }
-
-        /**
-         * Stops the timers on all sensors in the group.
-         *
-         * Called when the group just changed to not trusted,
-         * so that its sensors' timers can't fire a callback
-         * that may cause them to be considered faulted.
-         */
-        void stopTimers()
+    /**
+     * Determines the trust for this group based on this
+     * sensor's latest status.
+     *
+     * Calls the derived class's checkGroupTrust function
+     * and updates the class with the results.
+     *
+     * If this is called with a sensor not in the group,
+     * it will be considered trusted.
+     *
+     * @param[in] sensor - TachSensor object
+     *
+     * @return tuple<bool, bool> -
+     *   field 0 - the trust value
+     *   field 1 - if that trust value changed since last call
+     *             to checkTrust
+     */
+    auto checkTrust(const monitor::TachSensor& sensor)
+    {
+        if (inGroup(sensor))
         {
-            std::for_each(
-                    _sensors.begin(),
-                    _sensors.end(),
-                    [](const auto& s)
-                    {
-                        s.sensor->stopTimer();
-                    });
+            auto trust = checkGroupTrust();
+
+            setTrust(trust);
+
+            return std::tuple<bool, bool>(_trusted, _stateChange);
         }
+        return std::tuple<bool, bool>(true, false);
+    }
 
-        /**
-         * Starts the timers on all functional sensors in the group if
-         * their target and input values do not match.
-         *
-         * Called when the group just changed to trusted.
-         */
-        void startTimers()
-        {
-            std::for_each(
-                    _sensors.begin(),
-                    _sensors.end(),
-                    [](const auto& s)
-                    {
-                        //If a sensor isn't functional, then its timer
-                        //already expired so don't bother starting it again
-                        if (s.sensor->functional() &&
-                            static_cast<uint64_t>(
-                                s.sensor->getInput()) !=
-                                    s.sensor->getTarget())
-                        {
-                            s.sensor->startTimer(
-                                phosphor::fan::monitor::TimerMode::nonfunc);
-                        }
-                    });
-        }
+    /**
+     * Says if all sensors in the group are currently trusted,
+     * as determined by the last call to checkTrust().
+     *
+     * @return bool - if the group's sensors are trusted or not
+     */
+    inline auto getTrust() const
+    {
+        return _trusted;
+    }
 
-        /**
-         * Determines the trust for this group based on this
-         * sensor's latest status.
-         *
-         * Calls the derived class's checkGroupTrust function
-         * and updates the class with the results.
-         *
-         * If this is called with a sensor not in the group,
-         * it will be considered trusted.
-         *
-         * @param[in] sensor - TachSensor object
-         *
-         * @return tuple<bool, bool> -
-         *   field 0 - the trust value
-         *   field 1 - if that trust value changed since last call
-         *             to checkTrust
-         */
-        auto checkTrust(const monitor::TachSensor& sensor)
-        {
-            if (inGroup(sensor))
-            {
-                auto trust = checkGroupTrust();
+    /**
+     * Says if the trust value changed in the last call to
+     * checkTrust()
+     *
+     * @return bool - if the trust changed or not
+     */
+    inline auto trustChanged() const
+    {
+        return _stateChange;
+    }
 
-                setTrust(trust);
+  protected:
+    /**
+     * The sensor objects and their trust inclusion in the group.
+     *
+     * Added by registerSensor().
+     */
+    std::vector<GroupSensor> _sensors;
 
-                return std::tuple<bool, bool>(_trusted, _stateChange);
-            }
-            return std::tuple<bool, bool>(true, false);
-        }
+  private:
+    /**
+     * Checks if the group's sensors are trusted.
+     *
+     * The derived class must override this function
+     * to provide custom functionality.
+     *
+     * @return bool - if group is trusted or not
+     */
+    virtual bool checkGroupTrust() = 0;
 
-        /**
-         * Says if all sensors in the group are currently trusted,
-         * as determined by the last call to checkTrust().
-         *
-         * @return bool - if the group's sensors are trusted or not
-         */
-        inline auto getTrust() const
-        {
-            return _trusted;
-        }
+    /**
+     * Sets the trust value on the object.
+     *
+     * @param[in] trust - the new trust value
+     */
+    inline void setTrust(bool trust)
+    {
+        _stateChange = (trust != _trusted);
+        _trusted = trust;
+    }
 
-        /**
-         * Says if the trust value changed in the last call to
-         * checkTrust()
-         *
-         * @return bool - if the trust changed or not
-         */
-        inline auto trustChanged() const
-        {
-            return _stateChange;
-        }
+    /**
+     * The current trust state of the group
+     */
+    bool _trusted = true;
 
-    protected:
+    /**
+     * If the trust value changed in the last call to checkTrust
+     */
+    bool _stateChange = false;
 
-        /**
-         * The sensor objects and their trust inclusion in the group.
-         *
-         * Added by registerSensor().
-         */
-        std::vector<GroupSensor> _sensors;
-
-    private:
-
-        /**
-         * Checks if the group's sensors are trusted.
-         *
-         * The derived class must override this function
-         * to provide custom functionality.
-         *
-         * @return bool - if group is trusted or not
-         */
-        virtual bool checkGroupTrust() = 0;
-
-        /**
-         * Sets the trust value on the object.
-         *
-         * @param[in] trust - the new trust value
-         */
-        inline void setTrust(bool trust)
-        {
-            _stateChange = (trust != _trusted);
-            _trusted = trust;
-        }
-
-        /**
-         * The current trust state of the group
-         */
-        bool _trusted = true;
-
-        /**
-         * If the trust value changed in the last call to checkTrust
-         */
-        bool _stateChange = false;
-
-        /**
-         * The names of the sensors and whether it is included in
-         * determining trust for this group
-         */
-        const std::vector<GroupDefinition> _names;
+    /**
+     * The names of the sensors and whether it is included in
+     * determining trust for this group
+     */
+    const std::vector<GroupDefinition> _names;
 };
 
-}
-}
-}
+} // namespace trust
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/trust_manager.hpp b/monitor/trust_manager.hpp
index 031d890..1925003 100644
--- a/monitor/trust_manager.hpp
+++ b/monitor/trust_manager.hpp
@@ -1,11 +1,12 @@
 #pragma once
 
-#include <memory>
-#include <vector>
 #include "tach_sensor.hpp"
 #include "trust_group.hpp"
 #include "types.hpp"
 
+#include <memory>
+#include <vector>
+
 namespace phosphor
 {
 namespace fan
@@ -27,120 +28,112 @@
  */
 class Manager
 {
-    public:
+  public:
+    Manager() = delete;
+    Manager(const Manager&) = delete;
+    Manager& operator=(const Manager&) = delete;
+    Manager(Manager&&) = default;
+    Manager& operator=(Manager&&) = default;
+    ~Manager() = default;
 
-        Manager() = delete;
-        Manager(const Manager&) = delete;
-        Manager& operator=(const Manager&) = delete;
-        Manager(Manager&&) = default;
-        Manager& operator=(Manager&&) = default;
-        ~Manager() = default;
-
-        /**
-         * Constructor
-         *
-         * @param[in] functions - trust group creation function vector
-         */
-        explicit Manager(const std::vector<monitor::CreateGroupFunction>& functions)
+    /**
+     * Constructor
+     *
+     * @param[in] functions - trust group creation function vector
+     */
+    explicit Manager(const std::vector<monitor::CreateGroupFunction>& functions)
+    {
+        for (auto& create : functions)
         {
-            for (auto& create : functions)
-            {
-                groups.emplace_back(create());
-            }
+            groups.emplace_back(create());
         }
+    }
 
-        /**
-         * Says if trust groups have been created and
-         * need to be checked.
-         *
-         * @return bool - If there are any trust groups
-         */
-        inline bool active() const
+    /**
+     * Says if trust groups have been created and
+     * need to be checked.
+     *
+     * @return bool - If there are any trust groups
+     */
+    inline bool active() const
+    {
+        return !groups.empty();
+    }
+
+    /**
+     * Checks if a sensor value can be trusted
+     *
+     * Checks if the sensor is trusted in each group
+     * it belongs to.  Only considered trusted if it is
+     * trusted in all groups it belongs to.
+     *
+     * While checking group trust, the code will also check
+     * if the trust status has just changed.  If the status
+     * just changed to false, it will stop the tach error
+     * timers for that group so these untrusted sensors won't
+     * cause errors.  If changed to true, it will start those timers
+     * back up again.
+     *
+     * Note this means groups should be designed such that
+     * in the same call to this function a sensor shouldn't
+     * make one group change to trusted and another to untrusted.
+     *
+     * @param[in] sensor - the sensor to check
+     *
+     * @return bool - if sensor is trusted in all groups or not
+     */
+    bool checkTrust(const monitor::TachSensor& sensor)
+    {
+        auto trusted = true;
+
+        for (auto& group : groups)
         {
-            return !groups.empty();
-        }
-
-        /**
-         * Checks if a sensor value can be trusted
-         *
-         * Checks if the sensor is trusted in each group
-         * it belongs to.  Only considered trusted if it is
-         * trusted in all groups it belongs to.
-         *
-         * While checking group trust, the code will also check
-         * if the trust status has just changed.  If the status
-         * just changed to false, it will stop the tach error
-         * timers for that group so these untrusted sensors won't
-         * cause errors.  If changed to true, it will start those timers
-         * back up again.
-         *
-         * Note this means groups should be designed such that
-         * in the same call to this function a sensor shouldn't
-         * make one group change to trusted and another to untrusted.
-         *
-         * @param[in] sensor - the sensor to check
-         *
-         * @return bool - if sensor is trusted in all groups or not
-         */
-        bool checkTrust(
-                const monitor::TachSensor& sensor)
-        {
-            auto trusted = true;
-
-            for (auto& group : groups)
+            if (group->inGroup(sensor))
             {
-                if (group->inGroup(sensor))
+                bool trust, changed;
+                std::tie(trust, changed) = group->checkTrust(sensor);
+
+                if (!trust)
                 {
-                    bool trust, changed;
-                    std::tie(trust, changed) = group->checkTrust(sensor);
+                    trusted = false;
 
-                    if (!trust)
+                    if (changed)
                     {
-                        trusted = false;
-
-                        if (changed)
-                        {
-                            group->stopTimers();
-                        }
+                        group->stopTimers();
                     }
-                    else
+                }
+                else
+                {
+                    if (changed)
                     {
-                        if (changed)
-                        {
-                            group->startTimers();
-                        }
+                        group->startTimers();
                     }
                 }
             }
-
-            return trusted;
         }
 
-        /**
-         * Registers a sensor with any trust groups that are interested
-         *
-         * @param[in] sensor - the sensor to register
-         */
-        void registerSensor(
-                std::shared_ptr<monitor::TachSensor>& sensor)
-        {
-            std::for_each(
-                    groups.begin(),
-                    groups.end(),
-                    [&sensor](auto& group)
-                    {
-                        group->registerSensor(sensor);
-                    });
-        }
+        return trusted;
+    }
 
-    private:
+    /**
+     * Registers a sensor with any trust groups that are interested
+     *
+     * @param[in] sensor - the sensor to register
+     */
+    void registerSensor(std::shared_ptr<monitor::TachSensor>& sensor)
+    {
+        std::for_each(groups.begin(), groups.end(), [&sensor](auto& group) {
+            group->registerSensor(sensor);
+        });
+    }
 
-        /**
-         * The list of sensor trust groups
-         */
-        std::vector<std::unique_ptr<Group>> groups;
+  private:
+    /**
+     * The list of sensor trust groups
+     */
+    std::vector<std::unique_ptr<Group>> groups;
 };
 
-}
-}
-}
+} // namespace trust
+} // namespace fan
+} // namespace phosphor
diff --git a/monitor/types.hpp b/monitor/types.hpp
index 3048961..c827042 100644
--- a/monitor/types.hpp
+++ b/monitor/types.hpp
@@ -1,11 +1,12 @@
 #pragma once
 
+#include "trust_group.hpp"
+
+#include <experimental/optional>
 #include <functional>
 #include <string>
 #include <tuple>
 #include <vector>
-#include <experimental/optional>
-#include "trust_group.hpp"
 
 namespace phosphor
 {
@@ -17,22 +18,16 @@
 constexpr auto propObj = 0;
 constexpr auto propIface = 1;
 constexpr auto propName = 2;
-using PropertyIdentity = std::tuple<std::string,
-                                    std::string,
-                                    std::string>;
+using PropertyIdentity = std::tuple<std::string, std::string, std::string>;
 
-using PropertyValue = std::variant<bool,
-                                   int64_t,
-                                   std::string>;
+using PropertyValue = std::variant<bool, int64_t, std::string>;
 constexpr auto propIdentity = 0;
 constexpr auto propValue = 1;
-using PropertyState = std::pair<PropertyIdentity,
-                                PropertyValue>;
+using PropertyState = std::pair<PropertyIdentity, PropertyValue>;
 
 using Condition = std::function<bool(sdbusplus::bus::bus&)>;
 
-using CreateGroupFunction =
-        std::function<std::unique_ptr<trust::Group>()>;
+using CreateGroupFunction = std::function<std::unique_ptr<trust::Group>()>;
 
 constexpr auto sensorNameField = 0;
 constexpr auto hasTargetField = 1;
@@ -40,11 +35,8 @@
 constexpr auto factorField = 3;
 constexpr auto offsetField = 4;
 
-using SensorDefinition = std::tuple<std::string,
-                                    bool,
-                                    std::string,
-                                    double,
-                                    int64_t>;
+using SensorDefinition =
+    std::tuple<std::string, bool, std::string, double, int64_t>;
 
 constexpr auto fanNameField = 0;
 constexpr auto funcDelay = 1;
@@ -54,14 +46,10 @@
 constexpr auto sensorListField = 5;
 constexpr auto conditionField = 6;
 
-using FanDefinition = std::tuple<std::string,
-                                 size_t,
-                                 size_t,
-                                 size_t,
-                                 size_t,
+using FanDefinition = std::tuple<std::string, size_t, size_t, size_t, size_t,
                                  std::vector<SensorDefinition>,
                                  std::experimental::optional<Condition>>;
 
-}
-}
-}
+} // namespace monitor
+} // namespace fan
+} // namespace phosphor