clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version.  The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Id77d01d036ba05e52cdda0e6c6fbc47842e9baf8
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
 IndentWrappedFunctionNames: true
 InsertNewlineAtEOF: true
 KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
 LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
@@ -98,13 +98,14 @@
 ObjCSpaceBeforeProtocolList: true
 PackConstructorInitializers: BinPack
 PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
 PointerAlignment: Left
 QualifierAlignment: Left
 ReferenceAlignment: Left
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index 998c7b9..913190f 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -85,64 +85,67 @@
     conn->async_method_call(
         [conn, &i2cConfigLoaded](const boost::system::error_code ec,
                                  const GetSubTreeType& resp) {
-        if (ec || resp.size() != 1)
-        {
-            return;
-        }
-        if (resp[0].second.begin() == resp[0].second.end())
-            return;
-        const std::string& objPath = resp[0].first;
-        const std::string& serviceName = resp[0].second.begin()->first;
+            if (ec || resp.size() != 1)
+            {
+                return;
+            }
+            if (resp[0].second.begin() == resp[0].second.end())
+                return;
+            const std::string& objPath = resp[0].first;
+            const std::string& serviceName = resp[0].second.begin()->first;
 
-        const std::string match = "Baseboard/PFR";
-        if (boost::ends_with(objPath, match))
-        {
-            // PFR object found.. check for PFR support
-            conn->async_method_call(
-                [objPath, serviceName, conn, &i2cConfigLoaded](
-                    boost::system::error_code ec,
-                    const std::vector<std::pair<
-                        std::string, std::variant<std::string, uint64_t>>>&
-                        propertiesList) {
-                if (ec)
-                {
-                    phosphor::logging::log<phosphor::logging::level::ERR>(
-                        "Error to Get PFR properties.",
-                        phosphor::logging::entry("MSG=%s",
-                                                 ec.message().c_str()));
-                    return;
-                }
+            const std::string match = "Baseboard/PFR";
+            if (boost::ends_with(objPath, match))
+            {
+                // PFR object found.. check for PFR support
+                conn->async_method_call(
+                    [objPath, serviceName, conn, &i2cConfigLoaded](
+                        boost::system::error_code ec,
+                        const std::vector<std::pair<
+                            std::string, std::variant<std::string, uint64_t>>>&
+                            propertiesList) {
+                        if (ec)
+                        {
+                            phosphor::logging::log<
+                                phosphor::logging::level::ERR>(
+                                "Error to Get PFR properties.",
+                                phosphor::logging::entry("MSG=%s",
+                                                         ec.message().c_str()));
+                            return;
+                        }
 
-                const uint64_t* i2cBus = nullptr;
-                const uint64_t* address = nullptr;
+                        const uint64_t* i2cBus = nullptr;
+                        const uint64_t* address = nullptr;
 
-                for (const auto& [propName, propVariant] : propertiesList)
-                {
-                    if (propName == "Address")
-                    {
-                        address = std::get_if<uint64_t>(&propVariant);
-                    }
-                    else if (propName == "Bus")
-                    {
-                        i2cBus = std::get_if<uint64_t>(&propVariant);
-                    }
-                }
+                        for (const auto& [propName, propVariant] :
+                             propertiesList)
+                        {
+                            if (propName == "Address")
+                            {
+                                address = std::get_if<uint64_t>(&propVariant);
+                            }
+                            else if (propName == "Bus")
+                            {
+                                i2cBus = std::get_if<uint64_t>(&propVariant);
+                            }
+                        }
 
-                if ((address == nullptr) || (i2cBus == nullptr))
-                {
-                    phosphor::logging::log<phosphor::logging::level::ERR>(
-                        "Unable to read the pfr properties");
-                    return;
-                }
+                        if ((address == nullptr) || (i2cBus == nullptr))
+                        {
+                            phosphor::logging::log<
+                                phosphor::logging::level::ERR>(
+                                "Unable to read the pfr properties");
+                            return;
+                        }
 
-                i2cBusNumber = static_cast<int>(*i2cBus);
-                i2cSlaveAddress = static_cast<int>(*address);
-                i2cConfigLoaded = true;
-            },
-                serviceName, objPath, "org.freedesktop.DBus.Properties",
-                "GetAll", "xyz.openbmc_project.Configuration.PFR");
-        }
-    },
+                        i2cBusNumber = static_cast<int>(*i2cBus);
+                        i2cSlaveAddress = static_cast<int>(*address);
+                        i2cConfigLoaded = true;
+                    },
+                    serviceName, objPath, "org.freedesktop.DBus.Properties",
+                    "GetAll", "xyz.openbmc_project.Configuration.PFR");
+            }
+        },
         "xyz.openbmc_project.ObjectMapper",
         "/xyz/openbmc_project/object_mapper",
         "xyz.openbmc_project.ObjectMapper", "GetSubTree",
