Update clang-format
Refer:https://github.com/openbmc/docs/blob/ac5d544553934f8083c61c5986a1420261bc8a4c/style/cpp/.clang-format
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I593ddf950d14009ab77251fd6d3f248214661765
diff --git a/src/button_handler.cpp b/src/button_handler.cpp
index 55f5db5..a819183 100644
--- a/src/button_handler.cpp
+++ b/src/button_handler.cpp
@@ -196,7 +196,8 @@
switch (powerEventType)
{
- case PowerEvent::powerPressed: {
+ case PowerEvent::powerPressed:
+ {
objPathName = HOST_STATE_OBJECT_NAME + hostNumStr;
dbusIfaceName = hostIface;
transitionName = "RequestedHostTransition";
@@ -211,7 +212,8 @@
break;
}
- case PowerEvent::longPowerPressed: {
+ case PowerEvent::longPowerPressed:
+ {
dbusIfaceName = chassisIface;
transitionName = "RequestedPowerTransition";
objPathName = CHASSIS_STATE_OBJECT_NAME + hostNumStr;
@@ -244,8 +246,8 @@
break;
}
- case PowerEvent::resetPressed: {
-
+ case PowerEvent::resetPressed:
+ {
objPathName = HOST_STATE_OBJECT_NAME + hostNumStr;
dbusIfaceName = hostIface;
transitionName = "RequestedHostTransition";
@@ -260,7 +262,8 @@
transition = Host::Transition::Reboot;
break;
}
- default: {
+ default:
+ {
log<level::ERR>(
"Invalid power event. skipping...",
entry("EVENT=%d", static_cast<int>(powerEventType)));
diff --git a/src/gpio.cpp b/src/gpio.cpp
index bb7f79b..86d4cec 100644
--- a/src/gpio.cpp
+++ b/src/gpio.cpp
@@ -21,12 +21,13 @@
#include <fcntl.h>
#include <unistd.h>
-#include <filesystem>
-#include <fstream>
#include <gpioplus/utility/aspeed.hpp>
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
+#include <filesystem>
+#include <fstream>
+
const std::string gpioDev = "/sys/class/gpio";
using namespace phosphor::logging;
@@ -93,7 +94,6 @@
result = configGpio(gpioCfg);
if (result < 0)
{
-
std::string errorMsg =
"Error configuring gpio: GPIO_NUM=" +
std::to_string(gpioCfg.number) +
@@ -109,7 +109,6 @@
int configGpio(gpioInfo& gpioConfig)
{
-
auto gpioNum = gpioConfig.number;
auto gpioDirection = gpioConfig.direction;
diff --git a/src/main.cpp b/src/main.cpp
index e1efd3e..624c9e7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,9 +17,10 @@
#include "button_factory.hpp"
#include "gpio.hpp"
-#include <fstream>
#include <nlohmann/json.hpp>
#include <phosphor-logging/elog-errors.hpp>
+
+#include <fstream>
static constexpr auto gpioDefFile = "/etc/default/obmc/gpio/gpio_defs.json";
using namespace phosphor::logging;
diff --git a/src/power_button.cpp b/src/power_button.cpp
index 2e69154..2446d7b 100644
--- a/src/power_button.cpp
+++ b/src/power_button.cpp
@@ -41,7 +41,6 @@
void PowerButton::handleEvent(sd_event_source* es, int fd, uint32_t revents)
{
-
int n = -1;
char buf = '0';