clang-tidy: Enable readability-convert-member-functions-to-static
This check finds non-static member functions that can be made
static because the functions don’t use this.
This check also triggers readability-static-accessed-through
-instance check as we are trying to access a static member
function through an instance.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I6efe76666f75fb4f65621796466d9347cea25d01
diff --git a/manager/lamptest/lamptest.cpp b/manager/lamptest/lamptest.cpp
index e7c9d5a..f91a085 100644
--- a/manager/lamptest/lamptest.cpp
+++ b/manager/lamptest/lamptest.cpp
@@ -31,8 +31,8 @@
if (iter != forceUpdateLEDs.end())
{
- manager.drivePhysicalLED(path, Layout::Action::Off, it.dutyOn,
- it.period);
+ phosphor::led::Manager::drivePhysicalLED(
+ path, Layout::Action::Off, it.dutyOn, it.period);
}
}
@@ -45,7 +45,8 @@
if (iter != forceUpdateLEDs.end())
{
- manager.drivePhysicalLED(path, it.action, it.dutyOn, it.period);
+ phosphor::led::Manager::drivePhysicalLED(path, it.action,
+ it.dutyOn, it.period);
}
}
@@ -80,7 +81,8 @@
continue;
}
- manager.drivePhysicalLED(path, Layout::Action::Off, 0, 0);
+ phosphor::led::Manager::drivePhysicalLED(path, Layout::Action::Off, 0,
+ 0);
}
if (std::filesystem::exists(lampTestIndicator))
@@ -146,7 +148,9 @@
uint8_t dutyOn{};
try
{
- auto properties = dBusHandler.getAllProperties(path, phyLedIntf);
+ auto properties =
+ phosphor::led::utils::DBusHandler::getAllProperties(path,
+ phyLedIntf);
state = std::get<std::string>(properties["State"]);
period = std::get<uint16_t>(properties["Period"]);
@@ -187,7 +191,8 @@
// Get paths of all the Physical LED objects
try
{
- physicalLEDPaths = dBusHandler.getSubTreePaths(phyLedPath, phyLedIntf);
+ physicalLEDPaths = phosphor::led::utils::DBusHandler::getSubTreePaths(
+ phyLedPath, phyLedIntf);
}
catch (const sdbusplus::exception_t& e)
{
@@ -233,7 +238,8 @@
continue;
}
- manager.drivePhysicalLED(path, Layout::Action::On, 0, 0);
+ phosphor::led::Manager::drivePhysicalLED(path, Layout::Action::On, 0,
+ 0);
}
}
@@ -307,9 +313,9 @@
try
{
PropertyValue assertedValue{value};
- dBusHandler.setProperty(HOST_LAMP_TEST_OBJECT,
- "xyz.openbmc_project.Led.Group", "Asserted",
- assertedValue);
+ phosphor::led::utils::DBusHandler::setProperty(
+ HOST_LAMP_TEST_OBJECT, "xyz.openbmc_project.Led.Group", "Asserted",
+ assertedValue);
}
catch (const sdbusplus::exception_t& e)
{
@@ -357,14 +363,14 @@
if (std::filesystem::exists(lampTestIndicator))
{
// we need to off all the LEDs.
- phosphor::led::utils::DBusHandler dBusHandler;
- std::vector<std::string> physicalLedPaths = dBusHandler.getSubTreePaths(
- phosphor::led::phyLedPath, phosphor::led::phyLedIntf);
+ std::vector<std::string> physicalLedPaths =
+ phosphor::led::utils::DBusHandler::getSubTreePaths(
+ phosphor::led::phyLedPath, phosphor::led::phyLedIntf);
for (const auto& path : physicalLedPaths)
{
- manager.drivePhysicalLED(path, phosphor::led::Layout::Action::Off,
- 0, 0);
+ phosphor::led::Manager::drivePhysicalLED(
+ path, phosphor::led::Layout::Action::Off, 0, 0);
}
// Also remove the lamp test on indicator file.