@@ -203,8 +206,8 @@
         uint8_t majorVer = cpldDev.i2cReadByteData(majorReg);
         uint8_t minorVer = cpldDev.i2cReadByteData(minorReg);
         // Major and Minor versions should be binary encoded strings.
-        std::string version = std::to_string(majorVer) + "." +
-                              std::to_string(minorVer);
+        std::string version =
+            std::to_string(majorVer) + "." + std::to_string(minorVer);
         return version;
     }
     catch (const std::exception& e)
diff --git a/service/src/mainapp.cpp b/service/src/mainapp.cpp
index b913e33..f7f8603 100644
--- a/service/src/mainapp.cpp
+++ b/service/src/mainapp.cpp
@@ -212,8 +212,8 @@
         return;
     }
 
-    std::string errorStr = it->second.second + "(MinorCode:0x" +
-                           toHexString(minorErrorCode) + ")";
+    std::string errorStr =
+        it->second.second + "(MinorCode:0x" + toHexString(minorErrorCode) + ")";
     std::string msgId = "OpenBMC.0.1." + it->second.first;
     sd_journal_send(
         "MESSAGE=%s", "Platform firmware resiliency error occurred.",
@@ -225,19 +225,19 @@
     handleLastCountChange(std::shared_ptr<sdbusplus::asio::connection> conn,
                           std::string eventName, uint8_t currentCount)
 {
-    sdbusplus::asio::setProperty(*conn, "xyz.openbmc_project.Settings",
-                                 "/xyz/openbmc_project/pfr/last_events",
-                                 "xyz.openbmc_project.PFR.LastEvents",
-                                 eventName, currentCount,
-                                 [](boost::system::error_code ec) {
-        if (ec)
-        {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "PFR: Unable to update currentCount",
-                phosphor::logging::entry("MSG=%s", ec.message().c_str()));
-            return;
-        }
-    });
+    sdbusplus::asio::setProperty(
+        *conn, "xyz.openbmc_project.Settings",
+        "/xyz/openbmc_project/pfr/last_events",
+        "xyz.openbmc_project.PFR.LastEvents", eventName, currentCount,
+        [](boost::system::error_code ec) {
+            if (ec)
+            {
+                phosphor::logging::log<phosphor::logging::level::ERR>(
+                    "PFR: Unable to update currentCount",
+                    phosphor::logging::entry("MSG=%s", ec.message().c_str()));
+                return;
+            }
+        });
     return;
 }
 
