app: Optimize ipmi complete code
Encapsulate the custom status return code into an ipmi method and
then use it in cpp.
Change-Id: If1ce2bbb1a234c574bc89832dbb87004937d1d38
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/app/watchdog.cpp b/app/watchdog.cpp
index e0c1e03..eae7344 100644
--- a/app/watchdog.cpp
+++ b/app/watchdog.cpp
@@ -21,6 +21,16 @@
static bool lastCallSuccessful = false;
+namespace ipmi
+{
+constexpr Cc ccWatchdogNotInit = 0x80;
+
+static inline auto responseWatchdogNotInit()
+{
+ return response(ccWatchdogNotInit);
+}
+} // namespace ipmi
+
void reportError()
{
// We don't want to fill the SEL with errors if the daemon dies and doesn't
@@ -52,8 +62,7 @@
{
lastCallSuccessful = true;
- constexpr uint8_t ccWatchdogNotInit = 0x80;
- return ipmi::response(ccWatchdogNotInit);
+ return ipmi::responseWatchdogNotInit();
}
// The ipmi standard dictates we enable the watchdog during reset