Use power_control namespace in main()

There are quite a lot of `power_control::` in main(), which is not
really necessary. Use the namespace in main() so the extra
`power_control::` could be removed and the code becomes more clean.

Tested: No functional change, verify it builds OK.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Ia336c36dbbff53ae673ed0bc5fe25bbe63ecad6d
diff --git a/power-control-x86/src/power_control.cpp b/power-control-x86/src/power_control.cpp
index cc9b573..61656f3 100644
--- a/power-control-x86/src/power_control.cpp
+++ b/power-control-x86/src/power_control.cpp
@@ -2357,44 +2357,38 @@
 
 int main(int argc, char* argv[])
 {
+    using namespace power_control;
     phosphor::logging::log<phosphor::logging::level::INFO>(
         "Start Chassis power control service...");
-    power_control::conn =
-        std::make_shared<sdbusplus::asio::connection>(power_control::io);
+    conn = std::make_shared<sdbusplus::asio::connection>(io);
 
     // Load GPIO's through json config file
-    if (power_control::loadConfigValues() == -1)
+    if (loadConfigValues() == -1)
     {
-        std::string errMsg =
-            "Host" + power_control::node + ": " + "Error in Parsing...";
+        std::string errMsg = "Host" + node + ": " + "Error in Parsing...";
         phosphor::logging::log<phosphor::logging::level::ERR>(errMsg.c_str());
     }
 
     // Request all the dbus names
-    power_control::conn->request_name("xyz.openbmc_project.State.Host");
-    power_control::conn->request_name("xyz.openbmc_project.State.Chassis");
-    power_control::conn->request_name(
-        "xyz.openbmc_project.State.OperatingSystem");
-    power_control::conn->request_name("xyz.openbmc_project.Chassis.Buttons");
-    power_control::conn->request_name("xyz.openbmc_project.Control.Host.NMI");
-    power_control::conn->request_name(
-        "xyz.openbmc_project.Control.Host.RestartCause");
+    conn->request_name("xyz.openbmc_project.State.Host");
+    conn->request_name("xyz.openbmc_project.State.Chassis");
+    conn->request_name("xyz.openbmc_project.State.OperatingSystem");
+    conn->request_name("xyz.openbmc_project.Chassis.Buttons");
+    conn->request_name("xyz.openbmc_project.Control.Host.NMI");
+    conn->request_name("xyz.openbmc_project.Control.Host.RestartCause");
 
-    if (power_control::sioPwrGoodName.empty() ||
-        power_control::sioOnControlName.empty() ||
-        power_control::sioS5Name.empty())
+    if (sioPwrGoodName.empty() || sioOnControlName.empty() || sioS5Name.empty())
     {
-        power_control::sioEnabled = false;
+        sioEnabled = false;
         phosphor::logging::log<phosphor::logging::level::INFO>(
             "SIO control GPIOs not defined, disable SIO support.");
     }
 
     // Request PS_PWROK GPIO events
-    if (!power_control::powerOkName.empty())
+    if (!powerOkName.empty())
     {
-        if (!power_control::requestGPIOEvents(
-                power_control::powerOkName, power_control::psPowerOKHandler,
-                power_control::psPowerOKLine, power_control::psPowerOKEvent))
+        if (!requestGPIOEvents(powerOkName, psPowerOKHandler, psPowerOKLine,
+                               psPowerOKEvent))
         {
             return -1;
         }
@@ -2406,44 +2400,34 @@
         return -1;
     }
 
-    if (power_control::sioEnabled == true)
+    if (sioEnabled == true)
     {
         // Request SIO_POWER_GOOD GPIO events
-        if (!power_control::requestGPIOEvents(
-                power_control::sioPwrGoodName,
-                power_control::sioPowerGoodHandler,
-                power_control::sioPowerGoodLine,
-                power_control::sioPowerGoodEvent))
+        if (!requestGPIOEvents(sioPwrGoodName, sioPowerGoodHandler,
+                               sioPowerGoodLine, sioPowerGoodEvent))
         {
             return -1;
         }
 
         // Request SIO_ONCONTROL GPIO events
-        if (!power_control::requestGPIOEvents(
-                power_control::sioOnControlName,
-                power_control::sioOnControlHandler,
-                power_control::sioOnControlLine,
-                power_control::sioOnControlEvent))
+        if (!requestGPIOEvents(sioOnControlName, sioOnControlHandler,
+                               sioOnControlLine, sioOnControlEvent))
         {
             return -1;
         }
 
         // Request SIO_S5 GPIO events
-        if (!power_control::requestGPIOEvents(
-                power_control::sioS5Name, power_control::sioS5Handler,
-                power_control::sioS5Line, power_control::sioS5Event))
+        if (!requestGPIOEvents(sioS5Name, sioS5Handler, sioS5Line, sioS5Event))
         {
             return -1;
         }
     }
 
     // Request POWER_BUTTON GPIO events
-    if (!power_control::powerButtonName.empty())
+    if (!powerButtonName.empty())
     {
-        if (!power_control::requestGPIOEvents(power_control::powerButtonName,
-                                              power_control::powerButtonHandler,
-                                              power_control::powerButtonLine,
-                                              power_control::powerButtonEvent))
+        if (!requestGPIOEvents(powerButtonName, powerButtonHandler,
+                               powerButtonLine, powerButtonEvent))
         {
             return -1;
         }
@@ -2456,12 +2440,10 @@
     }
 
     // Request RESET_BUTTON GPIO events
-    if (!power_control::resetButtonName.empty())
+    if (!resetButtonName.empty())
     {
-        if (!power_control::requestGPIOEvents(power_control::resetButtonName,
-                                              power_control::resetButtonHandler,
-                                              power_control::resetButtonLine,
-                                              power_control::resetButtonEvent))
+        if (!requestGPIOEvents(resetButtonName, resetButtonHandler,
+                               resetButtonLine, resetButtonEvent))
         {
             return -1;
         }
@@ -2473,37 +2455,32 @@
     }
 
     // Request NMI_BUTTON GPIO events
-    if (!power_control::nmiButtonName.empty())
+    if (!nmiButtonName.empty())
     {
-        power_control::requestGPIOEvents(
-            power_control::nmiButtonName, power_control::nmiButtonHandler,
-            power_control::nmiButtonLine, power_control::nmiButtonEvent);
+        requestGPIOEvents(nmiButtonName, nmiButtonHandler, nmiButtonLine,
+                          nmiButtonEvent);
     }
 
     // Request ID_BUTTON GPIO events
-    if (!power_control::idButtonName.empty())
+    if (!idButtonName.empty())
     {
-        power_control::requestGPIOEvents(
-            power_control::idButtonName, power_control::idButtonHandler,
-            power_control::idButtonLine, power_control::idButtonEvent);
+        requestGPIOEvents(idButtonName, idButtonHandler, idButtonLine,
+                          idButtonEvent);
     }
 
 #ifdef USE_PLT_RST
     sdbusplus::bus::match::match pltRstMatch(
-        *power_control::conn,
+        *conn,
         "type='signal',interface='org.freedesktop.DBus.Properties',member='"
         "PropertiesChanged',arg0='xyz.openbmc_project.State.Host.Misc'",
-        power_control::hostMiscHandler);
+        hostMiscHandler);
 #endif
 
     // Request POST_COMPLETE GPIO events