@@ -253,82 +253,83 @@
             const std::vector<
                 std::pair<std::string, std::variant<std::monostate, uint8_t>>>&
                 properties) {
-        if (ec)
-        {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "PFR: Unable get PFR last events",
-                phosphor::logging::entry("MSG=%s", ec.message().c_str()));
-            return;
-        }
-        uint8_t lastRecoveryCount = 0;
-        uint8_t lastPanicCount = 0;
-        uint8_t lastMajorErr = 0;
-        uint8_t lastMinorErr = 0;
-
-        try
-        {
-            sdbusplus::unpackProperties(
-                properties, "lastRecoveryCount", lastRecoveryCount,
-                "lastPanicCount", lastPanicCount, "lastMajorErr", lastMajorErr,
-                "lastMinorErr", lastMinorErr);
-        }
-        catch (const sdbusplus::exception::UnpackPropertyError& error)
-        {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "PFR: Unpack error",
-                phosphor::logging::entry("MSG=%s", error.what()));
-            return;
-        }
-
-        uint8_t currPanicCount = 0;
-        if (0 == readCpldReg(ActionType::panicCount, currPanicCount))
-        {
-            if (lastPanicCount != currPanicCount)
+            if (ec)
             {
-                // Update cached data to dbus and log redfish
-                // event by reading reason.
-                handleLastCountChange(conn, "lastPanicCount", currPanicCount);
-                if (currPanicCount)
+                phosphor::logging::log<phosphor::logging::level::ERR>(
+                    "PFR: Unable get PFR last events",
+                    phosphor::logging::entry("MSG=%s", ec.message().c_str()));
+                return;
+            }
+            uint8_t lastRecoveryCount = 0;
+            uint8_t lastPanicCount = 0;
+            uint8_t lastMajorErr = 0;
+            uint8_t lastMinorErr = 0;
+
+            try
+            {
+                sdbusplus::unpackProperties(
+                    properties, "lastRecoveryCount", lastRecoveryCount,
+                    "lastPanicCount", lastPanicCount, "lastMajorErr",
+                    lastMajorErr, "lastMinorErr", lastMinorErr);
+            }
+            catch (const sdbusplus::exception::UnpackPropertyError& error)
+            {
+                phosphor::logging::log<phosphor::logging::level::ERR>(
+                    "PFR: Unpack error",
+                    phosphor::logging::entry("MSG=%s", error.what()));
+                return;
+            }
+
+            uint8_t currPanicCount = 0;
+            if (0 == readCpldReg(ActionType::panicCount, currPanicCount))
+            {
+                if (lastPanicCount != currPanicCount)
                 {
-                    logLastPanicEvent();
+                    // Update cached data to dbus and log redfish
+                    // event by reading reason.
+                    handleLastCountChange(conn, "lastPanicCount",
+                                          currPanicCount);
+                    if (currPanicCount)
+                    {
+                        logLastPanicEvent();
+                    }
                 }
             }
-        }
 
-        uint8_t currRecoveryCount = 0;
-        if (0 == readCpldReg(ActionType::recoveryCount, currRecoveryCount))
-        {
-            if (lastRecoveryCount != currRecoveryCount)
+            uint8_t currRecoveryCount = 0;
+            if (0 == readCpldReg(ActionType::recoveryCount, currRecoveryCount))
             {
-                // Update cached data to dbus and log redfish
-                // event by reading reason.
-                handleLastCountChange(conn, "lastRecoveryCount",
-                                      currRecoveryCount);
-                if (currRecoveryCount)
+                if (lastRecoveryCount != currRecoveryCount)
                 {
-                    logLastRecoveryEvent();
+                    // Update cached data to dbus and log redfish
+                    // event by reading reason.
+                    handleLastCountChange(conn, "lastRecoveryCount",
+                                          currRecoveryCount);
+                    if (currRecoveryCount)
+                    {
+                        logLastRecoveryEvent();
+                    }
                 }
             }
-        }
 
