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: I7b90380845efee6bf6a1fe342a793d71aa9ff181
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/phosphor-power-sequencer/src/device_finder.cpp b/phosphor-power-sequencer/src/device_finder.cpp
index 343b5e5..f01bc8e 100644
--- a/phosphor-power-sequencer/src/device_finder.cpp
+++ b/phosphor-power-sequencer/src/device_finder.cpp
@@ -77,9 +77,8 @@
}
}
-const DbusVariant&
- DeviceFinder::getPropertyValue(const DbusPropertyMap& properties,
- const std::string& propertyName)
+const DbusVariant& DeviceFinder::getPropertyValue(
+ const DbusPropertyMap& properties, const std::string& propertyName)
{
auto it = properties.find(propertyName);
if (it == properties.end())
diff --git a/phosphor-power-sequencer/src/pmbus_driver_device.cpp b/phosphor-power-sequencer/src/pmbus_driver_device.cpp
index e8c0e04..cb08476 100644
--- a/phosphor-power-sequencer/src/pmbus_driver_device.cpp
+++ b/phosphor-power-sequencer/src/pmbus_driver_device.cpp
@@ -93,8 +93,8 @@
{
unsigned int fileNumber = getFileNumber(page);
std::string fileName = std::format("in{}_input", fileNumber);
- std::string millivoltsStr = pmbusInterface->readString(fileName,
- Type::Hwmon);
+ std::string millivoltsStr =
+ pmbusInterface->readString(fileName, Type::Hwmon);
unsigned long millivolts = std::stoul(millivoltsStr);
volts = millivolts / 1000.0;
}
@@ -114,8 +114,8 @@
{
unsigned int fileNumber = getFileNumber(page);
std::string fileName = std::format("in{}_lcrit", fileNumber);
- std::string millivoltsStr = pmbusInterface->readString(fileName,
- Type::Hwmon);
+ std::string millivoltsStr =
+ pmbusInterface->readString(fileName, Type::Hwmon);
unsigned long millivolts = std::stoul(millivoltsStr);
volts = millivolts / 1000.0;
}
@@ -224,8 +224,8 @@
try
{
// Read voltage label file contents
- std::string contents = pmbusInterface->readString(fileName,
- Type::Hwmon);
+ std::string contents =
+ pmbusInterface->readString(fileName, Type::Hwmon);
// Check if file contents match the expected pattern
std::regex regex{"vout(\\d+)"};
diff --git a/phosphor-power-sequencer/src/pmbus_driver_device.hpp b/phosphor-power-sequencer/src/pmbus_driver_device.hpp
index e7e85ac..c8754db 100644
--- a/phosphor-power-sequencer/src/pmbus_driver_device.hpp
+++ b/phosphor-power-sequencer/src/pmbus_driver_device.hpp
@@ -61,17 +61,15 @@
* @param driverName Device driver name
* @param instance Chip instance number
*/
- explicit PMBusDriverDevice(const std::string& name,
- std::vector<std::unique_ptr<Rail>> rails,
- Services& services, uint8_t bus,
- uint16_t address,
- const std::string& driverName = "",
- size_t instance = 0) :
- StandardDevice(name, std::move(rails)),
- bus{bus}, address{address}, driverName{driverName}, instance{instance}
+ explicit PMBusDriverDevice(
+ const std::string& name, std::vector<std::unique_ptr<Rail>> rails,
+ Services& services, uint8_t bus, uint16_t address,
+ const std::string& driverName = "", size_t instance = 0) :
+ StandardDevice(name, std::move(rails)), bus{bus}, address{address},
+ driverName{driverName}, instance{instance}
{
- pmbusInterface = services.createPMBus(bus, address, driverName,
- instance);
+ pmbusInterface =
+ services.createPMBus(bus, address, driverName, instance);
}
/**
diff --git a/phosphor-power-sequencer/src/power_control.cpp b/phosphor-power-sequencer/src/power_control.cpp
index cc92ff4..c1d0079 100644
--- a/phosphor-power-sequencer/src/power_control.cpp
+++ b/phosphor-power-sequencer/src/power_control.cpp
@@ -45,8 +45,8 @@
PowerControl::PowerControl(sdbusplus::bus_t& bus,
const sdeventplus::Event& event) :
- PowerObject{bus, POWER_OBJ_PATH, PowerObject::action::defer_emit},
- bus{bus}, services{bus},
+ PowerObject{bus, POWER_OBJ_PATH, PowerObject::action::defer_emit}, bus{bus},
+ services{bus},
pgoodWaitTimer{event, std::bind(&PowerControl::onFailureCallback, this)},
powerOnAllowedTime{std::chrono::steady_clock::now() + minimumColdStartTime},
timer{event, std::bind(&PowerControl::pollPgood, this), pollInterval}
@@ -251,8 +251,8 @@
if (s == 0)
{
// Set a minimum amount of time to wait before next power on
- powerOnAllowedTime = std::chrono::steady_clock::now() +
- minimumPowerOffTime;
+ powerOnAllowedTime =
+ std::chrono::steady_clock::now() + minimumPowerOffTime;
}
pgoodTimeoutTime = std::chrono::steady_clock::now() + timeout;
@@ -312,8 +312,8 @@
powerControlLine = gpiod::find_line(powerControlLineName);
if (!powerControlLine)
{
- std::string errorString{"GPIO line name not found: " +
- powerControlLineName};
+ std::string errorString{
+ "GPIO line name not found: " + powerControlLineName};
services.logErrorMsg(errorString);
throw std::runtime_error(errorString);
}
diff --git a/phosphor-power-sequencer/src/power_interface.cpp b/phosphor-power-sequencer/src/power_interface.cpp
index 0838d8f..67a8498 100644
--- a/phosphor-power-sequencer/src/power_interface.cpp
+++ b/phosphor-power-sequencer/src/power_interface.cpp
@@ -36,11 +36,10 @@
serverInterface(bus, path, POWER_IFACE, vtable, this)
{}
-int PowerInterface::callbackGetPgood(sd_bus* /*bus*/, const char* /*path*/,
- const char* /*interface*/,
- const char* /*property*/,
- sd_bus_message* msg, void* context,
- sd_bus_error* error)
+int PowerInterface::callbackGetPgood(
+ sd_bus* /*bus*/, const char* /*path*/, const char* /*interface*/,
+ const char* /*property*/, sd_bus_message* msg, void* context,
+ sd_bus_error* error)
{
if (msg != nullptr && context != nullptr)
{
@@ -68,12 +67,10 @@
return 1;
}
-int PowerInterface::callbackGetPgoodTimeout(sd_bus* /*bus*/,
- const char* /*path*/,
- const char* /*interface*/,
- const char* /*property*/,
- sd_bus_message* msg, void* context,
- sd_bus_error* error)
+int PowerInterface::callbackGetPgoodTimeout(
+ sd_bus* /*bus*/, const char* /*path*/, const char* /*interface*/,
+ const char* /*property*/, sd_bus_message* msg, void* context,
+ sd_bus_error* error)
{
if (msg != nullptr && context != nullptr)
{
@@ -135,12 +132,10 @@
return 1;
}
-int PowerInterface::callbackSetPgoodTimeout(sd_bus* /*bus*/,
- const char* /*path*/,
- const char* /*interface*/,
- const char* /*property*/,
- sd_bus_message* msg, void* context,
- sd_bus_error* error)
+int PowerInterface::callbackSetPgoodTimeout(
+ sd_bus* /*bus*/, const char* /*path*/, const char* /*interface*/,
+ const char* /*property*/, sd_bus_message* msg, void* context,
+ sd_bus_error* error)
{
if (msg != nullptr && context != nullptr)
{
@@ -172,11 +167,10 @@
return 1;
}
-int PowerInterface::callbackGetState(sd_bus* /*bus*/, const char* /*path*/,
- const char* /*interface*/,
- const char* /*property*/,
- sd_bus_message* msg, void* context,
- sd_bus_error* error)
+int PowerInterface::callbackGetState(
+ sd_bus* /*bus*/, const char* /*path*/, const char* /*interface*/,
+ const char* /*property*/, sd_bus_message* msg, void* context,
+ sd_bus_error* error)
{
if (msg != nullptr && context != nullptr)
{
@@ -245,9 +239,8 @@
return 1;
}
-int PowerInterface::callbackSetPowerSupplyError(sd_bus_message* msg,
- void* context,
- sd_bus_error* error)
+int PowerInterface::callbackSetPowerSupplyError(
+ sd_bus_message* msg, void* context, sd_bus_error* error)
{
if (msg != nullptr && context != nullptr)
{
diff --git a/phosphor-power-sequencer/src/power_interface.hpp b/phosphor-power-sequencer/src/power_interface.hpp
index 6b07d41..e52ff28 100644
--- a/phosphor-power-sequencer/src/power_interface.hpp
+++ b/phosphor-power-sequencer/src/power_interface.hpp
@@ -111,11 +111,10 @@
/**
* Systemd bus callback for getting the pgood_timeout property
*/
- static int callbackGetPgoodTimeout(sd_bus* bus, const char* path,
- const char* interface,
- const char* property,
- sd_bus_message* msg, void* context,
- sd_bus_error* error);
+ static int callbackGetPgoodTimeout(
+ sd_bus* bus, const char* path, const char* interface,
+ const char* property, sd_bus_message* msg, void* context,
+ sd_bus_error* error);
/**
* Systemd bus callback for the getPowerState method
@@ -134,11 +133,10 @@
/**
* Systemd bus callback for setting the pgood_timeout property
*/
- static int callbackSetPgoodTimeout(sd_bus* bus, const char* path,
- const char* interface,
- const char* property,
- sd_bus_message* msg, void* context,
- sd_bus_error* error);
+ static int callbackSetPgoodTimeout(
+ sd_bus* bus, const char* path, const char* interface,
+ const char* property, sd_bus_message* msg, void* context,
+ sd_bus_error* error);
/**
* Systemd bus callback for the setPowerSupplyError method
diff --git a/phosphor-power-sequencer/src/rail.hpp b/phosphor-power-sequencer/src/rail.hpp
index ee331ca..040eb81 100644
--- a/phosphor-power-sequencer/src/rail.hpp
+++ b/phosphor-power-sequencer/src/rail.hpp
@@ -94,9 +94,8 @@
const std::optional<uint8_t>& page, bool isPowerSupplyRail,
bool checkStatusVout, bool compareVoltageToLimit,
const std::optional<GPIO>& gpio) :
- name{name},
- presence{presence}, page{page}, isPsuRail{isPowerSupplyRail},
- checkStatusVout{checkStatusVout},
+ name{name}, presence{presence}, page{page},
+ isPsuRail{isPowerSupplyRail}, checkStatusVout{checkStatusVout},
compareVoltageToLimit{compareVoltageToLimit}, gpio{gpio}
{
// If checking STATUS_VOUT or output voltage, verify PAGE was specified
diff --git a/phosphor-power-sequencer/src/services.hpp b/phosphor-power-sequencer/src/services.hpp
index 3fa0f6f..d573743 100644
--- a/phosphor-power-sequencer/src/services.hpp
+++ b/phosphor-power-sequencer/src/services.hpp
@@ -122,10 +122,9 @@
* @param instance Chip instance number
* @return object for communicating with PMBus device
*/
- virtual std::unique_ptr<PMBusBase>
- createPMBus(uint8_t bus, uint16_t address,
- const std::string& driverName = "",
- size_t instance = 0) = 0;
+ virtual std::unique_ptr<PMBusBase> createPMBus(
+ uint8_t bus, uint16_t address, const std::string& driverName = "",
+ size_t instance = 0) = 0;
/**
* Creates a BMC dump.
@@ -196,13 +195,12 @@
getGPIOValues(const std::string& chipLabel) override;
/** @copydoc Services::createPMBus() */
- virtual std::unique_ptr<PMBusBase>
- createPMBus(uint8_t bus, uint16_t address,
- const std::string& driverName = "",
- size_t instance = 0) override
+ virtual std::unique_ptr<PMBusBase> createPMBus(
+ uint8_t bus, uint16_t address, const std::string& driverName = "",
+ size_t instance = 0) override
{
- std::string path = std::format("/sys/bus/i2c/devices/{}-{:04x}", bus,
- address);
+ std::string path =
+ std::format("/sys/bus/i2c/devices/{}-{:04x}", bus, address);
return std::make_unique<PMBus>(path, driverName, instance);
}
diff --git a/phosphor-power-sequencer/src/standard_device.cpp b/phosphor-power-sequencer/src/standard_device.cpp
index 5bfbfb3..d3c4915 100644
--- a/phosphor-power-sequencer/src/standard_device.cpp
+++ b/phosphor-power-sequencer/src/standard_device.cpp
@@ -40,8 +40,8 @@
std::vector<int> gpioValues = getGPIOValuesIfPossible(services);
// Try to find a voltage rail where a pgood fault occurred
- Rail* rail = findRailWithPgoodFault(services, gpioValues,
- additionalData);
+ Rail* rail =
+ findRailWithPgoodFault(services, gpioValues, additionalData);
if (rail != nullptr)
{
services.logErrorMsg(std::format(
diff --git a/phosphor-power-sequencer/src/standard_device.hpp b/phosphor-power-sequencer/src/standard_device.hpp
index 2c1cf3b..245af38 100644
--- a/phosphor-power-sequencer/src/standard_device.hpp
+++ b/phosphor-power-sequencer/src/standard_device.hpp
@@ -57,8 +57,7 @@
*/
explicit StandardDevice(const std::string& name,
std::vector<std::unique_ptr<Rail>> rails) :
- name{name},
- rails{std::move(rails)}
+ name{name}, rails{std::move(rails)}
{}
/** @copydoc PowerSequencerDevice::getName() */
diff --git a/phosphor-power-sequencer/src/ucd90320_device.cpp b/phosphor-power-sequencer/src/ucd90320_device.cpp
index 2d91797..40516d5 100644
--- a/phosphor-power-sequencer/src/ucd90320_device.cpp
+++ b/phosphor-power-sequencer/src/ucd90320_device.cpp
@@ -56,8 +56,8 @@
std::map<std::string, std::string>& additionalData)
{
// Verify the expected number of GPIO values were passed in
- unsigned int expectedCount = gpioGroups.back().offset +
- gpioGroups.back().count;
+ unsigned int expectedCount =
+ gpioGroups.back().offset + gpioGroups.back().count;
if (values.size() != expectedCount)
{
// Unexpected number of values; store as a plain list of integers