-    if (!power_control::postCompleteName.empty())
+    if (!postCompleteName.empty())
     {
-        if (!power_control::requestGPIOEvents(
-                power_control::postCompleteName,
-                power_control::postCompleteHandler,
-                power_control::postCompleteLine,
-                power_control::postCompleteEvent))
+        if (!requestGPIOEvents(postCompleteName, postCompleteHandler,
+                               postCompleteLine, postCompleteEvent))
         {
             return -1;
         }
@@ -2516,17 +2493,16 @@
     }
 
     // initialize NMI_OUT GPIO.
-    power_control::setGPIOOutput(power_control::nmiOutName, 0,
-                                 power_control::nmiOutLine);
+    setGPIOOutput(nmiOutName, 0, nmiOutLine);
 
     // Initialize POWER_OUT and RESET_OUT GPIO.
     gpiod::line line;
-    if (!power_control::setGPIOOutput(power_control::powerOutName, 1, line))
+    if (!setGPIOOutput(powerOutName, 1, line))
     {
         return -1;
     }
 
-    if (!power_control::setGPIOOutput(power_control::resetOutName, 1, line))
+    if (!setGPIOOutput(resetOutName, 1, line))
     {
         return -1;
     }
@@ -2535,71 +2511,69 @@
     line.reset();
 
     // Initialize the power state
-    power_control::powerState = power_control::PowerState::off;
+    powerState = PowerState::off;
     // Check power good