-        uint8_t majorErr = 0;
-        uint8_t minorErr = 0;
-        if ((0 == readCpldReg(ActionType::majorError, majorErr)) &&
-            (0 == readCpldReg(ActionType::minorError, minorErr)))
-        {
-            if ((lastMajorErr != majorErr) || (lastMinorErr != minorErr))
+            uint8_t majorErr = 0;
+            uint8_t minorErr = 0;
+            if ((0 == readCpldReg(ActionType::majorError, majorErr)) &&
+                (0 == readCpldReg(ActionType::minorError, minorErr)))
             {
-                // Update cached data to dbus and log redfish event by
-                // reading reason.
-                handleLastCountChange(conn, "lastMajorErr", majorErr);
-                handleLastCountChange(conn, "lastMinorErr", minorErr);
-                if (majorErr && minorErr)
+                if ((lastMajorErr != majorErr) || (lastMinorErr != minorErr))
                 {
-                    logResiliencyErrorEvent(majorErr, minorErr);
+                    // Update cached data to dbus and log redfish event by
+                    // reading reason.
+                    handleLastCountChange(conn, "lastMajorErr", majorErr);
+                    handleLastCountChange(conn, "lastMinorErr", minorErr);
+                    if (majorErr && minorErr)
+                    {
+                        logResiliencyErrorEvent(majorErr, minorErr);
+                    }
                 }
             }
-        }
-    });
+        });
 }
 
 static void monitorPlatformStateChange(
@@ -339,19 +340,19 @@
     stateTimer->expires_after(std::chrono::seconds(pollTimeout));
     stateTimer->async_wait(
         [&server, &conn](const boost::system::error_code& ec) {
-        if (ec == boost::asio::error::operation_aborted)
-        {
-            // Timer reset.
-            return;
-        }
-        if (ec)
-        {
-            // Platform State Monitor - Timer cancelled.
-            return;
-        }
-        checkAndLogEvents(conn);
-        monitorPlatformStateChange(server, conn);
-    });
+            if (ec == boost::asio::error::operation_aborted)
+            {
+                // Timer reset.
+                return;
+            }
+            if (ec)
+            {
+                // Platform State Monitor - Timer cancelled.
+                return;
+            }
+            checkAndLogEvents(conn);
+            monitorPlatformStateChange(server, conn);
+        });
 }
 
 void checkAndSetCheckpoint(sdbusplus::asio::object_server& server,
@@ -361,51 +362,51 @@
     conn->async_method_call(
         [&server, &conn](boost::system::error_code ec,
                          const std::variant<uint64_t>& value) {
-        if (!ec)
-        {
-            if (std::get<uint64_t>(value))
+            if (!ec)
             {
-                phosphor::logging::log<phosphor::logging::level::INFO>(
-                    "BMC boot completed. Setting checkpoint 9.");
-                if (!bmcBootCompleteChkPointDone)
+                if (std::get<uint64_t>(value))
                 {
-                    setBMCBootCompleteChkPoint(bmcBootFinishedChkPoint);
+                    phosphor::logging::log<phosphor::logging::level::INFO>(
+                        "BMC boot completed. Setting checkpoint 9.");
+                    if (!bmcBootCompleteChkPointDone)
+                    {
+                        setBMCBootCompleteChkPoint(bmcBootFinishedChkPoint);
+                    }
+                    return;
                 }
-                return;
             }
-        }
-        else
-        {
-            // Failed to get data from systemd. System might not
-            // be ready yet. Attempt again for data.
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "aync call failed to get FinishTimestamp.",
-                phosphor::logging::entry("MSG=%s", ec.message().c_str()));
-        }
-        // FIX-ME: Latest up-stream sync caused issue in receiving
-        // StartupFinished signal. Unable to get StartupFinished signal
-        // from systemd1 hence using poll method too, to trigger it
-        // properly.
-        constexpr size_t pollTimeout = 10; // seconds
-        initTimer->expires_after(std::chrono::seconds(pollTimeout));
-        initTimer->async_wait(
-            [&server, &conn](const boost::system::error_code& ec) {
-            if (ec == boost::asio::error::operation_aborted)
+            else
             {
-                // Timer reset.
-                phosphor::logging::log<phosphor::logging::level::INFO>(
-                    "Set boot Checkpoint - Timer aborted or stopped.");
-                return;
-            }
-            if (ec)
-            {
+                // Failed to get data from systemd. System might not
+                // be ready yet. Attempt again for data.
                 phosphor::logging::log<phosphor::logging::level::ERR>(
-                    "Set boot Checkpoint - async wait error.");
-                return;
+                    "aync call failed to get FinishTimestamp.",
+                    phosphor::logging::entry("MSG=%s", ec.message().c_str()));
             }
-            checkAndSetCheckpoint(server, conn);
-        });
-    },
+            // FIX-ME: Latest up-stream sync caused issue in receiving
+            // StartupFinished signal. Unable to get StartupFinished signal
+            // from systemd1 hence using poll method too, to trigger it
+            // properly.
+            constexpr size_t pollTimeout = 10; // seconds
+            initTimer->expires_after(std::chrono::seconds(pollTimeout));
+            initTimer->async_wait(
+                [&server, &conn](const boost::system::error_code& ec) {
+                    if (ec == boost::asio::error::operation_aborted)
+                    {
+                        // Timer reset.
+                        phosphor::logging::log<phosphor::logging::level::INFO>(
+                            "Set boot Checkpoint - Timer aborted or stopped.");
+                        return;
+                    }
+                    if (ec)
+                    {
+                        phosphor::logging::log<phosphor::logging::level::ERR>(
+                            "Set boot Checkpoint - async wait error.");
+                        return;
+                    }
+                    checkAndSetCheckpoint(server, conn);
+                });
+        },
         "org.freedesktop.systemd1", "/org/freedesktop/systemd1",
         "org.freedesktop.DBus.Properties", "Get",
         "org.freedesktop.systemd1.Manager", "FinishTimestamp");
