clang-tidy: remove some NOLINTS
Since readability-static-accessed-through-instance check has been
disabled in [1], the NOLINTs can be removed.
References:
[1] https://gerrit.openbmc.org/c/openbmc/phosphor-bmc-code-mgmt/+/80392
Change-Id: If7e80a0bc447bfbd054b6c007d230c2d14a54f41
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/bios/bios_software_manager.cpp b/bios/bios_software_manager.cpp
index 1183ea1..0c4814f 100644
--- a/bios/bios_software_manager.cpp
+++ b/bios/bios_software_manager.cpp
@@ -19,10 +19,8 @@
SoftwareManager(ctx, configTypeBIOS), dryRun(isDryRun)
{}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> BIOSSoftwareManager::initDevice(
const std::string& service, const std::string& path, SoftwareConfig& config)
-// NOLINTEND(readability-static-accessed-through-instance)
{
std::string configIface =
"xyz.openbmc_project.Configuration." + config.configType;
diff --git a/bios/spi_device.cpp b/bios/spi_device.cpp
index af9ef89..a1b1f49 100644
--- a/bios/spi_device.cpp
+++ b/bios/spi_device.cpp
@@ -87,12 +87,9 @@
"DEVICEINDEX", spiDeviceIndex);
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> SPIDevice::updateDevice(const uint8_t* image,
size_t image_size)
-// NOLINTEND(readability-static-accessed-through-instance)
{
- // NOLINTBEGIN(readability-static-accessed-through-instance)
// NOLINTNEXTLINE(clang-analyzer-core.uninitialized.Branch)
auto prevPowerstate = co_await HostPower::getState(ctx);
@@ -101,9 +98,7 @@
co_return false;
}
- // NOLINTBEGIN(readability-static-accessed-through-instance)
bool success = co_await HostPower::setState(ctx, stateOff);
- // NOLINTEND(readability-static-accessed-through-instance)
if (!success)
{
error("error changing host power state");
@@ -130,15 +125,12 @@
// return value here is only describing if we successfully wrote to the
// SPI flash. Restoring powerstate can still fail.
co_return success;
- // NOLINTEND(readability-static-accessed-through-instance)
}
const std::string spiAspeedSMCPath = "/sys/bus/platform/drivers/spi-aspeed-smc";
const std::string spiNorPath = "/sys/bus/spi/drivers/spi-nor";
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> SPIDevice::bindSPIFlash()
-// NOLINTEND(readability-static-accessed-through-instance)
{
if (!SPIDevice::isSPIControllerBound())
{
@@ -178,9 +170,7 @@
co_return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> SPIDevice::unbindSPIFlash()
-// NOLINTEND(readability-static-accessed-through-instance)
{
debug("unbinding flash");
@@ -259,10 +249,8 @@
return lineBulk;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> SPIDevice::writeSPIFlash(const uint8_t* image,
size_t image_size)
-// NOLINTEND(readability-static-accessed-through-instance)
{
debug("[gpio] requesting gpios to mux SPI to BMC");
@@ -330,10 +318,8 @@
co_return success;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<int> asyncSystem(sdbusplus::async::context& ctx,
const std::string& cmd)
-// NOLINTEND(readability-static-accessed-through-instance)
{
int pipefd[2];
if (pipe(pipefd) == -1)
@@ -375,10 +361,8 @@
}
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<int> SPIDevice::writeSPIFlashWithFlashrom(
const uint8_t* image, size_t image_size) const
-// NOLINTEND(readability-static-accessed-through-instance)
{
// randomize the name to enable parallel updates
const std::string path = "/tmp/spi-device-image-" +
@@ -447,10 +431,8 @@
co_return exitCode;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> SPIDevice::writeSPIFlashWithFlashcp(
const uint8_t* image, size_t image_size) const
-// NOLINTEND(readability-static-accessed-through-instance)
{
// randomize the name to enable parallel updates
const std::string path = "/tmp/spi-device-image-" +
@@ -495,10 +477,8 @@
co_return exitCode == 0;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> SPIDevice::writeSPIFlashDefault(
const uint8_t* image, size_t image_size)
-// NOLINTEND(readability-static-accessed-through-instance)
{
auto devPath = getMTDDevicePath();
@@ -578,7 +558,6 @@
return version;
}
-// NOLINTNEXTLINE(readability-static-accessed-through-instance)
auto SPIDevice::processUpdate(std::string versionFileName)
-> sdbusplus::async::task<>
{
diff --git a/common/i2c/i2c.cpp b/common/i2c/i2c.cpp
index 6f8414d..fb8bee0 100644
--- a/common/i2c/i2c.cpp
+++ b/common/i2c/i2c.cpp
@@ -31,11 +31,9 @@
return 0;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> I2C::sendReceive(
uint8_t* writeData, uint8_t writeSize, uint8_t* readData,
uint8_t readSize) const
-// NOLINTEND(readability-static-accessed-through-instance)
{
bool result = true;
diff --git a/common/src/device.cpp b/common/src/device.cpp
index 9e2278d..b71b2cb 100644
--- a/common/src/device.cpp
+++ b/common/src/device.cpp
@@ -32,13 +32,11 @@
parent(parent), ctx(ctx)
{}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> Device::getImageInfo(
std::unique_ptr<void, std::function<void(void*)>>& pldmPackage,
size_t pldmPackageSize, uint8_t** matchingComponentImage,
size_t* componentImageSize, std::string& componentVersion)
-// NOLINTEND(readability-static-accessed-through-instance)
{
std::shared_ptr<PackageParser> packageParser =
pldm_package_util::parsePLDMPackage(
@@ -67,11 +65,9 @@
co_return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> Device::startUpdateAsync(
sdbusplus::message::unix_fd image, RequestedApplyTimes applyTime,
std::unique_ptr<Software> softwarePendingIn)
-// NOLINTEND(readability-static-accessed-through-instance)
{
debug("starting the async update with memfd {FD}", "FD", image.fd);
@@ -135,9 +131,7 @@
return config.configType;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> Device::resetDevice()
-// NOLINTEND(readability-static-accessed-through-instance)
{
debug("Default implementation for device reset");
@@ -156,11 +150,9 @@
return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> Device::continueUpdateWithMappedPackage(
const uint8_t* matchingComponentImage, size_t componentImageSize,
const std::string& componentVersion, RequestedApplyTimes applyTime)
-// NOLINTEND(readability-static-accessed-through-instance)
{
softwarePending->setActivation(ActivationInterface::Activations::Ready);
diff --git a/common/src/host_power.cpp b/common/src/host_power.cpp
index f76affb..4aeebcb 100644
--- a/common/src/host_power.cpp
+++ b/common/src/host_power.cpp
@@ -38,10 +38,8 @@
StateIntf::interface))
{}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> HostPower::setState(sdbusplus::async::context& ctx,
HostState state)
-// NOLINTEND(readability-static-accessed-through-instance)
{
if (state != stateOn && state != stateOff)
{
@@ -79,10 +77,8 @@
co_return false;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<HostState> HostPower::getState(
sdbusplus::async::context& ctx)
-// NOLINTEND(readability-static-accessed-through-instance)
{
auto client = sdbusplus::client::xyz::openbmc_project::state::Host(ctx)
.service(service)
diff --git a/common/src/software.cpp b/common/src/software.cpp
index 504a9ae..5fb8a8a 100644
--- a/common/src/software.cpp
+++ b/common/src/software.cpp
@@ -69,9 +69,7 @@
return std::format("{}_{}", parent.config.configName, getRandomId());
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<> Software::createInventoryAssociations(bool isRunning)
-// NOLINTEND(readability-static-accessed-through-instance)
{
debug("{SWID}: setting association definitions", "SWID", swid);
diff --git a/common/src/software_config.cpp b/common/src/software_config.cpp
index b476afd..68439aa 100644
--- a/common/src/software_config.cpp
+++ b/common/src/software_config.cpp
@@ -34,10 +34,8 @@
}
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<std::string> SoftwareConfig::getInventoryItemObjectPath(
sdbusplus::async::context& ctx)
-// NOLINTEND(readability-static-accessed-through-instance)
{
std::vector<std::string> allInterfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
diff --git a/common/src/software_manager.cpp b/common/src/software_manager.cpp
index 2173458..1ff7c31 100644
--- a/common/src/software_manager.cpp
+++ b/common/src/software_manager.cpp
@@ -45,11 +45,9 @@
debug("Initialized SoftwareManager");
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
static sdbusplus::async::task<std::optional<SoftwareConfig>> getConfig(
sdbusplus::async::context& ctx, const std::string& service,
const std::string& objectPath, const std::string& interfacePrefix)
-// NOLINTEND(readability-static-accessed-through-instance)
{
auto client = sdbusplus::async::proxy()
.service(service)
@@ -103,10 +101,8 @@
configName);
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<> SoftwareManager::initDevices(
const std::vector<std::string>& configurationInterfaces)
-// NOLINTEND(readability-static-accessed-through-instance)
{
ctx.spawn(interfaceAddedMatch(configurationInterfaces));
ctx.spawn(interfaceRemovedMatch(configurationInterfaces));
@@ -152,11 +148,9 @@
debug("Done with initial configuration");
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<void> SoftwareManager::handleInterfaceAdded(
const std::string& service, const std::string& path,
const std::string& interface)
-// NOLINTEND(readability-static-accessed-through-instance)
{
debug("Found configuration interface at {SERVICE}, {PATH}", "SERVICE",
service, "PATH", path);
@@ -187,10 +181,8 @@
using InterfacesMap = boost::container::flat_map<std::string, BasicVariantType>;
using ConfigMap = boost::container::flat_map<std::string, InterfacesMap>;
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<void> SoftwareManager::interfaceAddedMatch(
std::vector<std::string> interfaces)
-// NOLINTEND(readability-static-accessed-through-instance)
{
while (!ctx.stop_requested())
{
@@ -214,10 +206,8 @@
}
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<void> SoftwareManager::interfaceRemovedMatch(
std::vector<std::string> interfaces)
-// NOLINTEND(readability-static-accessed-through-instance)
{
while (!ctx.stop_requested())
{
diff --git a/common/src/software_update.cpp b/common/src/software_update.cpp
index df964a2..14e4671 100644
--- a/common/src/software_update.cpp
+++ b/common/src/software_update.cpp
@@ -85,7 +85,6 @@
std::string newObjPath = softwareInstance->objectPath;
- // NOLINTBEGIN(readability-static-accessed-through-instance)
ctx.spawn(
[](Device& device, int imageDup, RequestedApplyTimes applyTime,
std::unique_ptr<Software> swupdate) -> sdbusplus::async::task<> {
@@ -95,7 +94,6 @@
close(imageDup);
co_return;
}(device, imageDup, applyTime, std::move(softwareInstance)));
- // NOLINTEND
// We need the object path for the new software here.
// It must be the same as constructed during the update process.
diff --git a/eeprom-device/eeprom_device.cpp b/eeprom-device/eeprom_device.cpp
index 277c84e..ca27c28 100644
--- a/eeprom-device/eeprom_device.cpp
+++ b/eeprom-device/eeprom_device.cpp
@@ -88,10 +88,8 @@
return lineBulks;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<int> asyncSystem(sdbusplus::async::context& ctx,
const std::string& cmd)
-// NOLINTEND(readability-static-accessed-through-instance)
{
int pipefd[2];
if (pipe(pipefd) == -1)
@@ -195,10 +193,8 @@
debug("Initialized EEPROM device instance on dbus");
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> EEPROMDevice::updateDevice(const uint8_t* image,
size_t image_size)
-// NOLINTEND(readability-static-accessed-through-instance)
{
std::vector<std::unique_ptr<::gpiod::line_bulk>> lineBulks;
@@ -285,9 +281,7 @@
co_return success;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> EEPROMDevice::bindEEPROM()
-// NOLINTEND(readability-static-accessed-through-instance)
{
auto i2cDeviceId = getI2CDeviceId(bus, address);
@@ -333,9 +327,7 @@
co_return bound;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> EEPROMDevice::unbindEEPROM()
-// NOLINTEND(readability-static-accessed-through-instance)
{
auto i2cDeviceId = getI2CDeviceId(bus, address);
@@ -386,10 +378,8 @@
return std::filesystem::exists(driverPath + "/" + i2cDeviceId);
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<int> EEPROMDevice::writeEEPROM(const uint8_t* image,
size_t image_size) const
-// NOLINTEND(readability-static-accessed-through-instance)
{
auto eepromPath = getEEPROMPath(bus, address);
if (eepromPath.empty())
@@ -432,9 +422,7 @@
co_return exitCode;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<> EEPROMDevice::processHostStateChange()
-// NOLINTEND(readability-static-accessed-through-instance)
{
auto requiredHostState = deviceVersion->getHostStateToQueryVersion();
diff --git a/eeprom-device/eeprom_device_software_manager.cpp b/eeprom-device/eeprom_device_software_manager.cpp
index 0f30dc7..79b273e 100644
--- a/eeprom-device/eeprom_device_software_manager.cpp
+++ b/eeprom-device/eeprom_device_software_manager.cpp
@@ -32,10 +32,8 @@
ctx.run();
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> EEPROMDeviceSoftwareManager::initDevice(
const std::string& service, const std::string& path, SoftwareConfig& config)
-// NOLINTEND(readability-static-accessed-through-instance)
{
const std::string configIface =
"xyz.openbmc_project.Configuration." + config.configType;
diff --git a/i2c-vr/i2cvr_device.cpp b/i2c-vr/i2cvr_device.cpp
index b695689..61c1a55 100644
--- a/i2c-vr/i2cvr_device.cpp
+++ b/i2c-vr/i2cvr_device.cpp
@@ -7,10 +7,8 @@
namespace phosphor::software::i2c_vr::device
{
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> I2CVRDevice::updateDevice(const uint8_t* image,
size_t imageSize)
-// NOLINTEND(readability-static-accessed-through-instance)
{
bool ret = false;
setUpdateProgress(20);
@@ -50,9 +48,7 @@
co_return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> I2CVRDevice::getVersion(uint32_t* sum) const
-// NOLINTEND(readability-static-accessed-through-instance)
{
// NOLINTBEGIN(clang-analyzer-core.uninitialized.Branch)
if (!(co_await this->vrInterface->getCRC(sum)))
diff --git a/i2c-vr/i2cvr_software_manager.cpp b/i2c-vr/i2cvr_software_manager.cpp
index 4c9d398..1185648 100644
--- a/i2c-vr/i2cvr_software_manager.cpp
+++ b/i2c-vr/i2cvr_software_manager.cpp
@@ -40,10 +40,8 @@
ctx.run();
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> I2CVRSoftwareManager::initDevice(
const std::string& service, const std::string& path, SoftwareConfig& config)
-// NOLINTEND(readability-static-accessed-through-instance)
{
std::string configIface =
"xyz.openbmc_project.Configuration." + config.configType;
diff --git a/i2c-vr/xdpe1x2xx/xdpe1x2xx.cpp b/i2c-vr/xdpe1x2xx/xdpe1x2xx.cpp
index 28894e0..59c0560 100644
--- a/i2c-vr/xdpe1x2xx/xdpe1x2xx.cpp
+++ b/i2c-vr/xdpe1x2xx/xdpe1x2xx.cpp
@@ -61,9 +61,7 @@
VoltageRegulator(ctx), i2cInterface(phosphor::i2c::I2C(bus, address))
{}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> XDPE1X2XX::getDeviceId(uint8_t* deviceID)
-// NOLINTEND(readability-static-accessed-through-instance)
{
bool ret = false;
uint8_t tbuf[16] = {0};
@@ -85,10 +83,8 @@
co_return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> XDPE1X2XX::mfrFWcmd(uint8_t cmd, uint8_t* data,
uint8_t* resp)
-// NOLINTEND(readability-static-accessed-through-instance)
{
bool ret = false;
uint8_t tBuf[16] = {0};
@@ -151,9 +147,7 @@
co_return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> XDPE1X2XX::getRemainingWrites(uint8_t* remain)
-// NOLINTEND(readability-static-accessed-through-instance)
{
bool ret = false;
uint8_t tBuf[16] = {0};
@@ -211,9 +205,7 @@
return size;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> XDPE1X2XX::getCRC(uint32_t* checksum)
-// NOLINTEND(readability-static-accessed-through-instance)
{
uint8_t tBuf[16] = {0};
uint8_t rBuf[16] = {0};
@@ -233,9 +225,7 @@
co_return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> XDPE1X2XX::program(bool force)
-// NOLINTEND(readability-static-accessed-through-instance)
{
bool ret = false;
@@ -629,10 +619,8 @@
return 0;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> XDPE1X2XX::verifyImage(const uint8_t* image,
size_t imageSize)
-// NOLINTEND(readability-static-accessed-through-instance)
{
if (parseImage(image, imageSize) < 0)
{
@@ -649,9 +637,7 @@
co_return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> XDPE1X2XX::updateFirmware(bool force)
-// NOLINTEND(readability-static-accessed-through-instance)
{
// NOLINTBEGIN(clang-analyzer-core.uninitialized.Branch)
bool ret = co_await program(force);
@@ -680,9 +666,7 @@
co_return true;
}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> XDPE1X2XX::reset()
-// NOLINTEND(readability-static-accessed-through-instance)
{
bool ret = co_await mfrFWcmd(MFRFwCmdReset, NULL, NULL);
if (!ret)
diff --git a/test/common/exampledevice/example_device.cpp b/test/common/exampledevice/example_device.cpp
index 78a46f5..da51131 100644
--- a/test/common/exampledevice/example_device.cpp
+++ b/test/common/exampledevice/example_device.cpp
@@ -41,11 +41,9 @@
SoftwareManager(ctx, "ExampleUpdater" + std::to_string(uniqueSuffix))
{}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> ExampleCodeUpdater::initDevice(
const std::string& /*unused*/, const std::string& /*unused*/,
SoftwareConfig& /*unused*/)
-// NOLINTEND(readability-static-accessed-through-instance)
{
auto device = std::make_unique<ExampleDevice>(ctx, this);
@@ -70,10 +68,8 @@
{RequestedApplyTimes::Immediate, RequestedApplyTimes::OnReset})
{}
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> ExampleDevice::updateDevice(
const uint8_t* /*unused*/, size_t compImageSize)
-// NOLINTEND(readability-static-accessed-through-instance)
{
debug("Called device specific update function with image size {SIZE}",
"SIZE", compImageSize);
diff --git a/test/common/exampledevice/example_device.hpp b/test/common/exampledevice/example_device.hpp
index 928af3b..247fb07 100644
--- a/test/common/exampledevice/example_device.hpp
+++ b/test/common/exampledevice/example_device.hpp
@@ -46,10 +46,8 @@
phosphor::software::manager::SoftwareManager* parent,
const SoftwareConfig& config = defaultConfig);
- // NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<bool> updateDevice(const uint8_t* image,
size_t image_size) override;
- // NOLINTEND(readability-static-accessed-through-instance)
bool deviceSpecificUpdateFunctionCalled = false;
};
diff --git a/test/common/exampledevice/example_updater_main.cpp b/test/common/exampledevice/example_updater_main.cpp
index fbd7994..6a1d3bb 100644
--- a/test/common/exampledevice/example_updater_main.cpp
+++ b/test/common/exampledevice/example_updater_main.cpp
@@ -4,9 +4,7 @@
using namespace phosphor::software::example_device;
-// NOLINTBEGIN(readability-static-accessed-through-instance)
sdbusplus::async::task<void> init(ExampleCodeUpdater& updater)
-// NOLINTEND(readability-static-accessed-through-instance)
{
/*
* In Concrete updaters, the initDevices() function needs to be called,