-    if (power_control::psPowerOKLine.get_value() > 0)
+    if (psPowerOKLine.get_value() > 0)
     {
-        power_control::powerState = power_control::PowerState::on;
+        powerState = PowerState::on;
     }
 
     // Initialize the power state storage
-    if (power_control::initializePowerStateStorage() < 0)
+    if (initializePowerStateStorage() < 0)
     {
         return -1;
     }
 
     // Check if we need to start the Power Restore policy
-    power_control::powerRestorePolicyCheck();
+    powerRestorePolicyCheck();
 
-    if (power_control::nmiOutLine)
-        power_control::nmiSourcePropertyMonitor();
+    if (nmiOutLine)
+        nmiSourcePropertyMonitor();
 
     phosphor::logging::log<phosphor::logging::level::INFO>(
         "Initializing power state. ");
-    power_control::logStateTransition(power_control::powerState);
+    logStateTransition(powerState);
 
     // Power Control Service
     sdbusplus::asio::object_server hostServer =
-        sdbusplus::asio::object_server(power_control::conn);
+        sdbusplus::asio::object_server(conn);
 
     // Power Control Interface
-    power_control::hostIface = hostServer.add_interface(
-        "/xyz/openbmc_project/state/host0", "xyz.openbmc_project.State.Host");
+    hostIface = hostServer.add_interface("/xyz/openbmc_project/state/host0",
+                                         "xyz.openbmc_project.State.Host");
 