@@ -422,14 +423,14 @@
         "member='StartupFinished',path='/org/freedesktop/systemd1',"
         "interface='org.freedesktop.systemd1.Manager'",
         [&server, &conn](sdbusplus::message_t& msg) {
-        if (!bmcBootCompleteChkPointDone)
-        {
-            phosphor::logging::log<phosphor::logging::level::INFO>(
-                "BMC boot completed(StartupFinished). Setting "
-                "checkpoint 9.");
-            setBMCBootCompleteChkPoint(bmcBootFinishedChkPoint);
-        }
-    });
+            if (!bmcBootCompleteChkPointDone)
+            {
+                phosphor::logging::log<phosphor::logging::level::INFO>(
+                    "BMC boot completed(StartupFinished). Setting "
+                    "checkpoint 9.");
+                setBMCBootCompleteChkPoint(bmcBootFinishedChkPoint);
+            }
+        });
     checkAndSetCheckpoint(server, conn);
 
     // Capture the Chassis state and Start the monitor timer
@@ -442,37 +443,38 @@
         "sender='xyz.openbmc_project.State.Chassis', "
         "arg0namespace='xyz.openbmc_project.State.Chassis'",
         [&server, &conn](sdbusplus::message_t& message) {
-        std::string intfName;
-        std::map<std::string, std::variant<std::string>> properties;
-        message.read(intfName, properties);
+            std::string intfName;
+            std::map<std::string, std::variant<std::string>> properties;
+            message.read(intfName, properties);
 
-        const auto it = properties.find("CurrentPowerState");
-        if (it != properties.end())
-        {
-            const std::string* state = std::get_if<std::string>(&it->second);
-            if (state != nullptr)
+            const auto it = properties.find("CurrentPowerState");
+            if (it != properties.end())
             {
-                if ((*state ==
-                     "xyz.openbmc_project.State.Chassis.PowerState.On") &&
-                    (!stateTimerRunning))
+                const std::string* state =
+                    std::get_if<std::string>(&it->second);
+                if (state != nullptr)
                 {
-                    stateTimerRunning = true;
-                    monitorPlatformStateChange(server, conn);
+                    if ((*state ==
+                         "xyz.openbmc_project.State.Chassis.PowerState.On") &&
+                        (!stateTimerRunning))
+                    {
+                        stateTimerRunning = true;
+                        monitorPlatformStateChange(server, conn);
+                    }
+                    else if ((*state == "xyz.openbmc_project.State.Chassis."
+                                        "PowerState.Off") &&
+                             (stateTimerRunning))
+                    {
+                        stateTimer->cancel();
+                        checkAndLogEvents(conn);
+                        stateTimerRunning = false;
+                    }
                 }
-                else if ((*state == "xyz.openbmc_project.State.Chassis."
-                                    "PowerState.Off") &&
-                         (stateTimerRunning))
-                {
-                    stateTimer->cancel();
-                    checkAndLogEvents(conn);
-                    stateTimerRunning = false;
-                }
-            }
 
-            // Update the D-Bus properties when chassis state changes.
-            updateDbusPropertiesCache();
-        }
-    });
+                // Update the D-Bus properties when chassis state changes.
+                updateDbusPropertiesCache();
+            }
+        });
 
     // Capture the Host state and Start the monitor timer
     // if state changed to 'Running'. Run timer until OS boot.
@@ -484,39 +486,40 @@
         "sender='xyz.openbmc_project.State.Chassis', "
         "arg0namespace='xyz.openbmc_project.State.Host'",
         [&server, &conn](sdbusplus::message_t& message) {
-        std::string intfName;
-        std::map<std::string, std::variant<std::string>> properties;
-        message.read(intfName, properties);
+            std::string intfName;
+            std::map<std::string, std::variant<std::string>> properties;
+            message.read(intfName, properties);
 
-        const auto it = properties.find("CurrentHostState");
-        if (it != properties.end())
-        {
-            const std::string* state = std::get_if<std::string>(&it->second);
-            if (state != nullptr)
+            const auto it = properties.find("CurrentHostState");
+            if (it != properties.end())
             {
-                if ((*state ==
-                     "xyz.openbmc_project.State.Host.HostState.Running") &&
-                    (!stateTimerRunning))
+                const std::string* state =
+                    std::get_if<std::string>(&it->second);
+                if (state != nullptr)
                 {
-                    stateTimerRunning = true;
-                    monitorPlatformStateChange(server, conn);
+                    if ((*state ==
+                         "xyz.openbmc_project.State.Host.HostState.Running") &&
+                        (!stateTimerRunning))
+                    {
+                        stateTimerRunning = true;
+                        monitorPlatformStateChange(server, conn);
+                    }
+                    else if (((*state == "xyz.openbmc_project.State.Host."
+                                         "HostState.Off") ||
+                              (*state == "xyz.openbmc_project.State.Host."
+                                         "HostState.Quiesced")) &&
+                             (stateTimerRunning))
+                    {
+                        stateTimer->cancel();
+                        checkAndLogEvents(conn);
+                        stateTimerRunning = false;
+                    }
                 }
-                else if (((*state == "xyz.openbmc_project.State.Host."
-                                     "HostState.Off") ||
-                          (*state == "xyz.openbmc_project.State.Host."
-                                     "HostState.Quiesced")) &&
-                         (stateTimerRunning))
-                {
-                    stateTimer->cancel();
-                    checkAndLogEvents(conn);
-                    stateTimerRunning = false;
-                }
-            }
 
-            // Update the D-Bus properties when host state changes.
-            updateDbusPropertiesCache();
-        }
-    });
+                // Update the D-Bus properties when host state changes.
+                updateDbusPropertiesCache();
+            }
+        });
 
     // Capture the OS state change and stop monitor timer
     // if OS boots completely or becomes Inactive.
@@ -528,40 +531,41 @@
         "sender='xyz.openbmc_project.State.Chassis', "
         "arg0namespace='xyz.openbmc_project.State.OperatingSystem.Status'",
         [&server, &conn](sdbusplus::message_t& message) {
-        std::string intfName;
-        std::map<std::string, std::variant<std::string>> properties;
-        message.read(intfName, properties);
+            std::string intfName;
+            std::map<std::string, std::variant<std::string>> properties;
+            message.read(intfName, properties);
 
-        const auto it = properties.find("OperatingSystemState");
-        if (it != properties.end())
-        {
-            const std::string* state = std::get_if<std::string>(&it->second);
-            if (state != nullptr)
+            const auto it = properties.find("OperatingSystemState");
+            if (it != properties.end())
             {
-                // The short strings "BootComplete" and "Standby" are
-                // deprecated in favor of the full enum strings
-                // Support for the short strings will be removed in the
-                // future.
-                if (((*state == "BootComplete") ||
-                     (*state == "xyz.openbmc_project.State.OperatingSystem."
-                                "Status.OSStatus.BootComplete") ||
-                     (*state == "Inactive") ||
-                     (*state == "xyz.openbmc_project.State.OperatingSystem."
-                                "Status.OSStatus.Inactive")) &&
-                    (stateTimerRunning))
+                const std::string* state =
+                    std::get_if<std::string>(&it->second);
+                if (state != nullptr)
                 {
-                    stateTimer->cancel();
-                    checkAndLogEvents(conn);
-                    stateTimerRunning = false;
-                }
-                else if (!stateTimerRunning)
-                {
-                    stateTimerRunning = true;
-                    monitorPlatformStateChange(server, conn);
+                    // The short strings "BootComplete" and "Standby" are
+                    // deprecated in favor of the full enum strings
+                    // Support for the short strings will be removed in the
+                    // future.
+                    if (((*state == "BootComplete") ||
+                         (*state == "xyz.openbmc_project.State.OperatingSystem."
+                                    "Status.OSStatus.BootComplete") ||
+                         (*state == "Inactive") ||
+                         (*state == "xyz.openbmc_project.State.OperatingSystem."
+                                    "Status.OSStatus.Inactive")) &&
+                        (stateTimerRunning))
+                    {
+                        stateTimer->cancel();
+                        checkAndLogEvents(conn);
+                        stateTimerRunning = false;
+                    }
+                    else if (!stateTimerRunning)
+                    {
+                        stateTimerRunning = true;
+                        monitorPlatformStateChange(server, conn);
+                    }
                 }
             }
-        }
-    });
+        });
 
     // First time, check and log events if any.
     checkAndLogEvents(conn);