-    power_control::hostIface->register_property(
+    hostIface->register_property(
         "RequestedHostTransition",
         std::string("xyz.openbmc_project.State.Host.Transition.Off"),
         [](const std::string& requested, std::string& resp) {
             if (requested == "xyz.openbmc_project.State.Host.Transition.Off")
             {
-                sendPowerControlEvent(
-                    power_control::Event::gracefulPowerOffRequest);
-                addRestartCause(power_control::RestartCause::command);
+                sendPowerControlEvent(Event::gracefulPowerOffRequest);
+                addRestartCause(RestartCause::command);
             }
             else if (requested ==
                      "xyz.openbmc_project.State.Host.Transition.On")
             {
-                sendPowerControlEvent(power_control::Event::powerOnRequest);
-                addRestartCause(power_control::RestartCause::command);
+                sendPowerControlEvent(Event::powerOnRequest);
+                addRestartCause(RestartCause::command);
             }
             else if (requested ==
                      "xyz.openbmc_project.State.Host.Transition.Reboot")
             {
-                sendPowerControlEvent(power_control::Event::powerCycleRequest);
-                addRestartCause(power_control::RestartCause::command);
+                sendPowerControlEvent(Event::powerCycleRequest);
+                addRestartCause(RestartCause::command);
             }
             else if (requested == "xyz.openbmc_project.State.Host.Transition."
                                   "GracefulWarmReboot")
             {
-                sendPowerControlEvent(
-                    power_control::Event::gracefulPowerCycleRequest);
-                addRestartCause(power_control::RestartCause::command);
+                sendPowerControlEvent(Event::gracefulPowerCycleRequest);
+                addRestartCause(RestartCause::command);
             }
             else if (requested == "xyz.openbmc_project.State.Host.Transition."
                                   "ForceWarmReboot")
             {
-                sendPowerControlEvent(power_control::Event::resetRequest);
-                addRestartCause(power_control::RestartCause::command);
+                sendPowerControlEvent(Event::resetRequest);
+                addRestartCause(RestartCause::command);
             }
             else
             {
@@ -2611,41 +2585,40 @@
             resp = requested;
             return 1;
         });
-    power_control::hostIface->register_property(
-        "CurrentHostState",
-        std::string(power_control::getHostState(power_control::powerState)));
+    hostIface->register_property("CurrentHostState",
+                                 std::string(getHostState(powerState)));
 
-    power_control::hostIface->initialize();
+    hostIface->initialize();
 
     // Chassis Control Service
     sdbusplus::asio::object_server chassisServer =
-        sdbusplus::asio::object_server(power_control::conn);
+        sdbusplus::asio::object_server(conn);
 
     // Chassis Control Interface
-    power_control::chassisIface =
+    chassisIface =
         chassisServer.add_interface("/xyz/openbmc_project/state/chassis0",
                                     "xyz.openbmc_project.State.Chassis");
 
-    power_control::chassisIface->register_property(
+    chassisIface->register_property(
         "RequestedPowerTransition",
         std::string("xyz.openbmc_project.State.Chassis.Transition.Off"),
         [](const std::string& requested, std::string& resp) {
             if (requested == "xyz.openbmc_project.State.Chassis.Transition.Off")
             {
-                sendPowerControlEvent(power_control::Event::powerOffRequest);
-                addRestartCause(power_control::RestartCause::command);
+                sendPowerControlEvent(Event::powerOffRequest);
+                addRestartCause(RestartCause::command);
             }
             else if (requested ==
                      "xyz.openbmc_project.State.Chassis.Transition.On")
             {
-                sendPowerControlEvent(power_control::Event::powerOnRequest);
-                addRestartCause(power_control::RestartCause::command);
+                sendPowerControlEvent(Event::powerOnRequest);
+                addRestartCause(RestartCause::command);
             }
             else if (requested ==
                      "xyz.openbmc_project.State.Chassis.Transition.PowerCycle")
             {
-                sendPowerControlEvent(power_control::Event::powerCycleRequest);
-                addRestartCause(power_control::RestartCause::command);
+                sendPowerControlEvent(Event::powerCycleRequest);
+                addRestartCause(RestartCause::command);
             }
             else
             {
@@ -2657,33 +2630,31 @@
             resp = requested;
             return 1;
         });
-    power_control::chassisIface->register_property(
-        "CurrentPowerState",
-        std::string(power_control::getChassisState(power_control::powerState)));
-    power_control::chassisIface->register_property(
-        "LastStateChangeTime", power_control::getCurrentTimeMs());
+    chassisIface->register_property("CurrentPowerState",
+                                    std::string(getChassisState(powerState)));
+    chassisIface->register_property("LastStateChangeTime", getCurrentTimeMs());
 
-    power_control::chassisIface->initialize();
+    chassisIface->initialize();
 
 #ifdef CHASSIS_SYSTEM_RESET
     // Chassis System Service
     sdbusplus::asio::object_server chassisSysServer =
-        sdbusplus::asio::object_server(power_control::conn);
+        sdbusplus::asio::object_server(conn);
 
     // Chassis System Interface
-    power_control::chassisSysIface = chassisSysServer.add_interface(
+    chassisSysIface = chassisSysServer.add_interface(
         "/xyz/openbmc_project/state/chassis_system0",
         "xyz.openbmc_project.State.Chassis");
 
-    power_control::chassisSysIface->register_property(
+    chassisSysIface->register_property(
         "RequestedPowerTransition",
         std::string("xyz.openbmc_project.State.Chassis.Transition.On"),
         [](const std::string& requested, std::string& resp) {
             if (requested ==
                 "xyz.openbmc_project.State.Chassis.Transition.PowerCycle")
             {
-                power_control::systemReset();
-                addRestartCause(power_control::RestartCause::command);
+                systemReset();
+                addRestartCause(RestartCause::command);
             }
             else
             {
@@ -2695,35 +2666,32 @@
             resp = requested;
             return 1;
         });
-    power_control::chassisSysIface->register_property(
-        "CurrentPowerState",
-        std::string(power_control::getChassisState(power_control::powerState)));
-    power_control::chassisSysIface->register_property(
-        "LastStateChangeTime", power_control::getCurrentTimeMs());
+    chassisSysIface->register_property(
+        "CurrentPowerState", std::string(getChassisState(powerState)));
+    chassisSysIface->register_property("LastStateChangeTime",
+                                       getCurrentTimeMs());
 
-    power_control::chassisSysIface->initialize();
+    chassisSysIface->initialize();
 #endif
 
     // Buttons Service
     sdbusplus::asio::object_server buttonsServer =
-        sdbusplus::asio::object_server(power_control::conn);
+        sdbusplus::asio::object_server(conn);
 
     // Power Button Interface
-    power_control::powerButtonIface = buttonsServer.add_interface(
+    powerButtonIface = buttonsServer.add_interface(
         "/xyz/openbmc_project/chassis/buttons/power",
         "xyz.openbmc_project.Chassis.Buttons");
 
-    power_control::powerButtonIface->register_property(
+    powerButtonIface->register_property(
         "ButtonMasked", false, [](const bool requested, bool& current) {
             if (requested)
             {
-                if (power_control::powerButtonMask)
+                if (powerButtonMask)
                 {
                     return 1;
                 }
-                if (!power_control::setGPIOOutput(
-                        power_control::powerOutName, 1,
-                        power_control::powerButtonMask))
+                if (!setGPIOOutput(powerOutName, 1, powerButtonMask))
                 {
                     throw std::runtime_error("Failed to request GPIO");
                     return 0;
@@ -2733,13 +2701,13 @@
             }
             else
             {
-                if (!power_control::powerButtonMask)
+                if (!powerButtonMask)
                 {
                     return 1;
                 }
                 phosphor::logging::log<phosphor::logging::level::INFO>(
                     "Power Button Un-masked");
-                power_control::powerButtonMask.reset();
+                powerButtonMask.reset();
             }
             // Update the mask setting
             current = requested;
@@ -2747,30 +2715,27 @@
         });
 
     // Check power button state
-    bool powerButtonPressed = power_control::powerButtonLine.get_value() == 0;
-    power_control::powerButtonIface->register_property("ButtonPressed",
-                                                       powerButtonPressed);
+    bool powerButtonPressed = powerButtonLine.get_value() == 0;
+    powerButtonIface->register_property("ButtonPressed", powerButtonPressed);
 
-    power_control::powerButtonIface->initialize();
+    powerButtonIface->initialize();
 
     // Reset Button Interface
-    if (!power_control::resetButtonName.empty())
+    if (!resetButtonName.empty())
     {
-        power_control::resetButtonIface = buttonsServer.add_interface(
+        resetButtonIface = buttonsServer.add_interface(
             "/xyz/openbmc_project/chassis/buttons/reset",
             "xyz.openbmc_project.Chassis.Buttons");
 
-        power_control::resetButtonIface->register_property(
+        resetButtonIface->register_property(
             "ButtonMasked", false, [](const bool requested, bool& current) {
                 if (requested)
                 {
-                    if (power_control::resetButtonMask)
+                    if (resetButtonMask)
                     {
                         return 1;
                     }
-                    if (!power_control::setGPIOOutput(
-                            power_control::resetOutName, 1,
-                            power_control::resetButtonMask))
+                    if (!setGPIOOutput(resetOutName, 1, resetButtonMask))
                     {
                         throw std::runtime_error("Failed to request GPIO");
                         return 0;
@@ -2780,13 +2745,13 @@
                 }
                 else
                 {
-                    if (!power_control::resetButtonMask)
+                    if (!resetButtonMask)
                     {
                         return 1;
                     }
                     phosphor::logging::log<phosphor::logging::level::INFO>(
                         "Reset Button Un-masked");
-                    power_control::resetButtonMask.reset();
+                    resetButtonMask.reset();
                 }
                 // Update the mask setting
                 current = requested;
@@ -2794,24 +2759,23 @@
             });
 
         // Check reset button state
-        bool resetButtonPressed =
-            power_control::resetButtonLine.get_value() == 0;
-        power_control::resetButtonIface->register_property("ButtonPressed",
-                                                           resetButtonPressed);
+        bool resetButtonPressed = resetButtonLine.get_value() == 0;
+        resetButtonIface->register_property("ButtonPressed",
+                                            resetButtonPressed);
 
-        power_control::resetButtonIface->initialize();
+        resetButtonIface->initialize();
     }
 
-    if (power_control::nmiButtonLine)
+    if (nmiButtonLine)
     {
         // NMI Button Interface
-        power_control::nmiButtonIface = buttonsServer.add_interface(
+        nmiButtonIface = buttonsServer.add_interface(
             "/xyz/openbmc_project/chassis/buttons/nmi",
             "xyz.openbmc_project.Chassis.Buttons");
 
-        power_control::nmiButtonIface->register_property(
+        nmiButtonIface->register_property(
             "ButtonMasked", false, [](const bool requested, bool& current) {
-                if (power_control::nmiButtonMasked == requested)
+                if (nmiButtonMasked == requested)
                 {
                     // NMI button mask is already set as requested, so no change
                     return 1;
@@ -2820,100 +2784,94 @@
                 {
                     phosphor::logging::log<phosphor::logging::level::INFO>(
                         "NMI Button Masked.");
-                    power_control::nmiButtonMasked = true;
+                    nmiButtonMasked = true;
                 }
                 else
                 {
                     phosphor::logging::log<phosphor::logging::level::INFO>(
                         "NMI Button Un-masked.");
-                    power_control::nmiButtonMasked = false;
+                    nmiButtonMasked = false;
                 }
                 // Update the mask setting
-                current = power_control::nmiButtonMasked;
+                current = nmiButtonMasked;
                 return 1;
             });
 
         // Check NMI button state
-        bool nmiButtonPressed = power_control::nmiButtonLine.get_value() == 0;
-        power_control::nmiButtonIface->register_property("ButtonPressed",
-                                                         nmiButtonPressed);
+        bool nmiButtonPressed = nmiButtonLine.get_value() == 0;
+        nmiButtonIface->register_property("ButtonPressed", nmiButtonPressed);
 
-        power_control::nmiButtonIface->initialize();
+        nmiButtonIface->initialize();
     }
 
-    if (power_control::nmiOutLine)
+    if (nmiOutLine)
     {
         // NMI out Service
         sdbusplus::asio::object_server nmiOutServer =
-            sdbusplus::asio::object_server(power_control::conn);
+            sdbusplus::asio::object_server(conn);
 
         // NMI out Interface
-        power_control::nmiOutIface =
+        nmiOutIface =
             nmiOutServer.add_interface("/xyz/openbmc_project/control/host0/nmi",
                                        "xyz.openbmc_project.Control.Host.NMI");
-        power_control::nmiOutIface->register_method("NMI",
-                                                    power_control::nmiReset);
-        power_control::nmiOutIface->initialize();
+        nmiOutIface->register_method("NMI", nmiReset);
+        nmiOutIface->initialize();
     }
 
-    if (power_control::idButtonLine)
+    if (idButtonLine)
     {
         // ID Button Interface
-        power_control::idButtonIface = buttonsServer.add_interface(
+        idButtonIface = buttonsServer.add_interface(
             "/xyz/openbmc_project/chassis/buttons/id",
             "xyz.openbmc_project.Chassis.Buttons");
 
         // Check ID button state
-        bool idButtonPressed = power_control::idButtonLine.get_value() == 0;
-        power_control::idButtonIface->register_property("ButtonPressed",
-                                                        idButtonPressed);
+        bool idButtonPressed = idButtonLine.get_value() == 0;
+        idButtonIface->register_property("ButtonPressed", idButtonPressed);
 
-        power_control::idButtonIface->initialize();
+        idButtonIface->initialize();
     }
 
     // OS State Service
     sdbusplus::asio::object_server osServer =
-        sdbusplus::asio::object_server(power_control::conn);
+        sdbusplus::asio::object_server(conn);
 
     // OS State Interface
-    power_control::osIface = osServer.add_interface(
+    osIface = osServer.add_interface(
         "/xyz/openbmc_project/state/os",
         "xyz.openbmc_project.State.OperatingSystem.Status");
 
     // Get the initial OS state based on POST complete
     //      0: Asserted, OS state is "Standby" (ready to boot)
     //      1: De-Asserted, OS state is "Inactive"
-    std::string osState = power_control::postCompleteLine.get_value() > 0
-                              ? "Inactive"
-                              : "Standby";
+    std::string osState =
+        postCompleteLine.get_value() > 0 ? "Inactive" : "Standby";
 
-    power_control::osIface->register_property("OperatingSystemState",
-                                              std::string(osState));
+    osIface->register_property("OperatingSystemState", std::string(osState));
 
-    power_control::osIface->initialize();
+    osIface->initialize();
 
     // Restart Cause Service
     sdbusplus::asio::object_server restartCauseServer =
-        sdbusplus::asio::object_server(power_control::conn);
+        sdbusplus::asio::object_server(conn);
 
     // Restart Cause Interface
-    power_control::restartCauseIface = restartCauseServer.add_interface(
+    restartCauseIface = restartCauseServer.add_interface(
         "/xyz/openbmc_project/control/host0/restart_cause",
         "xyz.openbmc_project.Control.Host.RestartCause");
 
-    power_control::restartCauseIface->register_property(
+    restartCauseIface->register_property(
         "RestartCause",
         std::string("xyz.openbmc_project.State.Host.RestartCause.Unknown"));
 
-    power_control::restartCauseIface->register_property(
+    restartCauseIface->register_property(
         "RequestedRestartCause",
         std::string("xyz.openbmc_project.State.Host.RestartCause.Unknown"),
         [](const std::string& requested, std::string& resp) {
             if (requested ==
                 "xyz.openbmc_project.State.Host.RestartCause.WatchdogTimer")
             {
-                power_control::addRestartCause(
-                    power_control::RestartCause::watchdog);
+                addRestartCause(RestartCause::watchdog);
             }
             else
             {
@@ -2929,11 +2887,11 @@
             return 1;
         });
 
-    power_control::restartCauseIface->initialize();
+    restartCauseIface->initialize();
 
-    power_control::currentHostStateMonitor();
+    currentHostStateMonitor();
 
-    power_control::io.run();
+    io.run();
 
     return 0;
 }