@@ -573,14 +577,14 @@
     lg2::info("VERSION INFO - rot_fw_active - {VER}", "VER", cpldVersion);
     conn->async_method_call(
         [](const boost::system::error_code ec) {
-        if (ec)
-        {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "Unable to update rot_fw_active version",
-                phosphor::logging::entry("MSG=%s", ec.message().c_str()));
-            return;
-        }
-    },
+            if (ec)
+            {
+                phosphor::logging::log<phosphor::logging::level::ERR>(
+                    "Unable to update rot_fw_active version",
+                    phosphor::logging::entry("MSG=%s", ec.message().c_str()));
+                return;
+            }
+        },
         "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/software/rot_fw_active",
         "org.freedesktop.DBus.Properties", "Set",
@@ -639,8 +643,8 @@
 
     constexpr size_t timeout = 10; // seconds
     pfrObjTimer->expires_after(std::chrono::seconds(timeout));
-    pfrObjTimer->async_wait(
-        [&conn, &server](const boost::system::error_code& ec) {
+    pfrObjTimer->async_wait([&conn,
+                             &server](const boost::system::error_code& ec) {
         if (ec)
         {
             if (ec == boost::asio::error::operation_aborted)
@@ -707,8 +711,8 @@
         pfr::pfrConfigObject->updateProvisioningStatus();
         if (pfr::pfrConfigObject->getPfrProvisioned())
         {
-            pfr::pfrPostcodeObject = std::make_unique<pfr::PfrPostcode>(server,
-                                                                        conn);
+            pfr::pfrPostcodeObject =
+                std::make_unique<pfr::PfrPostcode>(server, conn);
         }
     }
 
diff --git a/service/src/pfr_mgr.cpp b/service/src/pfr_mgr.cpp
index 57e121b..d31c14f 100644
--- a/service/src/pfr_mgr.cpp
+++ b/service/src/pfr_mgr.cpp
@@ -39,8 +39,7 @@
                        std::shared_ptr<sdbusplus::asio::connection>& conn_,
                        const std::string& path_, const ImageType& imgType_,
                        const std::string& purpose_) :
-    server(srv_),
-    conn(conn_), path(path_), imgType(imgType_), purpose(purpose_)
+    server(srv_), conn(conn_), path(path_), imgType(imgType_), purpose(purpose_)
 {
     version = getFirmwareVersion(imgType);
 
@@ -50,8 +49,8 @@
     }
 
     std::string objPath = "/xyz/openbmc_project/software/" + path;
-    versionIface = server.add_interface(objPath,
-                                        "xyz.openbmc_project.Software.Version");
+    versionIface =
+        server.add_interface(objPath, "xyz.openbmc_project.Software.Version");
 
     if (versionIface != nullptr)
     {
@@ -60,17 +59,17 @@
             versionStr, version,
             // Override set
             [this](const std::string& req, std::string& propertyValue) {
-            if (internalSet)
-            {
-                if (req != propertyValue)
+                if (internalSet)
                 {
-                    version = req;
-                    propertyValue = req;
-                    return 1;
+                    if (req != propertyValue)
+                    {
+                        version = req;
+                        propertyValue = req;
+                        return 1;
+                    }
                 }
-            }
-            return 0;
-        });
+                return 0;
+            });
 
         versionIface->initialize();
     }
@@ -135,8 +134,7 @@
 
 PfrConfig::PfrConfig(sdbusplus::asio::object_server& srv_,
                      std::shared_ptr<sdbusplus::asio::connection>& conn_) :
-    server(srv_),
-    conn(conn_)
+    server(srv_), conn(conn_)
 {
     pfrCfgIface = server.add_interface("/xyz/openbmc_project/pfr",
                                        "xyz.openbmc_project.PFR.Attributes");
@@ -149,47 +147,47 @@
     pfrCfgIface->register_property(ufmProvisionedStr, ufmProvisioned,
                                    // Override set
                                    [this](const bool req, bool propertyValue) {
-        if (internalSet)
-        {
-            if (req != propertyValue)
-            {
-                ufmProvisioned = req;
-                propertyValue = req;
-                return 1;
-            }
-        }
-        return 0;
-    });
+                                       if (internalSet)
+                                       {
+                                           if (req != propertyValue)
+                                           {
+                                               ufmProvisioned = req;
+                                               propertyValue = req;
+                                               return 1;
+                                           }
+                                       }
+                                       return 0;
+                                   });
 
     pfrCfgIface->register_property(ufmLockedStr, ufmLocked,
                                    // Override set
                                    [this](const bool req, bool propertyValue) {
-        if (internalSet)
-        {
-            if (req != propertyValue)
-            {
-                ufmLocked = req;
-                propertyValue = req;
-                return 1;
-            }
-        }
-        return 0;
-    });
+                                       if (internalSet)
+                                       {
+                                           if (req != propertyValue)
+                                           {
+                                               ufmLocked = req;
+                                               propertyValue = req;
+                                               return 1;
+                                           }
+                                       }
+                                       return 0;
+                                   });
 
     pfrCfgIface->register_property(ufmSupportStr, ufmSupport,
                                    // Override set
                                    [this](const bool req, bool propertyValue) {
-        if (internalSet)
-        {
-            if (req != propertyValue)
-            {
-                ufmSupport = req;
-                propertyValue = req;
-                return 1;
-            }
-        }
-        return 0;
-    });
+                                       if (internalSet)
+                                       {
+                                           if (req != propertyValue)
+                                           {
+                                               ufmSupport = req;
+                                               propertyValue = req;
+                                               return 1;
+                                           }
+                                       }
+                                       return 0;
+                                   });
 
     pfrCfgIface->initialize();
 
@@ -251,16 +249,15 @@
 
 PfrPostcode::PfrPostcode(sdbusplus::asio::object_server& srv_,
                          std::shared_ptr<sdbusplus::asio::connection>& conn_) :
-    server(srv_),
-    conn(conn_)
+    server(srv_), conn(conn_)
 {
     if (getPlatformState(postcode) < 0)
     {
         postcode = 0;
     }
 
-    pfrPostcodeIface = server.add_interface("/xyz/openbmc_project/pfr",
-                                            postcodeIface);
+    pfrPostcodeIface =
+        server.add_interface("/xyz/openbmc_project/pfr", postcodeIface);
 
     if (pfrPostcodeIface != nullptr)
     {
@@ -268,22 +265,22 @@
             postcodeDataProp, postcode,
             // Override set
             [this](const uint8_t req, uint8_t& propertyValue) {
-            if (internalSet)
-            {
-                if (req != propertyValue)
+                if (internalSet)
                 {
-                    postcode = req;
-                    propertyValue = req;
-                    return 1;
+                    if (req != propertyValue)
+                    {
+                        postcode = req;
+                        propertyValue = req;
+                        return 1;
+                    }
                 }
-            }
-            return 0;
-        },
+                return 0;
+            },
             [this](uint8_t& propertyValue) {
-            updatePostcode();
-            propertyValue = postcode;
-            return propertyValue;
-        });
+                updatePostcode();
+                propertyValue = postcode;
+                return propertyValue;
+            });
 
         pfrPostcodeIface->register_property(postcodeStrProp,
                                             std::string(postcodeStrDefault));